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
This commit is contained in:
Goffi 2017-10-27 18:03:35 +02:00
commit 3ccb4c1038

View file

@ -493,6 +493,9 @@ class XMLUIPanel(XMLUIBase):
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)