Adjusted structure.

This commit is contained in:
jupfi 2023-07-01 16:12:05 +02:00
parent 603df6186c
commit 66529866c3
4 changed files with 41 additions and 44 deletions

View file

@ -1,3 +1 @@
from .broadband import Broadband as Model
from .broadband_controller import BroadbandController as Controller
from .broadband_view import BroadbandView as View
from .broadband import Broadband as Module

View file

@ -1,35 +1,8 @@
from PyQt5.QtCore import pyqtSignal, QObject
from nqrduck.module.module_model import ModuleModel
from nqrduck.module.module import Module
from nqrduck_broadband.broadband_model import BroadbandModel
from nqrduck_broadband.broadband_view import BroadbandView
from nqrduck_broadband.broadband_controller import BroadbandController
from nqrduck_broadband.broadband_widget import Ui_Form
class Broadband(ModuleModel):
start_frequency_changed = pyqtSignal(float)
stop_frequency_changed = pyqtSignal(float)
widget_changed = pyqtSignal(QObject)
@property
def start_frequency(self):
return self._start_frequency
@start_frequency.setter
def start_frequency(self, value):
self._start_frequency = value
self.start_frequency_changed.emit(value)
@property
def stop_frequency(self):
return self._stop_frequency
@stop_frequency.setter
def stop_frequency(self, value):
self._stop_frequency = value
self.stop_frequency_changed.emit(value)
@property
def widget(self):
return self._widget
@widget.setter
def widget(self, value):
self._widget = value
self.widget_changed.emit(value)
Broadband = Module(BroadbandModel, BroadbandController, BroadbandView)

View file

@ -0,0 +1,25 @@
from PyQt5.QtCore import pyqtSignal
from nqrduck.module.module_model import ModuleModel
class BroadbandModel(ModuleModel):
start_frequency_changed = pyqtSignal(float)
stop_frequency_changed = pyqtSignal(float)
@property
def start_frequency(self):
return self._start_frequency
@start_frequency.setter
def start_frequency(self, value):
self._start_frequency = value
self.start_frequency_changed.emit(value)
@property
def stop_frequency(self):
return self._stop_frequency
@stop_frequency.setter
def stop_frequency(self, value):
self._stop_frequency = value
self.stop_frequency_changed.emit(value)

View file

@ -8,27 +8,28 @@ logger = logging.getLogger(__name__)
class BroadbandView(ModuleView):
def __init__(self, _model, controller):
super().__init__(_model, controller)
def __init__(self, module):
super().__init__(module)
widget = QWidget()
self._ui_form = Ui_Form()
self._ui_form.setupUi(widget)
self._model.widget = widget
self._ui_form.setupUi(self)
self.widget = widget
self._ui_form.start_frequencyField.editingFinished.connect(
lambda: self._controller.change_start_frequency(
lambda: self._module._controller.change_start_frequency(
self._ui_form.start_frequencyField.text()
)
)
self._ui_form.stop_frequencyField.editingFinished.connect(
lambda: self._controller.change_stop_frequency(
lambda: self._module._controller.change_stop_frequency(
self._ui_form.stop_frequencyField.text()
)
)
self._model.start_frequency_changed.connect(self.on_start_frequency_change)
self._model.stop_frequency_changed.connect(self.on_stop_frequency_change)
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()