mirror of
https://github.com/nqrduck/nqrduck-broadband.git
synced 2025-01-03 13:18:10 +00:00
Implemented dispatcher
This commit is contained in:
parent
5b51cfcdb9
commit
1b8a72615d
2 changed files with 26 additions and 10 deletions
|
@ -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", "")
|
||||
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue