1
0
mirror of https://github.com/sui-feng-cb/AzurLaneAutoScript1.git synced 2026-08-18 12:43:00 +08:00

Fix: init state_switch before show() in webui

On session loss the page reloads, the sidebar becomes clickable while run() is still initializing, and a click in between raises AttributeError on missing state_switch.
This commit is contained in:
positnuec
2026-08-15 22:48:24 +08:00
parent 1041f44262
commit 2d2db92c3c

View File

@@ -1394,6 +1394,14 @@ class AlasGUI(Frame):
"""
)
# Init state switch before rendering, `ui_alas()` and `ui_develop()` may be
# triggered as soon as the sidebar is visible, while `run()` is still initializing
self.state_switch = Switch(
status=self.set_status,
get_state=lambda: getattr(getattr(self, "alas", -1), "state", 0),
name="state",
)
aside = get_localstorage("aside")
self.show()
@@ -1423,12 +1431,6 @@ class AlasGUI(Frame):
name="visibility_state",
)
self.state_switch = Switch(
status=self.set_status,
get_state=lambda: getattr(getattr(self, "alas", -1), "state", 0),
name="state",
)
def goto_update():
self.ui_develop()
self.dev_update()