frotends(xmlui): fixed _xmlui_for_name attribute for labels
This commit is contained in:
parent
3629bb5c03
commit
04c3f59571
1 changed files with 7 additions and 7 deletions
|
|
@ -27,6 +27,7 @@ from sat.core.exceptions import DataError
|
|||
class_map = {}
|
||||
CLASS_PANEL = 'panel'
|
||||
CLASS_DIALOG = 'dialog'
|
||||
CURRENT_LABEL = 'current_label'
|
||||
|
||||
class InvalidXMLUI(Exception):
|
||||
pass
|
||||
|
|
@ -396,7 +397,7 @@ class XMLUIPanel(XMLUIBase):
|
|||
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 @@ class XMLUIPanel(XMLUIBase):
|
|||
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 @@ class XMLUIPanel(XMLUIBase):
|
|||
|
||||
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)
|
||||
|
|
|
|||
Loading…
Reference in a new issue