diff --git a/src/gui_2.py b/src/gui_2.py index 360c2b1e..d4698f6a 100644 --- a/src/gui_2.py +++ b/src/gui_2.py @@ -500,6 +500,42 @@ class App: try: self.controller.on_warmup_complete(lambda status: _on_warmup_complete_callback(self, status)) except Exception: pass + self._diag_layout_state() + + def _diag_layout_state(self) -> None: + """ + One-shot startup diagnostic: log show_windows state and warn if the + on-disk manualslop_layout.ini references window names that no longer + exist in the current code. Helps users and test operators detect + stale layout state at a glance instead of debugging missing panels. + [C: src/gui_2.py:App._post_init] + """ + import os as _os + visible_by_default = [w for w, v in self.show_windows.items() if v] + sys.stderr.write(f"[GUI] show_windows entries: {len(self.show_windows)}, visible by default: {len(visible_by_default)}\n") + if visible_by_default: + sys.stderr.write(f"[GUI] visible-by-default windows: {', '.join(sorted(visible_by_default))}\n") + ini_path = _os.path.join(_os.getcwd(), "manualslop_layout.ini") + if not _os.path.exists(ini_path): + sys.stderr.write(f"[GUI] no layout file at {ini_path} (HelloImGui will create a fresh one on shutdown)\n") + return + ini_size = _os.path.getsize(ini_path) + sys.stderr.write(f"[GUI] layout file: {ini_path} ({ini_size} bytes)\n") + try: + with open(ini_path, encoding="utf-8") as _f: + _ini_text = _f.read() + except Exception as _e: + sys.stderr.write(f"[GUI] could not read layout file: {_e}\n") + return + _STALE_WINDOW_NAMES = { + "Projects", "Files", "Screenshots", "Discussion History", + "Provider", "Message", "Response", "Tool Calls", + "Comms History", "System Prompts", "Theme", + } + _stale_found = [n for n in _STALE_WINDOW_NAMES if f"[Window][{n}]" in _ini_text] + if _stale_found: + sys.stderr.write(f"[GUI] WARNING: layout has {len(_stale_found)} stale window name(s) that no longer exist: {', '.join(_stale_found)}\n") + sys.stderr.write(f"[GUI] Run the 'Reset Layout' command from the Command Palette (or delete {ini_path}) to regenerate.\n") def _trigger_hot_reload(self) -> bool: from src.hot_reloader import HotReloader