1
0
mirror of https://github.com/0O0o0oOoO00/Alas.git synced 2026-05-14 13:59:24 +08:00

fix: try to add alas instance itself to watcher when start

This commit is contained in:
0O0o0oOoO00
2025-09-15 17:31:15 +08:00
parent 394ac8bd04
commit 5e4e00eacb
2 changed files with 15 additions and 13 deletions

View File

@@ -1557,17 +1557,6 @@ def timedelta_to_text(delta=None):
class AlasGUI(AlasGUI):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.instance_watcher = InstanceWatcher.get_instance()
def on_start_on(self):
self.instance_watcher.remove_instance(self.alas.config_name)
self.alas.stop()
def on_start_off(self):
self.alas.start(None, updater.event)
self.instance_watcher.try_add_instance(self.alas.config_name)
@use_scope("content", clear=True)
def alas_overview(self) -> None:
@@ -1614,8 +1603,8 @@ class AlasGUI(AlasGUI):
switch_scheduler = BinarySwitchButton(
label_on=t("Gui.Button.Stop"),
label_off=t("Gui.Button.Start"),
onclick_on=self.on_start_on,
onclick_off=self.on_start_off,
onclick_on=lambda: self.alas.stop(),
onclick_off=lambda: self.alas.start(None, updater.event),
get_state=lambda: self.alas.alive,
color_on="off",
color_off="on",