1
0
mirror of https://github.com/sui-feng-cb/AzurLaneAutoScript1.git synced 2026-07-23 14:07:05 +08:00

Feat: visualize instance running state in sidebar

This commit is contained in:
positnuec
2026-07-22 08:00:30 +08:00
parent 26f8f112f5
commit a64efd6134
4 changed files with 55 additions and 1 deletions

View File

@@ -128,6 +128,12 @@ class AlasGUI(Frame):
ALAS_ARGS: Dict[str, Dict[str, Dict[str, Dict[str, str]]]]
theme = "default"
_log = RichLog
# state 2 (inactive) is unmapped to keep default aside-icon color
ASIDE_ICON_STATE_CLASS = {
1: "aside-icon-run",
3: "aside-icon-warning",
4: "aside-icon-updating",
}
def initial(self) -> None:
self.ALAS_MENU = read_file(filepath_args("menu", self.alas_mod))
@@ -186,8 +192,16 @@ class AlasGUI(Frame):
def update(name, seq):
with use_scope(f"alas-instance-{seq}", clear=True):
icon_html = Icon.RUN
rendered_state = ProcessManager.get_manager(inst).state
# Inject state class for color and animation
state_class = self.ASIDE_ICON_STATE_CLASS.get(rendered_state, "")
icon_html = Icon.RUN
if state_class:
icon_html = icon_html.replace(
'class="aside-icon icon-run"',
f'class="aside-icon icon-run {state_class}"',
1,
)
if rendered_state == 1 and self.af_flag:
icon_html = icon_html[:31] + ' anim-rotate' + icon_html[31:]
put_icon_buttons(