added state change callback

This commit is contained in:
joBr99
2022-03-25 00:26:43 +01:00
parent a3afa30fdb
commit 8097935c8d
2 changed files with 36 additions and 14 deletions

View File

@@ -62,7 +62,17 @@ class PageNode(object):
items.append(i.data)
return items
def get_all_items_recursive(self):
items = []
for i in self.childs:
if len(i.childs) > 0:
items.extend(i.get_all_items_recursive())
else:
if type(i.data) is dict:
items.append(i.data.get("item", next(iter(i.data))))
else:
items.append(i.data)
return items
class LuiBackendConfig(object):
@@ -122,9 +132,3 @@ class LuiBackendConfig(object):
def get_root_page(self):
return self._page_config
def get_child_by_heading(self, heading):
for page in self._current_page.childs:
if heading == page.data["heading"]:
self._current_page = page
return self._current_page