diff --git a/src/nqrduck_broadband/controller.py b/src/nqrduck_broadband/controller.py index e02e019..c448fd7 100644 --- a/src/nqrduck_broadband/controller.py +++ b/src/nqrduck_broadband/controller.py @@ -1,26 +1,36 @@ -from PyQt5.QtCore import pyqtSlot +import logging +from PyQt5.QtCore import pyqtSlot, pyqtSignal from nqrduck.module.module_controller import ModuleController +logger = logging.getLogger(__name__) class BroadbandController(ModuleController): MIN_FREQUENCY = 30.0 MAX_FREQUENCY = 200.0 - def __init__(self, model): - super().__init__(model) + start_measurement = pyqtSignal() + + def __init__(self, module): + super().__init__(module) @pyqtSlot(str) def change_start_frequency(self, value): value = float(value) if value > self.MIN_FREQUENCY: - self._model.start_frequency = value + self._module._model.start_frequency = value else: - self._model.start_frequency = self.MIN_FREQUENCY + self._module._model.start_frequency = self.MIN_FREQUENCY @pyqtSlot(str) def change_stop_frequency(self, value): value = float(value) if value < self.MAX_FREQUENCY: - self._model.stop_frequency = value + self._module._model.stop_frequency = value else: - self._model.stop_frequency = self.MAX_FREQUENCY + self._module._model.stop_frequency = self.MAX_FREQUENCY + + @pyqtSlot() + def start_measurement_clicked(self): + logger.debug("Start measurement clicked") + self._module.nqrduck_signal.emit("start_measurement", "") + \ No newline at end of file diff --git a/src/nqrduck_broadband/view.py b/src/nqrduck_broadband/view.py index 0a1e060..ba27c15 100644 --- a/src/nqrduck_broadband/view.py +++ b/src/nqrduck_broadband/view.py @@ -1,5 +1,5 @@ import logging -from PyQt5.QtCore import pyqtSlot +from PyQt5.QtCore import QMetaMethod, pyqtSlot from PyQt5.QtWidgets import QWidget from nqrduck.module.module_view import ModuleView from .widget import Ui_Form @@ -17,6 +17,12 @@ class BroadbandView(ModuleView): self._ui_form.setupUi(self) self.widget = widget + self._connect_signals() + + + self.init_plots() + + def _connect_signals(self) -> None: self._ui_form.start_frequencyField.editingFinished.connect( lambda: self._module._controller.change_start_frequency( self._ui_form.start_frequencyField.text() @@ -30,8 +36,8 @@ class BroadbandView(ModuleView): self._module._model.start_frequency_changed.connect(self.on_start_frequency_change) self._module._model.stop_frequency_changed.connect(self.on_stop_frequency_change) - - self.init_plots() + + self._ui_form.start_measurementButton.clicked.connect(lambda: self._module._controller.start_measurement_clicked()) def init_plots(self): # Initialization of broadband spectrum