Mercurial > libervia-web
diff browser_side/xmlui.py @ 229:e632f77c4219
bridge: asyncGetParamA takes a security_limit argument
browser_side: added support for user param of type "list"
author | souliane <souliane@mailoo.org> |
---|---|
date | Tue, 08 Oct 2013 13:48:00 +0200 |
parents | 4e6467efd6bf |
children | fe83837d3491 |
line wrap: on
line diff
--- a/browser_side/xmlui.py Tue Oct 08 13:35:29 2013 +0200 +++ b/browser_side/xmlui.py Tue Oct 08 13:48:00 2013 +0200 @@ -119,6 +119,7 @@ ctrl.setMultipleSelect(elem.getAttribute("multi")=='yes') for option in elem.getElementsByTagName("option"): ctrl.addItem(option.getAttribute("value")) + ctrl.selectItem(value) self.ctrl_list[name] = ({'node_type':node_type, 'control':ctrl}) elif node_type=="button": callback_id = elem.getAttribute("callback_id") @@ -128,10 +129,12 @@ print("FIXME FIXME FIXME: type [%s] is not implemented" % node_type) #FIXME ! raise NotImplementedError if self.node_type == 'param': - if isinstance(ctrl,TextBoxBase): + if isinstance(ctrl, TextBoxBase): ctrl.addChangeListener(self.onParamChange) elif isinstance(ctrl, CheckBox): ctrl.addClickListener(self.onParamChange) + elif isinstance(ctrl, ListBox): + ctrl.addChangeListener(self.onParamChange) ctrl._param_category = self._current_category ctrl._param_name = name parent.append(ctrl) @@ -217,7 +220,7 @@ for field in fields: ctrl = self.ctrl_list[field] if isinstance(ctrl['control'],ListBox): - data[field] = '\t'.join(ctrl['control'].getSelectedValues()) + data[field] = '\t'.join(ctrl['control'].getSelectedItemText()) elif isinstance(ctrl['control'],CheckBox): data[field] = "true" if ctrl['control'].isChecked() else "false" else: @@ -240,7 +243,7 @@ for ctrl_name in self.ctrl_list: ctrl = self.ctrl_list[ctrl_name] if isinstance(ctrl['control'], ListBox): - data.append((ctrl_name, ctrl['control'].getValue())) + data.append((ctrl_name, '\t'.join(ctrl['control'].getSelectedItemText()))) elif isinstance(ctrl['control'], CheckBox): data.append((ctrl_name, "true" if ctrl['control'].isChecked() else "false")) else: @@ -262,6 +265,8 @@ for ctrl in self.param_changed: if isinstance(ctrl, CheckBox): value = "true" if ctrl.isChecked() else "false" + elif isinstance(ctrl, ListBox): + value = '\t'.join(ctrl.getSelectedItemText()) else: value = ctrl.getText() self.host.bridge.call('setParam', None, ctrl._param_name, value, ctrl._param_category)