mirror of
https://github.com/0O0o0oOoO00/Alas.git
synced 2026-05-14 07:39:25 +08:00
add: migrate one click to stop all running instance
This commit is contained in:
4
assets/gui/icon/stop.svg
Normal file
4
assets/gui/icon/stop.svg
Normal file
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="32px" height="32px" viewBox="0 0 32 32" version="1.1">
|
||||
<path style="fill:none;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-miterlimit:4;" d="M 9.74943 9.750002 L 14.250563 14.250002 M 14.250563 9.750002 L 9.74943 14.250002 M 20.999286 12.000002 C 20.999286 16.971682 16.971486 21.000003 11.999997 21.000003 C 7.028508 21.000003 3.000708 16.971682 3.000708 12.000002 C 3.000708 7.028321 7.028508 3 11.999997 3 C 16.971486 3 20.999286 7.028321 20.999286 12.000002 Z M 20.999286 12.000002 " transform="matrix(1.31217,0,0,1.333333,0.253968,0)"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 717 B |
@@ -22,6 +22,7 @@ Button:
|
||||
ClickToUpdate:
|
||||
RetryUpdate:
|
||||
CancelUpdate:
|
||||
OneClickStop:
|
||||
|
||||
Toast:
|
||||
DisableTranslateMode:
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -3443,7 +3443,8 @@
|
||||
"CheckUpdate": "アップデータチェック",
|
||||
"ClickToUpdate": "アップデータ実行",
|
||||
"RetryUpdate": "アップデータ再試行",
|
||||
"CancelUpdate": "アップデータ中止"
|
||||
"CancelUpdate": "アップデータ中止",
|
||||
"OneClickStop": "Gui.Button.OneClickStop"
|
||||
},
|
||||
"Toast": {
|
||||
"DisableTranslateMode": "クリックして翻訳モードを中止します",
|
||||
|
||||
@@ -3443,7 +3443,8 @@
|
||||
"CheckUpdate": "检查更新",
|
||||
"ClickToUpdate": "进行更新",
|
||||
"RetryUpdate": "重试更新",
|
||||
"CancelUpdate": "取消更新"
|
||||
"CancelUpdate": "取消更新",
|
||||
"OneClickStop": "停止所有"
|
||||
},
|
||||
"Toast": {
|
||||
"DisableTranslateMode": "点击这里关闭翻译模式",
|
||||
|
||||
@@ -3443,7 +3443,8 @@
|
||||
"CheckUpdate": "檢查更新",
|
||||
"ClickToUpdate": "進行更新",
|
||||
"RetryUpdate": "重試更新",
|
||||
"CancelUpdate": "取消更新"
|
||||
"CancelUpdate": "取消更新",
|
||||
"OneClickStop": "Gui.Button.OneClickStop"
|
||||
},
|
||||
"Toast": {
|
||||
"DisableTranslateMode": "點擊這裡關閉翻譯模式",
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user