From f4f3c5ec3d7d734dc34cf6c2c72d053deea4a200 Mon Sep 17 00:00:00 2001 From: Dawn Date: Thu, 6 Aug 2026 10:53:37 +0200 Subject: [PATCH] fix: adapt main window to monitor size instead of overflowing The window's minimum was 1400x1207 - taller than a 1920x1200 console - so the status bar was pushed off-screen on every monitor. Three causes: - the standard page's combined panel minimums: now wrapped in a QScrollArea so scrollbars appear instead of clamping the window - hidden portrait/compact stack pages inflating the QStackedWidget minimum (portrait alone demands 720px height): only the visible page contributes now - launching at the natural size hint (1577x1612): launch maximized so the window takes whatever the monitor offers Minimum drops to 1400x555; verified on a 1920x1200 X display that the status bar is visible and panels scroll when space runs out. Co-Authored-By: Claude Fable 5 --- src/aare/gui/gui.py | 4 +++- src/aare/gui/main_window.py | 35 ++++++++++++++++++++++++++++++++--- 2 files changed, 35 insertions(+), 4 deletions(-) diff --git a/src/aare/gui/gui.py b/src/aare/gui/gui.py index e5387451..93d9646c 100644 --- a/src/aare/gui/gui.py +++ b/src/aare/gui/gui.py @@ -189,7 +189,9 @@ def main(): splash.set_progress(100, "Ready") splash.finish(win) - win.show() + # Maximized so the window adapts to the monitor instead of its size hint, + # which is taller than a 1920x1200 console. + win.showMaximized() sys.exit(app.exec()) except Exception as e: diff --git a/src/aare/gui/main_window.py b/src/aare/gui/main_window.py index 061f11df..b076b018 100644 --- a/src/aare/gui/main_window.py +++ b/src/aare/gui/main_window.py @@ -18,9 +18,12 @@ from PySide6.QtCore import QEvent, QSettings, Qt, QTimer, Signal, Slot from PySide6.QtGui import QAction, QActionGroup, QGuiApplication, QKeySequence from PySide6.QtWidgets import ( QDockWidget, + QFrame, QHBoxLayout, QMainWindow, QMessageBox, + QScrollArea, + QSizePolicy, QStackedWidget, QTabWidget, QVBoxLayout, @@ -520,11 +523,37 @@ class MainWindow(QMainWindow): self.addDockWidget(Qt.DockWidgetArea.RightDockWidgetArea, self.prediction_metrics_dock) self.prediction_metrics_dock.hide() - self.content_stack.addWidget(top_widget) + # The standard page's combined panel minimum (~1400x1200) exceeds many + # monitors, which pushed the status bar off-screen. Scrolling instead of + # clamping lets the window shrink to any screen; scrollbars only appear + # when the monitor is actually smaller than the panels. + standard_page_scroll = QScrollArea(parent=root_widget) + standard_page_scroll.setWidgetResizable(True) + standard_page_scroll.setFrameShape(QFrame.Shape.NoFrame) + standard_page_scroll.setWidget(top_widget) + + self.content_stack.addWidget(standard_page_scroll) self.content_stack.addWidget(self.compact_automation_page) self.content_stack.addWidget(self.portrait_mode_page) - self.content_stack.setCurrentWidget(top_widget) - self._standard_main_page = top_widget + self.content_stack.setCurrentWidget(standard_page_scroll) + self._standard_main_page = standard_page_scroll + + # QStackedWidget's minimum size is the max over ALL pages, so the hidden + # portrait/compact pages inflated the window minimum past small monitors + # (portrait alone demands 720px height). Only the visible page should + # count — the mode-switch code resizes the window explicitly anyway. + def _only_current_page_counts(index: int) -> None: + for i in range(self.content_stack.count()): + page = self.content_stack.widget(i) + policy = ( + QSizePolicy.Policy.Preferred + if i == index + else QSizePolicy.Policy.Ignored + ) + page.setSizePolicy(policy, policy) + + self.content_stack.currentChanged.connect(_only_current_page_counts) + _only_current_page_counts(self.content_stack.currentIndex()) self.setCentralWidget(root_widget)