diff --git a/sat/tools/xml_tools.py b/sat/tools/xml_tools.py index 80910fe8..01d87a55 100644 --- a/sat/tools/xml_tools.py +++ b/sat/tools/xml_tools.py @@ -693,10 +693,12 @@ class HorizontalContainer(Container): 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 --git a/sat_frontends/primitivus/xmlui.py b/sat_frontends/primitivus/xmlui.py index 332bb089..cd98de36 100644 --- a/sat_frontends/primitivus/xmlui.py +++ b/sat_frontends/primitivus/xmlui.py @@ -432,6 +432,20 @@ class XMLUIPanel(xmlui.XMLUIPanel, PrimitivusWidget): ) 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 --git a/sat_frontends/tools/xmlui.py b/sat_frontends/tools/xmlui.py index eebb74ff..97ebe403 100644 --- a/sat_frontends/tools/xmlui.py +++ b/sat_frontends/tools/xmlui.py @@ -439,7 +439,7 @@ class XMLUIPanel(XMLUIBase): 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)