diff --git a/assets/gui/icon/stop.svg b/assets/gui/icon/stop.svg new file mode 100644 index 000000000..41bc76fe5 --- /dev/null +++ b/assets/gui/icon/stop.svg @@ -0,0 +1,4 @@ + + + + diff --git a/module/config/argument/gui.yaml b/module/config/argument/gui.yaml index d6c36792a..c07e76697 100644 --- a/module/config/argument/gui.yaml +++ b/module/config/argument/gui.yaml @@ -22,6 +22,7 @@ Button: ClickToUpdate: RetryUpdate: CancelUpdate: + OneClickStop: Toast: DisableTranslateMode: diff --git a/module/config/i18n/en-US.json b/module/config/i18n/en-US.json index d25e8876b..14de4e3bc 100644 --- a/module/config/i18n/en-US.json +++ b/module/config/i18n/en-US.json @@ -3443,7 +3443,8 @@ "CheckUpdate": "Check update", "ClickToUpdate": "Click to update", "RetryUpdate": "Retry update", - "CancelUpdate": "Cancel update" + "CancelUpdate": "Cancel update", + "OneClickStop": "Gui.Button.OneClickStop" }, "Toast": { "DisableTranslateMode": "Click here to disable translate mode", diff --git a/module/config/i18n/ja-JP.json b/module/config/i18n/ja-JP.json index 61f78e31e..582df5df2 100644 --- a/module/config/i18n/ja-JP.json +++ b/module/config/i18n/ja-JP.json @@ -3443,7 +3443,8 @@ "CheckUpdate": "アップデータチェック", "ClickToUpdate": "アップデータ実行", "RetryUpdate": "アップデータ再試行", - "CancelUpdate": "アップデータ中止" + "CancelUpdate": "アップデータ中止", + "OneClickStop": "Gui.Button.OneClickStop" }, "Toast": { "DisableTranslateMode": "クリックして翻訳モードを中止します", diff --git a/module/config/i18n/zh-CN.json b/module/config/i18n/zh-CN.json index c7155c546..5ee684966 100644 --- a/module/config/i18n/zh-CN.json +++ b/module/config/i18n/zh-CN.json @@ -3443,7 +3443,8 @@ "CheckUpdate": "检查更新", "ClickToUpdate": "进行更新", "RetryUpdate": "重试更新", - "CancelUpdate": "取消更新" + "CancelUpdate": "取消更新", + "OneClickStop": "停止所有" }, "Toast": { "DisableTranslateMode": "点击这里关闭翻译模式", diff --git a/module/config/i18n/zh-TW.json b/module/config/i18n/zh-TW.json index f6fff9d10..792b37960 100644 --- a/module/config/i18n/zh-TW.json +++ b/module/config/i18n/zh-TW.json @@ -3443,7 +3443,8 @@ "CheckUpdate": "檢查更新", "ClickToUpdate": "進行更新", "RetryUpdate": "重試更新", - "CancelUpdate": "取消更新" + "CancelUpdate": "取消更新", + "OneClickStop": "Gui.Button.OneClickStop" }, "Toast": { "DisableTranslateMode": "點擊這裡關閉翻譯模式", diff --git a/module/webui/app.py b/module/webui/app.py index d805a442a..ab983340e 100644 --- a/module/webui/app.py +++ b/module/webui/app.py @@ -1557,6 +1557,35 @@ def timedelta_to_text(delta=None): class AlasGUI(AlasGUI): + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + + if self.theme == "dark": + add_css(filepath_css("dark-alas")) + self.icon_rgb = 'rgb(85%,85%,85%)' + else: + add_css(filepath_css("light-alas")) + self.icon_rgb = 'rgb(10%,10%,10%)' + + def stop_all_running_alas(self): + running = ProcessManager.running_instances() + for i in running: + i.stop() + + @use_scope("aside") + def set_aside(self) -> None: + super().set_aside() + put_icon_buttons( + Icon.STOP, + buttons=[ + { + "label": t("Gui.Button.OneClickStop"), + "value": "OneClickStop", + "color": "aside", + } + ], + onclick=[self.stop_all_running_alas], + ).style(f'stroke:{self.icon_rgb}') @use_scope("content", clear=True) def alas_overview(self) -> None: diff --git a/module/webui/utils.py b/module/webui/utils.py index 579949012..18d0aa836 100644 --- a/module/webui/utils.py +++ b/module/webui/utils.py @@ -587,6 +587,10 @@ def time_delta(_timedelta): return _time_dict +class Icon(Icon): + STOP = _read(filepath_icon("stop")) + + if __name__ == "__main__": def gen(x):