mirror of
https://github.com/nqrduck/nqrduck-spectrometer.git
synced 2024-11-09 12:30:01 +00:00
Changed loading of modules.
This commit is contained in:
parent
8c825c6300
commit
8f6524c0f2
11 changed files with 70 additions and 47 deletions
|
@ -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"
|
19
src/nqrduck_spectrometer/base_spectrometer.py
Normal file
19
src/nqrduck_spectrometer/base_spectrometer.py
Normal file
|
@ -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
|
|
@ -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
|
||||
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -23,27 +23,10 @@
|
|||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="2">
|
||||
<widget class="QLineEdit" name="lineEdit"/>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Spectrometer tests:</string>
|
||||
</property>
|
||||
<widget class="QStackedWidget" name="stackedWidget">
|
||||
<widget class="QWidget" name="page"/>
|
||||
<widget class="QWidget" name="page_2"/>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
|
|
@ -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)
|
||||
Spectrometer = Module(SpectrometerModel, SpectrometerView, SpectrometerController)
|
|
@ -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
|
||||
|
|
@ -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:"))
|
||||
|
|
Loading…
Reference in a new issue