🐛 fix(gui): make UART unavailable notification persistent

- Add dedicated UART warning label that doesn't get overwritten
- _show_uart_notification now uses persistent label instead of status display
- Warning message stays visible throughout workflow execution
This commit is contained in:
Jeremy Shen
2026-06-10 10:06:50 +08:00
parent b222bd4586
commit fddcc3689a
+27 -3
View File
@@ -452,6 +452,19 @@ class MainWindow(ctk.CTk):
self._status = StatusDisplay(panel)
self._status.pack(fill="x", padx=PADDING, pady=PADDING)
# UART warning label (persistent, not overwritten by other status updates)
self._uart_warning_label = ctk.CTkLabel(
panel,
text="",
font=FONT_BODY,
anchor="w",
text_color=WARNING_COLOR,
)
self._uart_warning_label.pack(
fill="x", padx=PADDING, pady=(0, PADDING_SMALL)
)
self._uart_warning_label.pack_forget() # Hide by default
# ── Workflow Steps ─────────────────────────────────────────
def _log_message(self, message: str) -> None:
@@ -562,13 +575,24 @@ class MainWindow(ctk.CTk):
return True
def _show_uart_notification(self, reason: str) -> None:
"""Show a non-blocking UART unavailable notification in the status panel.
"""Show a persistent UART unavailable notification.
This notification stays visible and is not overwritten by other status updates.
Args:
reason: Why UART is unavailable.
"""
msg = f"UART 不可用 ({reason}),日志分析及检查将禁用"
self.after(0, lambda: self._status.set_status(msg, "warning"))
msg = f"UART 不可用 ({reason}),日志分析及检查将禁用"
self.after(0, lambda: self._show_uart_warning(msg))
def _show_uart_warning(self, msg: str) -> None:
"""Display the persistent UART warning message.
Args:
msg: Warning message to display.
"""
self._uart_warning_label.configure(text=msg)
self._uart_warning_label.pack(fill="x", padx=PADDING, pady=(0, PADDING_SMALL))
def _run_step_2_program_flash(self) -> bool:
"""Step 2: Program and verify Flash."""