diff --git a/frontends/src/primitivus/xmlui.py b/frontends/src/primitivus/xmlui.py index d81a2644..e7ce9851 100644 --- a/frontends/src/primitivus/xmlui.py +++ b/frontends/src/primitivus/xmlui.py @@ -279,6 +279,10 @@ class PrimitivusPairsContainer(xmlui.PairsContainer, sat_widgets.TableContainer) self.addWidget(widget) +class PrimitivusLabelContainer(PrimitivusPairsContainer, xmlui.LabelContainer): + pass + + class PrimitivusTabsContainer(xmlui.TabsContainer, sat_widgets.TabsContainer): def __init__(self, _xmlui_parent): diff --git a/frontends/src/tools/xmlui.py b/frontends/src/tools/xmlui.py index b0213971..c8dffcdd 100644 --- a/frontends/src/tools/xmlui.py +++ b/frontends/src/tools/xmlui.py @@ -150,7 +150,12 @@ class Container(Widget): 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 @@ class XMLUIPanel(XMLUIBase): 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')) diff --git a/src/tools/xml_tools.py b/src/tools/xml_tools.py index 742258b7..d419197c 100644 --- a/src/tools/xml_tools.py +++ b/src/tools/xml_tools.py @@ -111,7 +111,7 @@ def dataForm2Widgets(form_ui, form, read_only=False): if form.instructions: form_ui.addText('\n'.join(form.instructions), 'instructions') - form_ui.changeContainer("pairs") + form_ui.changeContainer("label") for field in form.fieldList: widget_type, widget_args, widget_kwargs = _dataFormField2XMLUIData(field, read_only) @@ -303,7 +303,7 @@ def paramsXML2XMLUI(xml): label = category.getAttribute('label') if not category_name: raise exceptions.DataError(_('INTERNAL ERROR: params categories must have a name')) - tabs_cont.addTab(category_name, label=label, container=PairsContainer) + tabs_cont.addTab(category_name, label=label, container=LabelContainer) for param in category.getElementsByTagName("param"): widget_kwargs = {} @@ -596,6 +596,10 @@ class PairsContainer(Container): type = "pairs" +class LabelContainer(Container): + type = "label" + + class TabsContainer(Container): type = "tabs" @@ -1042,6 +1046,8 @@ class XMLUI(object): - horizontal: elements are disposed left to right - pairs: elements come on two aligned columns (usually one for a label, the next for the element) + - label: associations of one LabelWidget or EmptyWidget with an other widget + similar to pairs but specialized in LabelWidget, and not necessarily arranged in 2 columns - tabs: elemens are in categories with tabs (notebook) @param dialog_opt: only used if panel_type == C.XMLUI_DIALOG. Dictionnary (string/string) where key can be: - C.XMLUI_DATA_TYPE: type of dialog, value can be: