From 3a036d570a8f4abbb63738d9cd48f6c43fcbe1a4 Mon Sep 17 00:00:00 2001 From: jupfi Date: Thu, 7 Dec 2023 14:07:20 +0100 Subject: [PATCH] Receiving el. LUT data --- src/nqrduck_broadband/controller.py | 9 +++++++-- src/nqrduck_broadband/model.py | 10 ++++++++++ src/nqrduck_broadband/view.py | 9 +++++++++ 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/src/nqrduck_broadband/controller.py b/src/nqrduck_broadband/controller.py index 6d68543..c2e56e3 100644 --- a/src/nqrduck_broadband/controller.py +++ b/src/nqrduck_broadband/controller.py @@ -32,7 +32,13 @@ class BroadbandController(ModuleController): elif key == "failure_set_averages" and value == self.module.view._ui_form.averagesEdit.text(): logger.debug("Received set averages failure.") self.set_averages_failure.emit() - + # receive LUT data + elif key == "LUT_finished": + logger.debug("Received LUT data.") + self.module.model.LUT = value + self.change_start_frequency(self.module.model.LUT.start_frequency) + self.change_stop_frequency(self.module.model.LUT.stop_frequency) + self.change_frequency_step(self.module.model.LUT.frequency_step) @pyqtSlot(str) def set_frequency(self, value : str) -> None: @@ -80,7 +86,6 @@ class BroadbandController(ModuleController): def change_frequency_step(self, value :str) -> None: """Changes the frequency step of the measurement.""" try: - logger.debug("Changing frequency step to: " + value) value = float(value) * 1e6 if value > 0: self.module.model.frequency_step = value diff --git a/src/nqrduck_broadband/model.py b/src/nqrduck_broadband/model.py index 60aa5cd..cdec199 100644 --- a/src/nqrduck_broadband/model.py +++ b/src/nqrduck_broadband/model.py @@ -14,6 +14,7 @@ class BroadbandModel(ModuleModel): start_frequency_changed = pyqtSignal(float) stop_frequency_changed = pyqtSignal(float) + LUT_changed = pyqtSignal() def __init__(self, module) -> None: super().__init__(module) @@ -56,6 +57,15 @@ class BroadbandModel(ModuleModel): def current_broadband_measurement(self, value): self._current_broadband_measurement = value + @property + def LUT(self): + return self._LUT + + @LUT.setter + def LUT(self, value): + self._LUT = value + self.LUT_changed.emit() + class BroadbandMeasurement(QObject): """This class represents a single broadband measurement.""" diff --git a/src/nqrduck_broadband/view.py b/src/nqrduck_broadband/view.py index 2d6a750..dd2fce9 100644 --- a/src/nqrduck_broadband/view.py +++ b/src/nqrduck_broadband/view.py @@ -61,6 +61,9 @@ class BroadbandView(ModuleView): self.module.controller.set_averages_failure.connect(self.on_set_averages_failure) self.module.controller.set_frequency_step_failure.connect(self.on_set_frequency_step_failure) + # LUT data + self.module.model.LUT_changed.connect(self.on_LUT_changed) + @pyqtSlot() def start_measurement_clicked(self) -> None: """This method is called when the start measurement button is clicked. @@ -208,6 +211,12 @@ class BroadbandView(ModuleView): QApplication.processEvents() + @pyqtSlot() + def on_LUT_changed(self) -> None: + """This method is called when the LUT data is changed.""" + logger.debug("Updating LUT fields.") + # LUT type here + def add_info_text(self, text : str) -> None: """Add a text to the info box with a timestamp.