comparison frontends/src/tools/xmlui.py @ 2093:cbf3af02e941

frontends(xmlui): better handling of missing _xmluiAppend
author Goffi <goffi@goffi.org>
date Sun, 18 Dec 2016 10:15:57 +0100
parents db3bbbd745e4
children 5defafc8ede6
comparison
equal deleted inserted replaced
2092:5e79ba00c1e2 2093:cbf3af02e941
384 else: 384 else:
385 log.warning(_("Unknown container [%s], using default one") % type_) 385 log.warning(_("Unknown container [%s], using default one") % type_)
386 cont = self.widget_factory.createVerticalContainer(_xmlui_parent) 386 cont = self.widget_factory.createVerticalContainer(_xmlui_parent)
387 self._parseChilds(cont, node, ('widget', 'container')) 387 self._parseChilds(cont, node, ('widget', 'container'))
388 try: 388 try:
389 _xmlui_parent._xmluiAppend(cont) 389 xmluiAppend = _xmlui_parent._xmluiAppend
390 except (AttributeError, TypeError): # XXX: TypeError is here because pyjamas raise a TypeError instead of an AttributeError 390 except (AttributeError, TypeError): # XXX: TypeError is here because pyjamas raise a TypeError instead of an AttributeError
391 if _xmlui_parent is self: 391 if _xmlui_parent is self:
392 self.main_cont = cont 392 self.main_cont = cont
393 else: 393 else:
394 raise Exception(_("Internal Error, container has not _xmluiAppend method")) 394 raise Exception(_("Internal Error, container has not _xmluiAppend method"))
395 else:
396 xmluiAppend(cont)
395 397
396 elif node.nodeName == 'tab': 398 elif node.nodeName == 'tab':
397 name = node.getAttribute('name') 399 name = node.getAttribute('name')
398 label = node.getAttribute('label') 400 label = node.getAttribute('label')
399 selected = C.bool(node.getAttribute('selected') or C.BOOL_FALSE) 401 selected = C.bool(node.getAttribute('selected') or C.BOOL_FALSE)