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 <noreply@anthropic.com>
This commit is contained in:
2026-08-11 10:35:55 +02:00
co-authored by Claude Fable 5
parent 3db8b11dd1
commit 3a7f1f584a
+12
View File
@@ -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()