From 2bbfcc7084bc6cb9021806c8bf0233d4b87b5a37 Mon Sep 17 00:00:00 2001 From: Jens Ahrensfeld Date: Mon, 25 May 2026 20:34:16 +0200 Subject: [PATCH] Scale plot tab to fill available window space at fullscreen Removed the QScrollArea wrapper and fixed figure-height calculation. FigureCanvasQTAgg now fills the tab with an Expanding size policy so all 8 subplots fit in the visible area at 1920x1200 without scrolling. Co-Authored-By: Claude Sonnet 4.6 --- gui_client.py | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/gui_client.py b/gui_client.py index ea2cd13..89aab0c 100644 --- a/gui_client.py +++ b/gui_client.py @@ -22,7 +22,7 @@ from PyQt5.QtCore import QObject, Qt, pyqtSignal from PyQt5.QtGui import QColor, QFont from PyQt5.QtWidgets import ( QApplication, QFormLayout, QGroupBox, QHBoxLayout, QLabel, - QLineEdit, QMainWindow, QPushButton, QScrollArea, QSizePolicy, + QLineEdit, QMainWindow, QPushButton, QSizePolicy, QSpinBox, QStatusBar, QTabWidget, QTreeWidget, QTreeWidgetItem, QVBoxLayout, QWidget, ) @@ -34,7 +34,6 @@ from matplotlib.figure import Figure MAX_PLOT_POINTS = 200 PLOT_COLS = 2 -PLOT_ROW_INCHES = 3.0 # ── TCP reader ──────────────────────────────────────────────────────────────── @@ -273,22 +272,13 @@ class DashboardTab(QWidget): class PlotTab(QWidget): def __init__(self): super().__init__() - outer = QVBoxLayout(self) - outer.setContentsMargins(0, 0, 0, 0) - - scroll = QScrollArea() - scroll.setWidgetResizable(True) - outer.addWidget(scroll) - - container = QWidget() - inner = QVBoxLayout(container) - inner.setContentsMargins(4, 4, 4, 4) - scroll.setWidget(container) + layout = QVBoxLayout(self) + layout.setContentsMargins(4, 4, 4, 4) self._fig = Figure(tight_layout=True) self._canvas = FigureCanvas(self._fig) self._canvas.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) - inner.addWidget(self._canvas) + layout.addWidget(self._canvas) self._series: dict[str, deque] = {} # path → deque[(datetime, float)] self._units: dict[str, str] = {} # path → unit string @@ -330,10 +320,6 @@ class PlotTab(QWidget): self._fig.clear() self._axes = {} - height = max(3.0, rows * PLOT_ROW_INCHES) - self._fig.set_size_inches(10, height) - self._canvas.setMinimumHeight(int(height * self._fig.dpi)) - for i, k in enumerate(keys): ax = self._fig.add_subplot(rows, cols, i + 1) label = k.split(".")[-1]