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."""