renamed widget_mapping to _parent_widget_by_entity_id

This commit is contained in:
iLLiCiTiT 2021-02-24 11:24:14 +01:00
parent 3ab0ac66a8
commit bcde1896c9

View file

@ -37,7 +37,7 @@ class DictImmutableKeysWidget(BaseWidget):
self.entity.checkbox_key
)
self.widget_mapping = {}
self._parent_widget_by_entity_id = {}
self._added_wrapper_ids = set()
self._prepare_entity_layouts(
self.entity.gui_layout, self.content_widget
@ -56,7 +56,7 @@ class DictImmutableKeysWidget(BaseWidget):
for child in children:
if not isinstance(child, dict):
if child is not self.checkbox_child:
self.widget_mapping[child.id] = widget
self._parent_widget_by_entity_id[child.id] = widget
continue
if child["type"] == "collapsible-wrap":
@ -70,7 +70,8 @@ class DictImmutableKeysWidget(BaseWidget):
"Unknown Wrapper type \"{}\"".format(child["type"])
)
self.widget_mapping[wrapper.id] = widget
self._parent_widget_by_entity_id[wrapper.id] = widget
self._prepare_entity_layouts(child["children"], wrapper)
def _ui_item_without_label(self):
@ -146,7 +147,7 @@ class DictImmutableKeysWidget(BaseWidget):
else:
map_id = widget.entity.id
wrapper = self.widget_mapping[map_id]
wrapper = self._parent_widget_by_entity_id[map_id]
if wrapper is not self.content_widget:
wrapper.add_widget_to_layout(widget, label)
if wrapper.id not in self._added_wrapper_ids: