diff --git a/src/nqrduck_spectrometer/base_spectrometer_model.py b/src/nqrduck_spectrometer/base_spectrometer_model.py index 76bac23..b0d86f7 100644 --- a/src/nqrduck_spectrometer/base_spectrometer_model.py +++ b/src/nqrduck_spectrometer/base_spectrometer_model.py @@ -14,8 +14,8 @@ class BaseSpectrometerModel(ModuleModel): 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 + def add_pulse_parameter_option(self, name, pulse_parameter_class) -> None: + self.pulse_parameter_options[name] = pulse_parameter_class class Setting: """A setting for the spectrometer is a value that is the same for all events in a pulse sequence. @@ -34,5 +34,11 @@ class BaseSpectrometerModel(ModuleModel): class PulseParameter: def __init__(self, name): self.name = name + + def get_pixmap(self): + raise NotImplementedError + + def get_options(self): + raise NotImplementedError diff --git a/src/nqrduck_spectrometer/base_spectrometer_pulseparameters.py b/src/nqrduck_spectrometer/base_spectrometer_pulseparameters.py new file mode 100644 index 0000000..df16022 --- /dev/null +++ b/src/nqrduck_spectrometer/base_spectrometer_pulseparameters.py @@ -0,0 +1,60 @@ +from PyQt6.QtGui import QPixmap +from pathlib import Path +from .base_spectrometer_model import BaseSpectrometerModel + +class TXPulse(BaseSpectrometerModel.PulseParameter): + def __init__(self, name) -> None: + super().__init__(name) + self.tx_state = False + self.tx_phase = 0 + + # Create a button + self.button = QPushButton(self) + self.button.setGeometry(0, 0, 200, 200) + + # Set a custom image for the button + image_path = "resources/wip_no_pulse.png" + pixmap = QPixmap(image_path) + self.button.setIcon(pixmap) + self.button.setIconSize(pixmap.size()) + + class RectPulse(): + def __init__(self, name) -> None: + super().__init__(name) + + class SincPulse(): + def __init__(self, name) -> None: + super().__init__(name) + + class GaussianPulse(): + def __init__(self, name) -> None: + super().__init__(name) + + class RXReadout(BaseSpectrometerModel.PulseParameter): + def __init__(self, name) -> None: + super().__init__(name) + self.rx_freq = 0 + self.rx_phase = 0 + + +class Gate(BaseSpectrometerModel.PulseParameter): + def __init__(self, name) -> None: + super().__init__(name) + self.state = False + + def get_pixmap(self): + self_path = Path(__file__).parent + if self.state is False: + image_path = self_path / "resources/pulseparameter/wip_no_txpulse.png" + elif self.state is True: + image_path = self_path / "resources/pulseparameter/wip_txpulse.png" + pixmap = QPixmap(str(image_path)) + return pixmap + + def get_options(self): + return (bool, self.state) + + def set_options(self, options): + self.state = options + + \ No newline at end of file diff --git a/src/nqrduck_spectrometer/base_spectrometer_view.py b/src/nqrduck_spectrometer/base_spectrometer_view.py index 014354e..d4a9643 100644 --- a/src/nqrduck_spectrometer/base_spectrometer_view.py +++ b/src/nqrduck_spectrometer/base_spectrometer_view.py @@ -31,7 +31,7 @@ class BaseSpectrometerView(ModuleView): logger.debug("Adding setting to settings view: %s", setting.name) # Create a label for the setting label = QLabel(setting.name) - label.setMinimumWidth(70) + label.setMinimumWidth(120) # Add an QLineEdit for the setting line_edit = QLineEdit(str(setting.value)) line_edit.setMinimumWidth(100) diff --git a/src/nqrduck_spectrometer/resources/pulseparameter/wip_no_txpulse.png b/src/nqrduck_spectrometer/resources/pulseparameter/wip_no_txpulse.png new file mode 100644 index 0000000..0f98d22 Binary files /dev/null and b/src/nqrduck_spectrometer/resources/pulseparameter/wip_no_txpulse.png differ diff --git a/src/nqrduck_spectrometer/resources/pulseparameter/wip_txpulse.png b/src/nqrduck_spectrometer/resources/pulseparameter/wip_txpulse.png new file mode 100644 index 0000000..9782dc9 Binary files /dev/null and b/src/nqrduck_spectrometer/resources/pulseparameter/wip_txpulse.png differ