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 <noreply@anthropic.com>
This commit is contained in:
+4
-18
@@ -22,7 +22,7 @@ from PyQt5.QtCore import QObject, Qt, pyqtSignal
|
|||||||
from PyQt5.QtGui import QColor, QFont
|
from PyQt5.QtGui import QColor, QFont
|
||||||
from PyQt5.QtWidgets import (
|
from PyQt5.QtWidgets import (
|
||||||
QApplication, QFormLayout, QGroupBox, QHBoxLayout, QLabel,
|
QApplication, QFormLayout, QGroupBox, QHBoxLayout, QLabel,
|
||||||
QLineEdit, QMainWindow, QPushButton, QScrollArea, QSizePolicy,
|
QLineEdit, QMainWindow, QPushButton, QSizePolicy,
|
||||||
QSpinBox, QStatusBar, QTabWidget, QTreeWidget, QTreeWidgetItem,
|
QSpinBox, QStatusBar, QTabWidget, QTreeWidget, QTreeWidgetItem,
|
||||||
QVBoxLayout, QWidget,
|
QVBoxLayout, QWidget,
|
||||||
)
|
)
|
||||||
@@ -34,7 +34,6 @@ from matplotlib.figure import Figure
|
|||||||
|
|
||||||
MAX_PLOT_POINTS = 200
|
MAX_PLOT_POINTS = 200
|
||||||
PLOT_COLS = 2
|
PLOT_COLS = 2
|
||||||
PLOT_ROW_INCHES = 3.0
|
|
||||||
|
|
||||||
|
|
||||||
# ── TCP reader ────────────────────────────────────────────────────────────────
|
# ── TCP reader ────────────────────────────────────────────────────────────────
|
||||||
@@ -273,22 +272,13 @@ class DashboardTab(QWidget):
|
|||||||
class PlotTab(QWidget):
|
class PlotTab(QWidget):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
outer = QVBoxLayout(self)
|
layout = QVBoxLayout(self)
|
||||||
outer.setContentsMargins(0, 0, 0, 0)
|
layout.setContentsMargins(4, 4, 4, 4)
|
||||||
|
|
||||||
scroll = QScrollArea()
|
|
||||||
scroll.setWidgetResizable(True)
|
|
||||||
outer.addWidget(scroll)
|
|
||||||
|
|
||||||
container = QWidget()
|
|
||||||
inner = QVBoxLayout(container)
|
|
||||||
inner.setContentsMargins(4, 4, 4, 4)
|
|
||||||
scroll.setWidget(container)
|
|
||||||
|
|
||||||
self._fig = Figure(tight_layout=True)
|
self._fig = Figure(tight_layout=True)
|
||||||
self._canvas = FigureCanvas(self._fig)
|
self._canvas = FigureCanvas(self._fig)
|
||||||
self._canvas.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
|
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._series: dict[str, deque] = {} # path → deque[(datetime, float)]
|
||||||
self._units: dict[str, str] = {} # path → unit string
|
self._units: dict[str, str] = {} # path → unit string
|
||||||
@@ -330,10 +320,6 @@ class PlotTab(QWidget):
|
|||||||
self._fig.clear()
|
self._fig.clear()
|
||||||
self._axes = {}
|
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):
|
for i, k in enumerate(keys):
|
||||||
ax = self._fig.add_subplot(rows, cols, i + 1)
|
ax = self._fig.add_subplot(rows, cols, i + 1)
|
||||||
label = k.split(".")[-1]
|
label = k.split(".")[-1]
|
||||||
|
|||||||
Reference in New Issue
Block a user