Mercurial > libervia-backend
comparison frontends/src/tools/xmlui.py @ 1220:f91e7028e2c3
memory (params), tools (xml_tools), plugins, frontends: add "int" parameter type with "min" and "max" attributes
author | souliane <souliane@mailoo.org> |
---|---|
date | Fri, 03 Oct 2014 12:27:43 +0200 |
parents | 0a448c947038 |
children | e3a9ea76de35 |
comparison
equal
deleted
inserted
replaced
1219:16484ebb695b | 1220:f91e7028e2c3 |
---|---|
97 | 97 |
98 class BoolWidget(Widget): | 98 class BoolWidget(Widget): |
99 """Input widget with require a boolean value | 99 """Input widget with require a boolean value |
100 often called CheckBox in toolkits | 100 often called CheckBox in toolkits |
101 """ | 101 """ |
102 | |
103 | |
104 class IntWidget(Widget): | |
105 """Input widget with require an integer""" | |
102 | 106 |
103 | 107 |
104 class ButtonWidget(Widget): | 108 class ButtonWidget(Widget): |
105 """A clickable widget""" | 109 """A clickable widget""" |
106 | 110 |
386 ctrl = self.widget_factory.createTextBoxWidget(_xmlui_parent, value, self._isAttrSet("read_only", node)) | 390 ctrl = self.widget_factory.createTextBoxWidget(_xmlui_parent, value, self._isAttrSet("read_only", node)) |
387 self.ctrl_list[name] = ({'type':type_, 'control':ctrl}) | 391 self.ctrl_list[name] = ({'type':type_, 'control':ctrl}) |
388 elif type_=="bool": | 392 elif type_=="bool": |
389 ctrl = self.widget_factory.createBoolWidget(_xmlui_parent, value==C.BOOL_TRUE, self._isAttrSet("read_only", node)) | 393 ctrl = self.widget_factory.createBoolWidget(_xmlui_parent, value==C.BOOL_TRUE, self._isAttrSet("read_only", node)) |
390 self.ctrl_list[name] = ({'type':type_, 'control':ctrl}) | 394 self.ctrl_list[name] = ({'type':type_, 'control':ctrl}) |
395 elif type_ == "int": | |
396 ctrl = self.widget_factory.createIntWidget(_xmlui_parent, value, self._isAttrSet("read_only", node)) | |
397 self.ctrl_list[name] = ({'type':type_, 'control':ctrl}) | |
391 elif type_ == "list": | 398 elif type_ == "list": |
392 style = [] if node.getAttribute("multi") == 'yes' else ['single'] | 399 style = [] if node.getAttribute("multi") == 'yes' else ['single'] |
393 _options = [(option.getAttribute("value"), option.getAttribute("label")) for option in node.getElementsByTagName("option")] | 400 _options = [(option.getAttribute("value"), option.getAttribute("label")) for option in node.getElementsByTagName("option")] |
394 _selected = [option.getAttribute("value") for option in node.getElementsByTagName("option") if option.getAttribute('selected') == C.BOOL_TRUE] | 401 _selected = [option.getAttribute("value") for option in node.getElementsByTagName("option") if option.getAttribute('selected') == C.BOOL_TRUE] |
395 ctrl = self.widget_factory.createListWidget(_xmlui_parent, _options, _selected, style) | 402 ctrl = self.widget_factory.createListWidget(_xmlui_parent, _options, _selected, style) |