From fddcc3689a51e303687cb70b596995397148ee60 Mon Sep 17 00:00:00 2001 From: Jeremy Shen Date: Wed, 10 Jun 2026 10:06:50 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(gui):=20make=20UART=20unavai?= =?UTF-8?q?lable=20notification=20persistent?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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 --- src/gui/main_window.py | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/src/gui/main_window.py b/src/gui/main_window.py index e1db703..32e2e21 100644 --- a/src/gui/main_window.py +++ b/src/gui/main_window.py @@ -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."""