feat: automatic detection of the motors per setup

This commit is contained in:
x01dc
2025-10-22 10:10:09 +02:00
parent 9b60c8c23f
commit a682131659
@@ -28,12 +28,14 @@ class XRayEye(BECWidget, QWidget):
def __init__(self, parent=None, **kwargs):
super().__init__(parent=parent, **kwargs)
self.get_bec_shortcuts()
self._init_ui()
self._make_connections()
# Connection to redis endpoints
self.bec_dispatcher.connect_slot(self.device_updates,MessageEndpoints.device_readback("omny_xray_gui"))
self.bec_dispatcher.connect_slot(self.on_tomo_angle_readback,MessageEndpoints.device_readback("fsamroy"))
self.connect_motors()
def _init_ui(self):
self.core_layout = QHBoxLayout(self)
@@ -110,9 +112,11 @@ class XRayEye(BECWidget, QWidget):
# Sample/Message form (bottom)
form = QGridLayout()
self.sample_name_line_edit = QLineEdit(parent=self)
self.sample_name_line_edit.setReadOnly(True)
form.addWidget(QLabel("Sample", parent=self),0,0)
form.addWidget(self.sample_name_line_edit,0,1)
self.message_line_edit = QLineEdit(parent=self)
self.message_line_edit.setReadOnly(True)
form.addWidget(QLabel("Message", parent=self),1,0)
form.addWidget(self.message_line_edit,1,1)
self.control_panel_layout.addLayout(form)
@@ -145,7 +149,18 @@ class XRayEye(BECWidget, QWidget):
sep.setFrameShadow(QFrame.Sunken)
sep.setLineWidth(1)
return sep
################################################################################
# Device Connection logic
################################################################################
def connect_motors(self):
""" Checks one of the possible motors for flomni, omny and lamni setup."""
possible_motors = ['osamroy','lsamrot','fsamroy']
for motor in possible_motors:
if motor in self.dev:
self.bec_dispatcher.connect_slot(self.on_tomo_angle_readback,MessageEndpoints.device_readback(motor))
logger.info(f"Succesfully connected to {motor}")
################################################################################
# Properties ported from the original OmnyAlignment, can be adjusted as needed
################################################################################