From 4782eec80679483cd59c1997bbdbee4d3129955e Mon Sep 17 00:00:00 2001 From: jupfi Date: Sat, 1 Jul 2023 16:19:52 +0200 Subject: [PATCH] Changed to new structure. --- src/nqrduck_spectrometer/__init__.py | 4 +-- src/nqrduck_spectrometer/spectrometer.py | 25 +++++-------------- .../spectrometer_controller.py | 4 +-- .../spectrometer_model.py | 10 ++++++++ src/nqrduck_spectrometer/spectrometer_view.py | 8 +++--- 5 files changed, 23 insertions(+), 28 deletions(-) create mode 100644 src/nqrduck_spectrometer/spectrometer_model.py diff --git a/src/nqrduck_spectrometer/__init__.py b/src/nqrduck_spectrometer/__init__.py index dfab65d..78a0537 100644 --- a/src/nqrduck_spectrometer/__init__.py +++ b/src/nqrduck_spectrometer/__init__.py @@ -1,3 +1 @@ -from .spectrometer import Spectrometer as Model -from .spectrometer_controller import SpectrometerController as Controller -from .spectrometer_view import SpectrometerView as View \ No newline at end of file +from .spectrometer import Spectrometer as Module \ No newline at end of file diff --git a/src/nqrduck_spectrometer/spectrometer.py b/src/nqrduck_spectrometer/spectrometer.py index 8b96475..52e525c 100644 --- a/src/nqrduck_spectrometer/spectrometer.py +++ b/src/nqrduck_spectrometer/spectrometer.py @@ -1,21 +1,8 @@ from PyQt5.QtCore import pyqtSignal, QObject -from nqrduck.module.module_model import ModuleModel - - -class Spectrometer(ModuleModel): - widget_changed = pyqtSignal(QObject) - spectrometer_changed = pyqtSignal() - - @property - def spectrometer(self): - return self._spectrometer - - @property - def widget(self): - return self._widget - - @widget.setter - def widget(self, value): - self._widget = value - self.widget_changed.emit(value) +from nqrduck.module.module import Module +from nqrduck_spectrometer.spectrometer_model import SpectrometerModel +from nqrduck_spectrometer.spectrometer_view import SpectrometerView +from nqrduck_spectrometer.spectrometer_controller import SpectrometerController +from nqrduck_spectrometer.spectrometer_widget import Ui_Form +Spectrometer = Module(SpectrometerModel, SpectrometerController, SpectrometerView) \ No newline at end of file diff --git a/src/nqrduck_spectrometer/spectrometer_controller.py b/src/nqrduck_spectrometer/spectrometer_controller.py index 4bc14ae..faeb290 100644 --- a/src/nqrduck_spectrometer/spectrometer_controller.py +++ b/src/nqrduck_spectrometer/spectrometer_controller.py @@ -2,5 +2,5 @@ from nqrduck.module.module_controller import ModuleController class SpectrometerController(ModuleController): - def __init__(self, model): - super().__init__(model) \ No newline at end of file + def __init__(self, module): + super().__init__(module) \ No newline at end of file diff --git a/src/nqrduck_spectrometer/spectrometer_model.py b/src/nqrduck_spectrometer/spectrometer_model.py new file mode 100644 index 0000000..59a934d --- /dev/null +++ b/src/nqrduck_spectrometer/spectrometer_model.py @@ -0,0 +1,10 @@ +from PyQt5.QtCore import pyqtSignal, QObject +from nqrduck.module.module_model import ModuleModel + + +class SpectrometerModel(ModuleModel): + spectrometer_changed = pyqtSignal() + + @property + def spectrometer(self): + return self._spectrometer diff --git a/src/nqrduck_spectrometer/spectrometer_view.py b/src/nqrduck_spectrometer/spectrometer_view.py index 0507045..4b5ab54 100644 --- a/src/nqrduck_spectrometer/spectrometer_view.py +++ b/src/nqrduck_spectrometer/spectrometer_view.py @@ -4,10 +4,10 @@ from .spectrometer_widget import Ui_Form class SpectrometerView(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