GUI: Thermostat Control Panel #147
25
pythermostat/pythermostat/gui/view/plot_options_menu.py
Normal file
25
pythermostat/pythermostat/gui/view/plot_options_menu.py
Normal file
@ -0,0 +1,25 @@
|
||||
from PyQt6 import QtWidgets, QtGui
|
||||
|
||||
|
||||
class PlotOptionsMenu(QtWidgets.QMenu):
|
||||
def __init__(self, channel_graphs, max_samples=1000):
|
||||
super().__init__()
|
||||
self.channel_graphs = channel_graphs
|
||||
|
||||
self.setTitle("Plot Settings")
|
||||
|
||||
clear = QtGui.QAction("Clear graphs", self)
|
||||
self.addAction(clear)
|
||||
self.clear = clear
|
||||
self.clear.triggered.connect(self.channel_graphs.clear_graphs)
|
||||
|
||||
self.samples_spinbox = QtWidgets.QSpinBox()
|
||||
self.samples_spinbox.setRange(2, 100000)
|
||||
self.samples_spinbox.setSuffix(" samples")
|
||||
self.samples_spinbox.setValue(max_samples)
|
||||
self.samples_spinbox.valueChanged.connect(self.channel_graphs.set_max_samples)
|
||||
|
||||
limit_samples = QtWidgets.QWidgetAction(self)
|
||||
limit_samples.setDefaultWidget(self.samples_spinbox)
|
||||
self.addAction(limit_samples)
|
||||
self.limit_samples = limit_samples
|
||||
|
@ -14,6 +14,7 @@ from pythermostat.gui.model.pid_autotuner import PIDAutoTuner
|
||||
from pythermostat.gui.view.connection_details_menu import ConnectionDetailsMenu
|
||||
from pythermostat.gui.view.info_box import InfoBox
|
||||
from pythermostat.gui.view.live_plot_view import LiveDataPlotter
|
||||
from pythermostat.gui.view.plot_options_menu import PlotOptionsMenu
|
||||
from pythermostat.gui.view.thermostat_settings_menu import ThermostatSettingsMenu
|
||||
from pythermostat.gui.view.zero_limits_warning_view import ZeroLimitsWarningView
|
||||
|
||||
@ -99,6 +100,9 @@ class MainWindow(QtWidgets.QMainWindow):
|
||||
)
|
||||
self.thermostat_settings.setMenu(self._thermostat_settings_menu)
|
||||
|
||||
self._plot_options_menu = PlotOptionsMenu(self._channel_graphs)
|
||||
self.plot_settings.setMenu(self._plot_options_menu)
|
||||
|
||||
# Status line
|
||||
self._zero_limits_warning_view = ZeroLimitsWarningView(
|
||||
self._thermostat, self.style(), self.limits_warning
|
||||
|
Loading…
Reference in New Issue
Block a user
Not sure if one menu per file is the right thing to do.