Skip to content

spectrometer_view

frog.gui.spectrometer_view ¤

Panel and widgets related to the control of spectrometers.

Attributes¤

Classes¤

SpectrometerControl(commands=_COMMANDS) ¤

Bases: DevicePanel

Class to monitor and control spectrometers.

Create the widgets to monitor and control the spectrometer.

Source code in frog/gui/spectrometer_view.py
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
def __init__(self, commands: Mapping[str, str] = _COMMANDS) -> None:
    """Create the widgets to monitor and control the spectrometer."""
    super().__init__(SPECTROMETER_TOPIC, "Spectrometer")

    self._buttons: dict[str, QPushButton] = {}
    """Buttons for the different spectrometer commands."""
    self._status_label = QLabel("Status:")
    """A label showing the current status of the device."""

    layout = QVBoxLayout()
    layout.addLayout(self._create_buttons(commands))
    layout.addWidget(self._status_label)
    self.setLayout(layout)

    pub.subscribe(self._on_status_changed, f"device.{SPECTROMETER_TOPIC}.status")
Functions¤
on_command_button_clicked(command) ¤

Execute the given command by sending a message to the appropriate topic.

Parameters:

Name Type Description Default
command str

Command to be executed

required
Source code in frog/gui/spectrometer_view.py
81
82
83
84
85
86
87
def on_command_button_clicked(self, command: str) -> None:
    """Execute the given command by sending a message to the appropriate topic.

    Args:
        command: Command to be executed
    """
    pub.sendMessage(f"device.{SPECTROMETER_TOPIC}.{command}")