diff sat_frontends/primitivus/xmlui.py @ 2737:5c2ed8a5ae22

frontends (XMLUI): TabsContainer can now be the main container (Primitivus keep the old behaviour and always use VerticalContainer as main container)
author Goffi <goffi@goffi.org>
date Wed, 02 Jan 2019 18:32:16 +0100
parents 56f94936df1e
children 378188abe941
line wrap: on
line diff
--- 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