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:
parent
55a5b603fd
commit
3ccb4c1038
1 changed files with 33 additions and 5 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in a new issue