Skip to content

Commit

Permalink
Interlock status display improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
kingofpayne committed Nov 26, 2024
1 parent 1f5e65f commit ba85c42
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions laserstudio/widgets/toolbars/pdmtoolbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,6 @@ def __init__(self, laser: PDMInstrument, laser_num: int):
w.toggled.connect(lambda b: self.laser.__setattr__("on_off", b))
self.addWidget(w)

# Laser interlock status
self.interlock_label = w = QLabel("Interlock status: Unknown")
self.addWidget(w)

grid = QGridLayout()
grid.setContentsMargins(0, 4, 0, 0)
row = 0
Expand Down Expand Up @@ -131,13 +127,19 @@ def __init__(self, laser: PDMInstrument, laser_num: int):
grid.addWidget(w, row, 1)
row += 1

# Laser interlock status
grid.addWidget(QLabel("Interlock status:"), row, 0)
self.interlock_label = w = QLabel("Unknown")
grid.addWidget(w, row, 1)
row += 1

w = QWidget()
w.setLayout(grid)
self.addWidget(w)

self.reload_parameters()
self.laser.parameter_changed.connect(self.refresh_interface)

def refresh_interface(self, name: str, value: Any):
"""Refresh the Toolbar UI according to given parameter and value"""
if name == "on_off":
Expand All @@ -153,7 +155,7 @@ def refresh_interface(self, name: str, value: Any):
self.offset_current_input.setValue(value)
self.offset_current_input.blockSignals(False)
elif name == "interlock_status":
self.interlock_label.setText(f"Interlock status: {'opened' if value else 'closed'}")
self.interlock_label.setText('Opened' if value else 'Closed')

def reload_parameters(self):
self.sweep_min_input.setValue(self.laser.sweep_min)
Expand Down

0 comments on commit ba85c42

Please sign in to comment.