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":
|
||||
cont = self.widget_factory.createLabelContainer(_xmlui_parent)
|
||||
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}
|
||||
)
|
||||
elif type_ == "advanced_list":
|
||||
|
|
@ -541,8 +545,10 @@ class XMLUIPanel(XMLUIBase):
|
|||
):
|
||||
# current widget is ignored, but there may be already a label
|
||||
if CURRENT_LABEL in data:
|
||||
# if so, we remove it from parent
|
||||
_xmlui_parent._xmluiRemove(data.pop(CURRENT_LABEL))
|
||||
curr_label = data.pop(CURRENT_LABEL)
|
||||
if curr_label is not None:
|
||||
# if so, we remove it from parent
|
||||
_xmlui_parent._xmluiRemove(curr_label)
|
||||
continue
|
||||
type_ = node.getAttribute("type")
|
||||
value_elt = self._getChildNode(node, "value")
|
||||
|
|
@ -689,9 +695,11 @@ class XMLUIPanel(XMLUIBase):
|
|||
ctrl._xmlui_name = name
|
||||
_xmlui_parent._xmluiAppend(ctrl)
|
||||
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.pop(CURRENT_LABEL)._xmlui_for_name = name
|
||||
curr_label = data.pop(CURRENT_LABEL)
|
||||
if curr_label is not None:
|
||||
# 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:
|
||||
raise NotImplementedError(_("Unknown tag [%s]") % node.nodeName)
|
||||
|
|
|
|||
Loading…
Reference in a new issue