core, frontends: implementation of AdvancedListContainer first draft + misc:
/!\ Urwid SàText must be updated as the new TableContainer is used /!\
- fixed button value in paramsXML2XMLUI
- new Urwid SàText TabContainer is used in Primitivus for PairsContainer and AdvancedListContainer
- fixed in core's XMLUI AdvanceListContainer
This commit is contained in:
parent
b3fb68cb63
commit
9661c1c2c5
1 changed files with 77 additions and 37 deletions
|
|
@ -120,6 +120,10 @@ class VerticalContainer(Container):
|
|||
pass
|
||||
|
||||
|
||||
class AdvancedListContainer(Container):
|
||||
""" Widgets are disposed in rows with advaned features """
|
||||
pass
|
||||
|
||||
class XMLUI(object):
|
||||
""" Base class to construct SàT XML User Interface
|
||||
New frontends can inherite this class to easily implement XMLUI
|
||||
|
|
@ -178,7 +182,7 @@ class XMLUI(object):
|
|||
"""
|
||||
for node in current_node.childNodes:
|
||||
if wanted and not node.nodeName in wanted:
|
||||
raise InvalidXMLUI
|
||||
raise InvalidXMLUI('Unexpected node: [%s]' % node.nodeName)
|
||||
|
||||
if node.nodeName == "container":
|
||||
type_ = node.getAttribute('type')
|
||||
|
|
@ -195,6 +199,13 @@ class XMLUI(object):
|
|||
elif type_ == "pairs":
|
||||
cont = self.widget_factory.createPairsContainer(parent)
|
||||
self._parseChilds(cont, node, ('widget', 'container'))
|
||||
elif type_ == "advanced_list":
|
||||
try:
|
||||
columns = int(node.getAttribute('columns'))
|
||||
except (TypeError, ValueError):
|
||||
raise DataError("Invalid columns")
|
||||
cont = self.widget_factory.createAdvancedListContainer(parent, columns)
|
||||
self._parseChilds(cont, node, ('row',))
|
||||
else:
|
||||
warning(_("Unknown container [%s], using default one") % type_)
|
||||
cont = self.widget_factory.createVerticalContainer(parent)
|
||||
|
|
@ -207,7 +218,7 @@ class XMLUI(object):
|
|||
else:
|
||||
raise Exception(_("Internal Error, container has not _xmluiAppend method"))
|
||||
|
||||
elif node.nodeName == "tab":
|
||||
elif node.nodeName == 'tab':
|
||||
name = node.getAttribute('name')
|
||||
label = node.getAttribute('label')
|
||||
if not name or not isinstance(data, TabsContainer):
|
||||
|
|
@ -218,6 +229,10 @@ class XMLUI(object):
|
|||
new_tab = tab_cont._xmluiAddTab(label or name)
|
||||
self._parseChilds(new_tab, node, ('widget', 'container'))
|
||||
|
||||
elif node.nodeName == 'row':
|
||||
parent._xmluiAddRow()
|
||||
self._parseChilds(parent, node, ('widget', 'container'))
|
||||
|
||||
elif node.nodeName == "widget":
|
||||
id_ = node.getAttribute("id")
|
||||
name = node.getAttribute("name")
|
||||
|
|
|
|||
Loading…
Reference in a new issue