Mercurial > libervia-backend
changeset 2418:69f979adb1d7
frotends(xmlui): fixed _xmlui_for_name attribute for labels
author | Goffi <goffi@goffi.org> |
---|---|
date | Sun, 05 Nov 2017 13:44:07 +0100 |
parents | 192ae573901a |
children | c38c54c47e16 |
files | frontends/src/tools/xmlui.py |
diffstat | 1 files changed, 7 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/frontends/src/tools/xmlui.py Sat Nov 04 22:11:45 2017 +0100 +++ b/frontends/src/tools/xmlui.py Sun Nov 05 13:44:07 2017 +0100 @@ -27,6 +27,7 @@ class_map = {} CLASS_PANEL = 'panel' CLASS_DIALOG = 'dialog' +CURRENT_LABEL = 'current_label' class InvalidXMLUI(Exception): pass @@ -396,7 +397,7 @@ self._parseChilds(cont, node, ('widget', 'container')) elif type_ == "label": cont = self.widget_factory.createLabelContainer(_xmlui_parent) - self._parseChilds(cont, node, ('widget', 'container'), {'current_label': None}) + self._parseChilds(cont, node, ('widget', 'container'), {CURRENT_LABEL: None}) elif type_ == "advanced_list": try: columns = int(node.getAttribute('columns')) @@ -460,14 +461,13 @@ value = node.getAttribute("value") if node.hasAttribute('value') else u'' if type_=="empty": ctrl = self.widget_factory.createEmptyWidget(_xmlui_parent) - if 'current_label' in data: - data['current_label'] = None + if CURRENT_LABEL in data: + data[CURRENT_LABEL] = None elif type_=="text": ctrl = self.widget_factory.createTextWidget(_xmlui_parent, value) elif type_=="label": ctrl = self.widget_factory.createLabelWidget(_xmlui_parent, value) - if 'current_label' in data: - data['current_label'] = ctrl + data[CURRENT_LABEL] = ctrl elif type_=="jid": ctrl = self.widget_factory.createJidWidget(_xmlui_parent, value) elif type_=="divider": @@ -537,10 +537,10 @@ ctrl._xmlui_name = name _xmlui_parent._xmluiAppend(ctrl) - if 'current_label' in data and not isinstance(ctrl, LabelWidget): + if CURRENT_LABEL in data and not isinstance(ctrl, LabelWidget): # this key is set in LabelContainer, when present # we can associate the label with the widget it is labelling - data['current_label']._xmlui_for_name = name + data.pop(CURRENT_LABEL)._xmlui_for_name = name else: raise NotImplementedError(_('Unknown tag [%s]') % node.nodeName)