Add samples box in menu

This commit is contained in:
atse 2023-07-20 15:54:28 +08:00
parent 001ce432e8
commit 5c081b0547
1 changed files with 18 additions and 0 deletions

View File

@ -203,6 +203,24 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
self.menu.addAction(clear)
self.menu.clear = clear
self.samples_spinbox = QtWidgets.QSpinBox()
self.samples_spinbox.setRange(2, 100000)
self.samples_spinbox.setSuffix(' samples')
self.samples_spinbox.setValue(self.max_samples)
self.samples_spinbox.valueChanged.connect(self.set_max_samples)
limit_samples = QtWidgets.QWidgetAction(self.menu)
limit_samples.setDefaultWidget(self.samples_spinbox)
self.menu.addAction(limit_samples)
self.menu.limit_samples = limit_samples
@pyqtSlot(int)
def set_max_samples(self, samples: int):
self.ch0_t_connector.max_points = samples
self.ch0_i_connector.max_points = samples
self.ch1_t_connector.max_points = samples
self.ch1_i_connector.max_points = samples
def _set_up_graphs(self):
for graph in self.ch0_t_graph, self.ch0_i_graph, self.ch1_t_graph, self.ch1_i_graph:
time_axis = LiveAxis('bottom', text="Time since Thermostat reset", **{Axis.TICK_FORMAT: Axis.DURATION})