mirror of
https://github.com/nqrduck/nqrduck-spectrometer.git
synced 2024-11-09 20:40:02 +00:00
Changed to PyQt6.
This commit is contained in:
parent
b0eee8aeb3
commit
bef12d927c
7 changed files with 66 additions and 22 deletions
|
@ -1,4 +1,4 @@
|
||||||
from PyQt5.QtCore import pyqtSignal
|
from PyQt6.QtCore import pyqtSignal
|
||||||
from nqrduck.module.module import Module
|
from nqrduck.module.module import Module
|
||||||
|
|
||||||
class BaseSpectrometer(Module):
|
class BaseSpectrometer(Module):
|
||||||
|
@ -11,12 +11,6 @@ class BaseSpectrometer(Module):
|
||||||
self._view = None
|
self._view = None
|
||||||
self._inner_view = view(self)
|
self._inner_view = view(self)
|
||||||
|
|
||||||
@property
|
|
||||||
def pulse_program(self):
|
|
||||||
"""Pulse program of the spectrometer.
|
|
||||||
"""
|
|
||||||
raise NotImplementedError
|
|
||||||
|
|
||||||
def set_active(self):
|
def set_active(self):
|
||||||
"""Sets the spectrometer as the active spectrometer.
|
"""Sets the spectrometer as the active spectrometer.
|
||||||
"""
|
"""
|
||||||
|
|
42
src/nqrduck_spectrometer/base_spectrometer_model.py
Normal file
42
src/nqrduck_spectrometer/base_spectrometer_model.py
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
from collections import OrderedDict
|
||||||
|
from nqrduck.module.module_model import ModuleModel
|
||||||
|
|
||||||
|
class BaseSpectrometerModel(ModuleModel):
|
||||||
|
|
||||||
|
def __init__(self, module):
|
||||||
|
super().__init__(module)
|
||||||
|
self.settings = OrderedDict()
|
||||||
|
self.pulse_parameter_options = OrderedDict()
|
||||||
|
|
||||||
|
def add_setting(self, name, value, description) -> None:
|
||||||
|
self.settings[name] = self.Setting(name, value, description)
|
||||||
|
|
||||||
|
def add_pulse_parameter_option(self, name, options) -> None:
|
||||||
|
self.pulse_parameter_options[name] = options
|
||||||
|
|
||||||
|
class Setting():
|
||||||
|
def __init__(self, name, default, description) -> None:
|
||||||
|
self.name = name
|
||||||
|
self.value = default
|
||||||
|
self.description = description
|
||||||
|
|
||||||
|
class PulseParameter():
|
||||||
|
def __init__(self, name):
|
||||||
|
self.name = name
|
||||||
|
|
||||||
|
class PulseSequence():
|
||||||
|
def __init__(self) -> None:
|
||||||
|
self.events = list()
|
||||||
|
|
||||||
|
def get_event_names(self) -> list:
|
||||||
|
return [event.name for event in self.events]
|
||||||
|
|
||||||
|
class Event():
|
||||||
|
parameters = list()
|
||||||
|
|
||||||
|
def __init__(self, name : str, duration : float) -> None:
|
||||||
|
self.name = name
|
||||||
|
self.duration = duration
|
||||||
|
|
||||||
|
def add_parameter(self, parameter) -> None:
|
||||||
|
self.parameters.append(parameter)
|
9
src/nqrduck_spectrometer/base_spectrometer_view.py
Normal file
9
src/nqrduck_spectrometer/base_spectrometer_view.py
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
import logging
|
||||||
|
from PyQt6.QtWidgets import QTableWidget, QTableWidgetItem
|
||||||
|
from nqrduck.module.module_view import ModuleView
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
class BaseSpectrometerView(ModuleView):
|
||||||
|
pass
|
|
@ -1,5 +1,5 @@
|
||||||
import logging
|
import logging
|
||||||
from PyQt5.QtCore import pyqtSlot
|
from PyQt6.QtCore import pyqtSlot
|
||||||
from nqrduck.module.module_controller import ModuleController
|
from nqrduck.module.module_controller import ModuleController
|
||||||
from nqrduck.core.main_controller import MainController
|
from nqrduck.core.main_controller import MainController
|
||||||
from nqrduck_spectrometer.base_spectrometer import BaseSpectrometer
|
from nqrduck_spectrometer.base_spectrometer import BaseSpectrometer
|
||||||
|
@ -49,10 +49,10 @@ class SpectrometerController(ModuleController):
|
||||||
It connects the signals from the spectrometer model to the view.
|
It connects the signals from the spectrometer model to the view.
|
||||||
"""
|
"""
|
||||||
self._module.model.spectrometer_added.connect(
|
self._module.model.spectrometer_added.connect(
|
||||||
self._module.view.on_spectrometer_added
|
self.module.view.on_spectrometer_added
|
||||||
)
|
)
|
||||||
self._module.model.active_spectrometer_changed.connect(
|
self._module.model.active_spectrometer_changed.connect(
|
||||||
self._module.view.on_active_spectrometer_changed
|
self.module.view.on_active_spectrometer_changed
|
||||||
)
|
)
|
||||||
self._load_spectrometer_modules()
|
self._load_spectrometer_modules()
|
||||||
|
|
||||||
|
@ -62,6 +62,6 @@ class SpectrometerController(ModuleController):
|
||||||
"""
|
"""
|
||||||
logger.debug(
|
logger.debug(
|
||||||
"Measurement started with spectrometer: %s",
|
"Measurement started with spectrometer: %s",
|
||||||
self._module.model.active_spectrometer,
|
self.module.model.active_spectrometer,
|
||||||
)
|
)
|
||||||
self._module.model.active_spectrometer.controller.start_measurement()
|
self.module.model.active_spectrometer.controller.start_measurement()
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import logging
|
import logging
|
||||||
from PyQt5.QtCore import pyqtSignal
|
from PyQt6.QtCore import pyqtSignal
|
||||||
from nqrduck.module.module_model import ModuleModel
|
from nqrduck.module.module_model import ModuleModel
|
||||||
from .base_spectrometer import BaseSpectrometer
|
from .base_spectrometer import BaseSpectrometer
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import logging
|
import logging
|
||||||
from PyQt5.QtWidgets import QWidget, QToolButton, QToolBar, QAction, QMenu
|
from PyQt6.QtWidgets import QWidget, QToolButton, QToolBar, QMenu
|
||||||
from PyQt5.QtCore import pyqtSlot, pyqtSignal
|
from PyQt6.QtGui import QAction
|
||||||
|
from PyQt6.QtCore import pyqtSlot, pyqtSignal
|
||||||
from nqrduck.module.module_view import ModuleView
|
from nqrduck.module.module_view import ModuleView
|
||||||
from .widget import Ui_Form
|
from .widget import Ui_Form
|
||||||
|
|
||||||
|
|
|
@ -1,27 +1,25 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
# Form implementation generated from reading ui file '../Modules/nqrduck-spectrometer/src/nqrduck_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.9
|
# Created by: PyQt6 UI code generator 6.5.1
|
||||||
#
|
#
|
||||||
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
|
# WARNING: Any manual changes made to this file will be lost when pyuic6 is
|
||||||
# run again. Do not edit this file unless you know what you are doing.
|
# run again. Do not edit this file unless you know what you are doing.
|
||||||
|
|
||||||
|
|
||||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
from PyQt6 import QtCore, QtGui, QtWidgets
|
||||||
|
|
||||||
|
|
||||||
class Ui_Form(object):
|
class Ui_Form(object):
|
||||||
def setupUi(self, Form):
|
def setupUi(self, Form):
|
||||||
Form.setObjectName("Form")
|
Form.setObjectName("Form")
|
||||||
Form.resize(800, 600)
|
Form.resize(800, 600)
|
||||||
self.gridLayoutWidget = QtWidgets.QWidget(Form)
|
self.gridLayoutWidget = QtWidgets.QWidget(parent=Form)
|
||||||
self.gridLayoutWidget.setGeometry(QtCore.QRect(-1, -1, 811, 611))
|
self.gridLayoutWidget.setGeometry(QtCore.QRect(-1, -1, 811, 611))
|
||||||
self.gridLayoutWidget.setObjectName("gridLayoutWidget")
|
self.gridLayoutWidget.setObjectName("gridLayoutWidget")
|
||||||
self.gridLayout = QtWidgets.QGridLayout(self.gridLayoutWidget)
|
self.gridLayout = QtWidgets.QGridLayout(self.gridLayoutWidget)
|
||||||
self.gridLayout.setContentsMargins(0, 0, 0, 0)
|
self.gridLayout.setContentsMargins(0, 0, 0, 0)
|
||||||
self.gridLayout.setObjectName("gridLayout")
|
self.gridLayout.setObjectName("gridLayout")
|
||||||
self.stackedWidget = QtWidgets.QStackedWidget(self.gridLayoutWidget)
|
self.stackedWidget = QtWidgets.QStackedWidget(parent=self.gridLayoutWidget)
|
||||||
self.stackedWidget.setObjectName("stackedWidget")
|
self.stackedWidget.setObjectName("stackedWidget")
|
||||||
self.page = QtWidgets.QWidget()
|
self.page = QtWidgets.QWidget()
|
||||||
self.page.setObjectName("page")
|
self.page.setObjectName("page")
|
||||||
|
|
Loading…
Reference in a new issue