From 3a7f1f584ad49d72b1fae6617ffa5d7aa9147d7c Mon Sep 17 00:00:00 2001 From: Dawn Date: Mon, 10 Aug 2026 09:44:53 +0200 Subject: [PATCH] fix: heal poisoned all-docks-hidden layout and restore layout before watch-only close A window state saved during the watch-only fold restores as every dock hidden (the vanished-Sample-List-on-restart bug). Fall back to the default layout when a restore comes back all-hidden, and put the pre-watch layout back before saving state in closeEvent. Co-Authored-By: Claude Fable 5 --- src/aare/gui/main_window.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/aare/gui/main_window.py b/src/aare/gui/main_window.py index 1af75820..faead5d3 100644 --- a/src/aare/gui/main_window.py +++ b/src/aare/gui/main_window.py @@ -2795,6 +2795,14 @@ class MainWindow(QMainWindow): def _restore_window_state(self) -> None: # TODO put all setting related handlign into state_manager self.state_manager.restore_window(self) + # Heal a poisoned layout: a state saved while watch-only mode had + # everything folded away comes back as "every dock hidden" — a user + # hides docks selectively, only the watch-mode fold hides ALL of + # them. Fall back to the default layout instead of resurrecting it + # (the vanished-Sample-List-on-restart bug). + docks = self.findChildren(QDockWidget) + if docks and all(d.isHidden() for d in docks) and self._default_window_state is not None: + self.restoreState(self._default_window_state) self._restore_panel_visibility_settings() def showEvent(self, event): @@ -2825,6 +2833,10 @@ class MainWindow(QMainWindow): logger.warning(f"Failed to restore main view before close: {e}", exc_info=True) try: + # Closing while watch-only would persist the all-hidden fold and + # poison every future start — put the pre-watch layout back first. + if self._session_operations_enabled is False and self._pre_watch_dock_state is not None: + self.restoreState(self._pre_watch_dock_state) # TODO put all setting related handling into state_manager self.state_manager.save_window(self) self._save_samcam_overlay_settings()