# HG changeset patch # User Goffi # Date 1546450336 -3600 # Node ID 5c2ed8a5ae22e1638e940092f9b5035f2fbf3c74 # Parent df2bc2e704bcdf020508786dff55418327dbfdf7 frontends (XMLUI): TabsContainer can now be the main container (Primitivus keep the old behaviour and always use VerticalContainer as main container) diff -r df2bc2e704bc -r 5c2ed8a5ae22 sat/tools/xml_tools.py --- a/sat/tools/xml_tools.py Wed Jan 02 18:28:30 2019 +0100 +++ b/sat/tools/xml_tools.py Wed Jan 02 18:32:16 2019 +0100 @@ -693,10 +693,12 @@ class PairsContainer(Container): + """Container with series of 2 elements""" type = "pairs" class LabelContainer(Container): + """Like PairsContainer, but first element can only be a label""" type = "label" diff -r df2bc2e704bc -r 5c2ed8a5ae22 sat_frontends/primitivus/xmlui.py --- a/sat_frontends/primitivus/xmlui.py Wed Jan 02 18:28:30 2019 +0100 +++ b/sat_frontends/primitivus/xmlui.py Wed Jan 02 18:32:16 2019 +0100 @@ -432,6 +432,20 @@ ) PrimitivusWidget.__init__(self, self.main_cont, self.xmlui_title) + + def _parseChilds(self, _xmlui_parent, current_node, wanted=("container",), data=None): + # Small hack to always have a VerticalContainer as main container in Primitivus. + # this used to be the default behaviour for all frontends, but now + # TabsContainer can also be the main container. + if _xmlui_parent is self: + node = current_node.childNodes[0] + if node.nodeName == "container" and node.getAttribute("type") == "tabs": + _xmlui_parent = self.widget_factory.createVerticalContainer(self) + self.main_cont = _xmlui_parent + return super(XMLUIPanel, self)._parseChilds(_xmlui_parent, current_node, wanted, + data) + + def constructUI(self, parsed_dom): def postTreat(): assert self.main_cont.body diff -r df2bc2e704bc -r 5c2ed8a5ae22 sat_frontends/tools/xmlui.py --- a/sat_frontends/tools/xmlui.py Wed Jan 02 18:28:30 2019 +0100 +++ b/sat_frontends/tools/xmlui.py Wed Jan 02 18:32:16 2019 +0100 @@ -439,7 +439,7 @@ if node.nodeName == "container": type_ = node.getAttribute("type") - if _xmlui_parent is self and type_ != "vertical": + if _xmlui_parent is self and type_ not in ("vertical", "tabs"): # main container is not a VerticalContainer and we want one, # so we create one to wrap it _xmlui_parent = self.widget_factory.createVerticalContainer(self)