diff frontends/src/tools/xmlui.py @ 2397:7fff98d64ab5

core (XMLUI), template(XMLUI): added flags to ListWidget: following flags have been added: - noselect: list selection is not allowed (options are the important data) - extensible: user can add elements to the list - reducible: user can remove elements from the list - inline: presentation hint: the list should be displayed horizontally
author Goffi <goffi@goffi.org>
date Fri, 27 Oct 2017 18:03:35 +0200
parents a59f2abd970e
children 8b37a62336c3
line wrap: on
line diff
--- a/frontends/src/tools/xmlui.py	Fri Oct 27 17:58:05 2017 +0200
+++ b/frontends/src/tools/xmlui.py	Fri Oct 27 18:03:35 2017 +0200
@@ -493,6 +493,9 @@
                     self.ctrl_list[name] = ({'type':type_, 'control':ctrl})
                 elif type_ == "list":
                     style = [] if node.getAttribute("multi") == 'yes' else ['single']
+                    for attr in (u'noselect', u'extensible', u'reducible', u'inline'):
+                        if node.getAttribute(attr) == 'yes':
+                            style.append(attr)
                     _options = [(option.getAttribute("value"), option.getAttribute("label")) for option in node.getElementsByTagName("option")]
                     _selected = [option.getAttribute("value") for option in node.getElementsByTagName("option") if option.getAttribute('selected') == C.BOOL_TRUE]
                     ctrl = self.widget_factory.createListWidget(_xmlui_parent, _options, _selected, style)