frontends (xmlui): fixed crash when CURRENT_LABEL is None:
fix 323
This commit is contained in:
parent
5e43c6c98c
commit
80be7cddb9
1 changed files with 13 additions and 5 deletions
|
|
@ -466,6 +466,10 @@ class XMLUIPanel(XMLUIBase):
|
||||||
elif type_ == "label":
|
elif type_ == "label":
|
||||||
cont = self.widget_factory.createLabelContainer(_xmlui_parent)
|
cont = self.widget_factory.createLabelContainer(_xmlui_parent)
|
||||||
self._parseChilds(
|
self._parseChilds(
|
||||||
|
# FIXME: the "None" value for CURRENT_LABEL doesn't seem
|
||||||
|
# used or even useful, it should probably be removed
|
||||||
|
# and all "is not None" tests for it should be removed too
|
||||||
|
# to be checked for 0.8
|
||||||
cont, node, ("widget", "container"), {CURRENT_LABEL: None}
|
cont, node, ("widget", "container"), {CURRENT_LABEL: None}
|
||||||
)
|
)
|
||||||
elif type_ == "advanced_list":
|
elif type_ == "advanced_list":
|
||||||
|
|
@ -541,8 +545,10 @@ class XMLUIPanel(XMLUIBase):
|
||||||
):
|
):
|
||||||
# current widget is ignored, but there may be already a label
|
# current widget is ignored, but there may be already a label
|
||||||
if CURRENT_LABEL in data:
|
if CURRENT_LABEL in data:
|
||||||
# if so, we remove it from parent
|
curr_label = data.pop(CURRENT_LABEL)
|
||||||
_xmlui_parent._xmluiRemove(data.pop(CURRENT_LABEL))
|
if curr_label is not None:
|
||||||
|
# if so, we remove it from parent
|
||||||
|
_xmlui_parent._xmluiRemove(curr_label)
|
||||||
continue
|
continue
|
||||||
type_ = node.getAttribute("type")
|
type_ = node.getAttribute("type")
|
||||||
value_elt = self._getChildNode(node, "value")
|
value_elt = self._getChildNode(node, "value")
|
||||||
|
|
@ -689,9 +695,11 @@ class XMLUIPanel(XMLUIBase):
|
||||||
ctrl._xmlui_name = name
|
ctrl._xmlui_name = name
|
||||||
_xmlui_parent._xmluiAppend(ctrl)
|
_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
|
curr_label = data.pop(CURRENT_LABEL)
|
||||||
# we can associate the label with the widget it is labelling
|
if curr_label is not None:
|
||||||
data.pop(CURRENT_LABEL)._xmlui_for_name = name
|
# this key is set in LabelContainer, when present
|
||||||
|
# we can associate the label with the widget it is labelling
|
||||||
|
curr_label._xmlui_for_name = name
|
||||||
|
|
||||||
else:
|
else:
|
||||||
raise NotImplementedError(_("Unknown tag [%s]") % node.nodeName)
|
raise NotImplementedError(_("Unknown tag [%s]") % node.nodeName)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue