mirror of
https://github.com/nqrduck/nqrduck-pulseprogrammer.git
synced 2024-11-09 11:20:01 +00:00
Implementation of automatic pulse parameter load.
This commit is contained in:
parent
cf0f70ac18
commit
7ddb7a6cc7
8 changed files with 80 additions and 10 deletions
0
README.md
Normal file
0
README.md
Normal file
|
@ -22,9 +22,9 @@ classifiers = [
|
|||
|
||||
dependencies = [
|
||||
"matplotlib",
|
||||
"pyqt5",
|
||||
"pyqt6",
|
||||
"NQRduck",
|
||||
]
|
||||
|
||||
[project.entry-points."nqrduck"]
|
||||
"nqrduck-pulseprogrammer" = "nqrduck_pulseprogrammer.pulseprogrammer:PulseProgrammer"
|
||||
"nqrduck-pulseprogrammer" = "nqrduck_pulseprogrammer.pulseprogrammer:pulse_programmer"
|
||||
|
|
0
src/nqrduck_pulseprogrammer/__init__.py
Normal file
0
src/nqrduck_pulseprogrammer/__init__.py
Normal file
|
@ -1,8 +1,10 @@
|
|||
import logging
|
||||
from PyQt5.QtCore import pyqtSlot, pyqtSignal
|
||||
from nqrduck.module.module_controller import ModuleController
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
class PulseProgrammerController(ModuleController):
|
||||
pass
|
||||
|
||||
def on_loading(self, pulse_parameter_options):
|
||||
logger.debug("Pulse programmer controller on loading")
|
||||
self.module.model.pulse_parameter_options = pulse_parameter_options
|
|
@ -1,6 +1,34 @@
|
|||
from PyQt5.QtCore import pyqtSignal
|
||||
import logging
|
||||
from collections import OrderedDict
|
||||
from PyQt6.QtCore import pyqtSignal
|
||||
from nqrduck.module.module_model import ModuleModel
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
class PulseProgrammerModel(ModuleModel):
|
||||
pass
|
||||
pulse_parameter_options_changed = pyqtSignal()
|
||||
events_changed = pyqtSignal(list)
|
||||
|
||||
def __init__(self, module):
|
||||
super().__init__(module)
|
||||
self.pulse_parameter_options = OrderedDict()
|
||||
self.events = []
|
||||
|
||||
@property
|
||||
def events(self):
|
||||
return self._events
|
||||
|
||||
@events.setter
|
||||
def events(self, value):
|
||||
self._events = value
|
||||
self.events_changed.emit(value)
|
||||
|
||||
@property
|
||||
def pulse_parameter_options(self):
|
||||
return self._pulse_parameter_options
|
||||
|
||||
@pulse_parameter_options.setter
|
||||
def pulse_parameter_options(self, value):
|
||||
self._pulse_parameter_options = value
|
||||
logger.debug("Pulse parameter options changed - emitting signal")
|
||||
self.pulse_parameter_options_changed.emit()
|
||||
|
|
|
@ -1,7 +1,12 @@
|
|||
from PyQt5.QtCore import pyqtSignal, QObject
|
||||
from nqrduck.module.module import Module
|
||||
from .model import PulseProgrammerModel
|
||||
from .view import PulseProgrammerView
|
||||
from .controller import PulseProgrammerController
|
||||
from .view import PulseProgrammerView
|
||||
|
||||
PulseProgrammer = Module(PulseProgrammerModel, PulseProgrammerView, PulseProgrammerController)
|
||||
class PulseProgrammer(Module):
|
||||
def __init__(self, model, view, controller):
|
||||
super().__init__(model, None, controller)
|
||||
self.view = None
|
||||
self.pulse_programmer_view = view(self)
|
||||
|
||||
pulse_programmer = PulseProgrammer(PulseProgrammerModel, PulseProgrammerView, PulseProgrammerController)
|
||||
|
|
10
src/nqrduck_pulseprogrammer/resources/spectrometer.ini
Normal file
10
src/nqrduck_pulseprogrammer/resources/spectrometer.ini
Normal file
|
@ -0,0 +1,10 @@
|
|||
[META]
|
||||
name = nqrduck-pulseprogrammer
|
||||
toolbar_name = PulseProgrammer
|
||||
category = Hardware
|
||||
tooltip = Application used to control the spectrometer
|
||||
|
||||
[FILES]
|
||||
widget_file = spectrometer_widget.py
|
||||
toolbox_logo = resources/toolbox_logo.png
|
||||
|
|
@ -1,8 +1,33 @@
|
|||
import logging
|
||||
from collections import OrderedDict
|
||||
from PyQt6.QtWidgets import QTableWidget, QVBoxLayout
|
||||
from PyQt6.QtCore import pyqtSlot
|
||||
from nqrduck.module.module_view import ModuleView
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class PulseProgrammerView(ModuleView):
|
||||
pass
|
||||
|
||||
def __init__(self, module):
|
||||
super().__init__(module)
|
||||
|
||||
self.setup_ui()
|
||||
|
||||
logger.debug("Connecting pulse parameter options changed signal to on_pulse_parameter_options_changed")
|
||||
module.model.pulse_parameter_options_changed.connect(self.on_pulse_parameter_options_changed)
|
||||
|
||||
def setup_ui(self):
|
||||
self.pulse_table = QTableWidget(self)
|
||||
layout = QVBoxLayout()
|
||||
layout.addWidget(self.pulse_table)
|
||||
self.setLayout(layout)
|
||||
|
||||
@pyqtSlot()
|
||||
def on_pulse_parameter_options_changed(self):
|
||||
logger.debug("Updating pulse parameter options to %s", self.module.model.pulse_parameter_options.keys())
|
||||
self.pulse_table.setRowCount(len(self.module.model.pulse_parameter_options))
|
||||
self.pulse_table.setVerticalHeaderLabels(self.module.model.pulse_parameter_options.keys())
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue