0
0
mirror of https://github.com/bec-project/bec_widgets.git synced 2025-07-14 03:31:50 +02:00

fix: mode lock in config to disable changing the mode for users

This commit is contained in:
wyzula-jan
2023-09-12 11:57:29 +02:00
parent c510f4eb63
commit 10ccf0cc97
2 changed files with 18 additions and 0 deletions

View File

@ -7,9 +7,11 @@ plot_motors:
num_dim_points: 100
scatter_size: 5
precision: 3
mode_lock: Start/Stop # "Individual" or "Start/Stop"
extra_columns:
- sample name: "sample 1"
- step_x [mu]: 25
- step_y [mu]: 25
- exp_time [s]: 1
- start: 1
- tilt [deg]: 0

View File

@ -72,6 +72,7 @@ class MotorApp(QWidget):
self.scatter_size = plot_motors.get("scatter_size", 5)
self.precision = plot_motors.get("precision", 2)
self.extra_columns = plot_motors.get("extra_columns", None)
self.mode_lock = plot_motors.get("mode_lock", False)
# Saved motors from config file
self.selected_motors = selected_motors
@ -444,6 +445,20 @@ class MotorApp(QWidget):
# Mode switch
self.comboBox_mode.currentIndexChanged.connect(self.update_table_header)
def init_mode_lock(self) -> None:
if self.mode_lock is False:
return
elif self.mode_lock == "Individual":
self.comboBox_mode.setCurrentIndex(0)
self.comboBox_mode.setEnabled(False)
elif self.mode_lock == "Start/Stop":
self.comboBox_mode.setCurrentIndex(1)
self.comboBox_mode.setEnabled(False)
else:
self.mode_lock = False
print(f"Warning: Mode lock '{self.mode_lock}' not recognized.")
print(f"Unlocking mode lock.")
def init_ui(self) -> None:
"""Setup all ui elements"""
@ -454,6 +469,7 @@ class MotorApp(QWidget):
self.init_ui_motor_connections() # Motor Connections
self.init_keyboard_shortcuts() # Keyboard Shortcuts
self.init_ui_table() # Table validators for x and y coordinates
self.init_mode_lock() # Mode lock
def init_motor_map(self):
# Get motor limits