Mercurial > libervia-backend
comparison 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 |
comparison
equal
deleted
inserted
replaced
2396:66baa687c682 | 2397:7fff98d64ab5 |
---|---|
491 elif type_ == "int": | 491 elif type_ == "int": |
492 ctrl = self.widget_factory.createIntWidget(_xmlui_parent, value, self._isAttrSet("read_only", node)) | 492 ctrl = self.widget_factory.createIntWidget(_xmlui_parent, value, self._isAttrSet("read_only", node)) |
493 self.ctrl_list[name] = ({'type':type_, 'control':ctrl}) | 493 self.ctrl_list[name] = ({'type':type_, 'control':ctrl}) |
494 elif type_ == "list": | 494 elif type_ == "list": |
495 style = [] if node.getAttribute("multi") == 'yes' else ['single'] | 495 style = [] if node.getAttribute("multi") == 'yes' else ['single'] |
496 for attr in (u'noselect', u'extensible', u'reducible', u'inline'): | |
497 if node.getAttribute(attr) == 'yes': | |
498 style.append(attr) | |
496 _options = [(option.getAttribute("value"), option.getAttribute("label")) for option in node.getElementsByTagName("option")] | 499 _options = [(option.getAttribute("value"), option.getAttribute("label")) for option in node.getElementsByTagName("option")] |
497 _selected = [option.getAttribute("value") for option in node.getElementsByTagName("option") if option.getAttribute('selected') == C.BOOL_TRUE] | 500 _selected = [option.getAttribute("value") for option in node.getElementsByTagName("option") if option.getAttribute('selected') == C.BOOL_TRUE] |
498 ctrl = self.widget_factory.createListWidget(_xmlui_parent, _options, _selected, style) | 501 ctrl = self.widget_factory.createListWidget(_xmlui_parent, _options, _selected, style) |
499 self.ctrl_list[name] = ({'type': type_, 'control': ctrl}) | 502 self.ctrl_list[name] = ({'type': type_, 'control': ctrl}) |
500 elif type_ == "jids_list": | 503 elif type_ == "jids_list": |