mirror of
https://github.com/nqrduck/nqrduck-measurement.git
synced 2024-12-22 15:47:51 +00:00
Multiple measurements can now be displayed.
This commit is contained in:
parent
3e516e0435
commit
490ed1356f
3 changed files with 21 additions and 0 deletions
|
@ -230,3 +230,14 @@ class MeasurementController(ModuleController):
|
|||
|
||||
self.module.model.displayed_measurement = apodized_measurement
|
||||
self.module.model.add_measurement(apodized_measurement)
|
||||
|
||||
@pyqtSlot()
|
||||
def change_displayed_measurement(self) -> None:
|
||||
"""Change the displayed measurement."""
|
||||
logger.debug("Changing displayed measurement.")
|
||||
if not self.module.model.measurements:
|
||||
logger.debug("No measurements to display.")
|
||||
return
|
||||
|
||||
index = self.module.view._ui_form.selectionBox.value()
|
||||
self.module.model.displayed_measurement = self.module.model.measurements[index]
|
||||
|
|
|
@ -94,6 +94,11 @@ class MeasurementModel(ModuleModel):
|
|||
def add_measurement(self, measurement: Measurement):
|
||||
"""Add a measurement to the list of measurements."""
|
||||
self.measurements.append(measurement)
|
||||
# Change the maximum value of the selectionBox.
|
||||
self.module.view._ui_form.selectionBox.setMaximum(len(self.measurements)-1)
|
||||
# Set the correct value of the selectionBox.
|
||||
self.module.view._ui_form.selectionBox.setValue(len(self.measurements)-1)
|
||||
|
||||
self.measurements_changed.emit(self.measurements)
|
||||
|
||||
@property
|
||||
|
|
|
@ -105,6 +105,11 @@ class MeasurementView(ModuleView):
|
|||
self._ui_form.averagesEdit.set_min_value(1)
|
||||
self._ui_form.averagesEdit.set_max_value(1e6)
|
||||
|
||||
# Connect selectionBox signal fors switching the displayed measurement
|
||||
self._ui_form.selectionBox.valueChanged.connect(
|
||||
self.module.controller.change_displayed_measurement
|
||||
)
|
||||
|
||||
def init_plotter(self) -> None:
|
||||
"""Initialize plotter with the according units for time domain."""
|
||||
plotter = self._ui_form.plotter
|
||||
|
|
Loading…
Reference in a new issue