diff frontends/src/tools/xmlui.py @ 2361:5defafc8ede6

core, frontends (xmlui): new LabelContainer: LabelContainer is like a PairContainer where first widget can only be LabelWidget or EmptyWidget. This case is the most common, and allow to generate better code when label can be associated to widget (e.g. in HTML).
author Goffi <goffi@goffi.org>
date Sun, 24 Sep 2017 16:36:11 +0200
parents cbf3af02e941
children c7a7e650ac2f
line wrap: on
line diff
--- a/frontends/src/tools/xmlui.py	Sun Sep 24 16:32:22 2017 +0200
+++ b/frontends/src/tools/xmlui.py	Sun Sep 24 16:36:11 2017 +0200
@@ -150,7 +150,12 @@
 
 
 class PairsContainer(Container):
-    """Widgets are disposed in rows of two (usually label/input) """
+    """Widgets are disposed in rows of two (usually label/input)"""
+    pass
+
+
+class LabelContainer(Container):
+    """Widgets are associated with label or empty widget"""
     pass
 
 
@@ -364,6 +369,9 @@
                 elif type_ == "pairs":
                     cont = self.widget_factory.createPairsContainer(_xmlui_parent)
                     self._parseChilds(cont, node, ('widget', 'container'))
+                elif type_ == "label":
+                    cont = self.widget_factory.createLabelContainer(_xmlui_parent)
+                    self._parseChilds(cont, node, ('widget', 'container'))
                 elif type_ == "advanced_list":
                     try:
                         columns = int(node.getAttribute('columns'))