Mercurial > libervia-backend
comparison 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 |
comparison
equal
deleted
inserted
replaced
2360:72cbb6478f97 | 2361:5defafc8ede6 |
---|---|
148 assert instance.__class__ in cls.__bases__ | 148 assert instance.__class__ in cls.__bases__ |
149 instance.__class__ = type(cls.__name__, cls.__bases__, dict(cls.__dict__)) | 149 instance.__class__ = type(cls.__name__, cls.__bases__, dict(cls.__dict__)) |
150 | 150 |
151 | 151 |
152 class PairsContainer(Container): | 152 class PairsContainer(Container): |
153 """Widgets are disposed in rows of two (usually label/input) """ | 153 """Widgets are disposed in rows of two (usually label/input)""" |
154 pass | |
155 | |
156 | |
157 class LabelContainer(Container): | |
158 """Widgets are associated with label or empty widget""" | |
154 pass | 159 pass |
155 | 160 |
156 | 161 |
157 class TabsContainer(Container): | 162 class TabsContainer(Container): |
158 """A container which several other containers in tabs | 163 """A container which several other containers in tabs |
361 elif type_ == "vertical": | 366 elif type_ == "vertical": |
362 cont = self.widget_factory.createVerticalContainer(_xmlui_parent) | 367 cont = self.widget_factory.createVerticalContainer(_xmlui_parent) |
363 self._parseChilds(cont, node, ('widget', 'container')) | 368 self._parseChilds(cont, node, ('widget', 'container')) |
364 elif type_ == "pairs": | 369 elif type_ == "pairs": |
365 cont = self.widget_factory.createPairsContainer(_xmlui_parent) | 370 cont = self.widget_factory.createPairsContainer(_xmlui_parent) |
371 self._parseChilds(cont, node, ('widget', 'container')) | |
372 elif type_ == "label": | |
373 cont = self.widget_factory.createLabelContainer(_xmlui_parent) | |
366 self._parseChilds(cont, node, ('widget', 'container')) | 374 self._parseChilds(cont, node, ('widget', 'container')) |
367 elif type_ == "advanced_list": | 375 elif type_ == "advanced_list": |
368 try: | 376 try: |
369 columns = int(node.getAttribute('columns')) | 377 columns = int(node.getAttribute('columns')) |
370 except (TypeError, ValueError): | 378 except (TypeError, ValueError): |