Skip to content

main_window

frog.gui.main_window ¤

Code for FROG's main GUI window.

Attributes¤

Classes¤

MainWindow() ¤

Bases: QMainWindow

The main window for FROG.

Create a new MainWindow.

Source code in frog/gui/main_window.py
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
def __init__(self) -> None:
    """Create a new MainWindow."""
    super().__init__()
    self.setWindowTitle(f"{APP_NAME} v{APP_VERSION}")

    set_uncaught_exception_handler(self)

    open_log = LogOpen(self)
    open_log_location = LogLocationOpen(self)
    logsmenu = QMenu("Logs", self)
    logsmenu.addAction(open_log)
    logsmenu.addAction(open_log_location)
    self.menuBar().addMenu(logsmenu)

    docs_viewer = DocsViewer(self)
    helpmenu = QMenu("Help", self)
    helpmenu.addAction(docs_viewer)
    self.menuBar().addMenu(helpmenu)

    layout_left = QGridLayout()

    # For choosing hardware set
    hardware_sets = HardwareSetsControl()

    # Setup for measure script panel
    measure_script = ScriptControl()

    # Setup for stepper motor control
    stepper_motor = StepperMotorControl()

    # Setup for spectrometer
    spectrometer: QGroupBox = SpectrometerControl()

    # Setup for interferometer monitor
    sensors = SensorsPanel()
    sensors.setSizePolicy(
        QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Expanding
    )

    # Setup for data file widgets
    data_file = DataFileControl()

    layout_left.addWidget(hardware_sets, 0, 0, 1, 2)
    layout_left.addWidget(measure_script, 1, 0, 1, 2)
    layout_left.addWidget(stepper_motor, 2, 0, 1, 1)
    layout_left.addWidget(spectrometer, 2, 1, 1, 1)
    layout_left.addWidget(sensors, 3, 0, 1, 2)
    layout_left.addWidget(data_file, 4, 0, 1, 2)

    layout_right = QGridLayout()

    bb_monitor: QGroupBox = TemperaturePlot()
    temp_monitor: QGroupBox = TemperatureMonitorControl()
    tc_hot: QGroupBox = TemperatureControllerControl(
        "hot", TEMPERATURE_MONITOR_HOT_BB_IDX, allow_update=True
    )
    tc_cold: QGroupBox = TemperatureControllerControl(
        "cold", TEMPERATURE_MONITOR_COLD_BB_IDX, allow_update=False
    )

    layout_right.addWidget(bb_monitor, 1, 0, 1, 2)
    layout_right.addWidget(temp_monitor, 2, 0, 1, 2)
    layout_right.addWidget(tc_hot, 3, 0, 1, 1)
    layout_right.addWidget(tc_cold, 3, 1, 1, 1)

    # Display widgets in two columns
    left = QWidget()
    left.setLayout(layout_left)
    right = QWidget()
    right.setLayout(layout_right)
    layout = QHBoxLayout()
    layout.addWidget(left)
    layout.addWidget(right)

    central = QWidget()
    central.setLayout(layout)

    self.setCentralWidget(central)
Functions¤
closeEvent(event) ¤

Send window.closed message.

Source code in frog/gui/main_window.py
121
122
123
def closeEvent(self, event: QCloseEvent) -> None:
    """Send window.closed message."""
    pub.sendMessage("window.closed")
showEvent(event) ¤

Send window.opened message.

Source code in frog/gui/main_window.py
117
118
119
def showEvent(self, event: QShowEvent) -> None:
    """Send window.opened message."""
    pub.sendMessage("window.opened")

Functions¤