diff --git a/pytec/tec_qt.py b/pytec/tec_qt.py index 05913bc..16f6b7d 100644 --- a/pytec/tec_qt.py +++ b/pytec/tec_qt.py @@ -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})