thermostat/pytec/gui/view/plot_options_menu.py

22 lines
696 B
Python
Raw Normal View History

from PyQt6 import QtWidgets, QtGui
2024-06-20 17:08:07 +08:00
class PlotOptionsMenu(QtWidgets.QMenu):
def __init__(self, max_samples=1000):
super().__init__()
self.setTitle("Plot Settings")
clear = QtGui.QAction("Clear graphs", self)
self.addAction(clear)
self.clear = clear
self.samples_spinbox = QtWidgets.QSpinBox()
self.samples_spinbox.setRange(2, 100000)
self.samples_spinbox.setSuffix(" samples")
self.samples_spinbox.setValue(max_samples)
limit_samples = QtWidgets.QWidgetAction(self)
limit_samples.setDefaultWidget(self.samples_spinbox)
self.addAction(limit_samples)
self.limit_samples = limit_samples