mirror of
https://github.com/0O0o0oOoO00/Alas.git
synced 2026-05-14 12:49:25 +08:00
fix: try to add alas instance itself to watcher when start
This commit is contained in:
@@ -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",
|
||||
|
||||
@@ -231,3 +231,16 @@ class ProcessManager:
|
||||
except:
|
||||
pass
|
||||
logger.info("Start alas complete")
|
||||
|
||||
|
||||
from module.instance_watcher import InstanceWatcher
|
||||
|
||||
|
||||
class ProcessManager(ProcessManager):
|
||||
def start(self, *args, **kwargs):
|
||||
super().start(*args, **kwargs)
|
||||
InstanceWatcher.get_instance().try_add_instance(self.config_name)
|
||||
|
||||
def stop(self, *args, **kwargs):
|
||||
InstanceWatcher.get_instance().remove_instance(self.config_name)
|
||||
super().stop(*args, **kwargs)
|
||||
|
||||
Reference in New Issue
Block a user