🐛 fix: sub-step default expanded, real-time checkbox, startup freeze, color sync

1. SubStepFrame defaults to expanded (▼), not collapsed
2. erase_all checkbox has command=_on_erase_toggle → immediate config update
3. _deferred_init runs _check_vitis/_refresh_ports in background thread
   Fixes UI freeze during startup (subprocess.run for tool versions)
4. Sub-step colors now match StepHeader:
   - pending: gray ACCENT_PENDING (#888888)
   - running: blue CIRCLE_RUNNING (#0078D4) with pulse animation
   - complete: green ACCENT_COMPLETE (#107C10)
   - error: red ACCENT_ERROR (#D13438)
   - Running sub-step pulses between light/dark blue like StepHeader
This commit is contained in:
Jeremy Shen
2026-06-10 14:11:59 +08:00
parent 35bd6e600c
commit 699ad82834
3 changed files with 73 additions and 26 deletions
+11 -3
View File
@@ -97,9 +97,11 @@ class MainWindow(ctk.CTk):
self.after(100, self._deferred_init)
def _deferred_init(self) -> None:
"""Run blocking operations after the window is shown."""
self._check_vitis()
self._refresh_ports_initial()
"""Run blocking operations in background thread after window shown."""
def _bg_init():
self._check_vitis()
self._refresh_ports_initial()
threading.Thread(target=_bg_init, daemon=True).start()
# ── Config ─────────────────────────────────────────────────
@@ -212,6 +214,11 @@ class MainWindow(ctk.CTk):
self._log_message(f" ✗ Save failed: {e}")
self._status.set_status(f"Save failed: {e}", "error")
def _on_erase_toggle(self) -> None:
"""Update config.erase_all immediately when checkbox toggles."""
if self._config:
self._config.erase_all = self._erase_cb_var.get()
# ── UI Construction ────────────────────────────────────────
def _build_ui(self) -> None:
@@ -485,6 +492,7 @@ class MainWindow(ctk.CTk):
text="整片Flash擦除 (Erase entire flash)",
variable=self._erase_cb_var,
font=FONT_SMALL,
command=self._on_erase_toggle,
)
self._erase_cb.grid(row=0, column=0, sticky="w", padx=PADDING_SMALL)