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 <noreply@anthropic.com>
This commit is contained in:
+3
-1
@@ -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:
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user