diff --git a/pyproject.toml b/pyproject.toml index d17a84f..4db67f4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,9 +2,12 @@ requires = ["hatchling"] build-backend = "hatchling.build" +[tool.hatch.metadata] +allow-direct-references = true + [project] name = "nqrduck-spectrometer" -version = "0.0.5" +version = "0.0.6" authors = [ { name="Julia Pfitzer", email="git@jupfi.me" }, ] @@ -26,3 +29,5 @@ dependencies = [ "NQRduck", ] +[project.entry-points."nqrduck"] +"nqrduck-spectrometer" = "nqrduck_spectrometer.spectrometer:Spectrometer" \ No newline at end of file diff --git a/src/nqrduck_spectrometer/base_spectrometer.py b/src/nqrduck_spectrometer/base_spectrometer.py new file mode 100644 index 0000000..68791b5 --- /dev/null +++ b/src/nqrduck_spectrometer/base_spectrometer.py @@ -0,0 +1,19 @@ +class BaseSpectrometer: + """Base class for all spectrometers. All spectrometers should inherit from this class.""" + + def __init__(self): + pass + + @property + def name(self): + """Name of the spectrometer.""" + raise NotImplementedError + + @property + def pulse_program(self): + """Pulse program of the spectrometer.""" + raise NotImplementedError + + def start_measurement(self): + """Starts the measurement.""" + raise NotImplementedError diff --git a/src/nqrduck_spectrometer/model.py b/src/nqrduck_spectrometer/model.py index a04b61b..bbb78ee 100644 --- a/src/nqrduck_spectrometer/model.py +++ b/src/nqrduck_spectrometer/model.py @@ -1,11 +1,36 @@ -from PyQt5.QtCore import pyqtSignal, QObject +import logging +from PyQt5.QtCore import pyqtSignal from nqrduck.module.module_model import ModuleModel +logger = logging.getLogger(__name__) class SpectrometerModel(ModuleModel): spectrometer_changed = pyqtSignal() - @property - def spectrometer(self): - return self._spectrometer + def __init__(self, module) -> None: + super().__init__(module) + self._active_spectrometer = None + self._available_spectrometers = [] + self._load_available_spectrometers() + + @property + def active_spectrometer(self): + return self._active_spectrometer + + @active_spectrometer.setter + def active_spectrometer(self, value): + self._active_spectrometer = value + self.spectrometer_changed.emit() + + @property + def available_spectrometers(self): + return self._available_spectrometers + + def _load_available_spectrometers(self): + pass + + + def _load_spectrometer(self, spectrometer_module_name): + pass + diff --git a/src/nqrduck_spectrometer/resources/spectrometer.ini b/src/nqrduck_spectrometer/resources/spectrometer.ini index 099dfbd..1b318ae 100644 --- a/src/nqrduck_spectrometer/resources/spectrometer.ini +++ b/src/nqrduck_spectrometer/resources/spectrometer.ini @@ -8,3 +8,4 @@ tooltip = Application used to control the spectrometer config = resources/spectrometer.ini widget_file = spectrometer_widget.py toolbox_logo = resources/toolbox_logo.png + diff --git a/src/nqrduck_spectrometer/resources/spectrometer_widget.ui b/src/nqrduck_spectrometer/resources/spectrometer_widget.ui index 8d23ccc..3960907 100644 --- a/src/nqrduck_spectrometer/resources/spectrometer_widget.ui +++ b/src/nqrduck_spectrometer/resources/spectrometer_widget.ui @@ -23,27 +23,10 @@ - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - Spectrometer tests: - + + + diff --git a/src/nqrduck_spectrometer/spectrometer.py b/src/nqrduck_spectrometer/spectrometer.py index ef5aaaf..3fc47ba 100644 --- a/src/nqrduck_spectrometer/spectrometer.py +++ b/src/nqrduck_spectrometer/spectrometer.py @@ -1,8 +1,6 @@ -from PyQt5.QtCore import pyqtSignal, QObject from nqrduck.module.module import Module from nqrduck_spectrometer.model import SpectrometerModel from nqrduck_spectrometer.view import SpectrometerView from nqrduck_spectrometer.controller import SpectrometerController -from nqrduck_spectrometer.widget import Ui_Form -Spectrometer = Module(SpectrometerModel, SpectrometerController, SpectrometerView) \ No newline at end of file +Spectrometer = Module(SpectrometerModel, SpectrometerView, SpectrometerController) \ No newline at end of file diff --git a/src/nqrduck_spectrometer/spectrometers/LimeNQR/limenqr.py b/src/nqrduck_spectrometer/spectrometers/LimeNQR/limenqr.py deleted file mode 100644 index ec4d47f..0000000 --- a/src/nqrduck_spectrometer/spectrometers/LimeNQR/limenqr.py +++ /dev/null @@ -1,8 +0,0 @@ -from ...spectrometer import Spectrometer - -class LimeNQR(Spectrometer): - def __init__(self, model, controller): - super(LimeNQR, self).__init__(model, controller) - self._model = model - self._controller = controller - \ No newline at end of file diff --git a/src/nqrduck_spectrometer/spectrometers/LimeNQR/limenqr_view.py b/src/nqrduck_spectrometer/spectrometers/LimeNQR/limenqr_view.py deleted file mode 100644 index e69de29..0000000 diff --git a/src/nqrduck_spectrometer/spectrometers/Scout/scout.py b/src/nqrduck_spectrometer/spectrometers/Scout/scout.py deleted file mode 100644 index e69de29..0000000 diff --git a/src/nqrduck_spectrometer/spectrometers/Scout/scout_view.py b/src/nqrduck_spectrometer/spectrometers/Scout/scout_view.py deleted file mode 100644 index e69de29..0000000 diff --git a/src/nqrduck_spectrometer/widget.py b/src/nqrduck_spectrometer/widget.py index beb0370..d91664e 100644 --- a/src/nqrduck_spectrometer/widget.py +++ b/src/nqrduck_spectrometer/widget.py @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- -# Form implementation generated from reading ui file 'modules/spectrometer/resources/spectrometer_widget.ui' +# Form implementation generated from reading ui file '../Modules/nqrduck-spectrometer/src/nqrduck_spectrometer/resources/spectrometer_widget.ui' # -# Created by: PyQt5 UI code generator 5.15.7 +# Created by: PyQt5 UI code generator 5.15.9 # # WARNING: Any manual changes made to this file will be lost when pyuic5 is # run again. Do not edit this file unless you know what you are doing. @@ -21,14 +21,15 @@ class Ui_Form(object): self.gridLayout = QtWidgets.QGridLayout(self.gridLayoutWidget) self.gridLayout.setContentsMargins(0, 0, 0, 0) self.gridLayout.setObjectName("gridLayout") - self.lineEdit = QtWidgets.QLineEdit(self.gridLayoutWidget) - self.lineEdit.setObjectName("lineEdit") - self.gridLayout.addWidget(self.lineEdit, 0, 2, 1, 1) - spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) - self.gridLayout.addItem(spacerItem, 0, 1, 1, 1) - self.label = QtWidgets.QLabel(self.gridLayoutWidget) - self.label.setObjectName("label") - self.gridLayout.addWidget(self.label, 0, 0, 1, 1) + self.stackedWidget = QtWidgets.QStackedWidget(self.gridLayoutWidget) + self.stackedWidget.setObjectName("stackedWidget") + self.page = QtWidgets.QWidget() + self.page.setObjectName("page") + self.stackedWidget.addWidget(self.page) + self.page_2 = QtWidgets.QWidget() + self.page_2.setObjectName("page_2") + self.stackedWidget.addWidget(self.page_2) + self.gridLayout.addWidget(self.stackedWidget, 0, 0, 1, 1) self.retranslateUi(Form) QtCore.QMetaObject.connectSlotsByName(Form) @@ -36,4 +37,3 @@ class Ui_Form(object): def retranslateUi(self, Form): _translate = QtCore.QCoreApplication.translate Form.setWindowTitle(_translate("Form", "Form")) - self.label.setText(_translate("Form", "Spectrometer tests:"))