gui: ADDED check_enabled for developing

This commit is contained in:
2026-02-24 14:48:52 +01:00
parent 7e2577e025
commit 0b18942d21
+21 -18
View File
@@ -14,6 +14,8 @@ from aare.common.logger_config import setup_logger
logger = setup_logger("aareGUI")
CHECK_ENABLED = False
class SampleQueuePanel(QFrame):
auto_scan = Signal(SampleShortInfo)
unmount = Signal()
@@ -152,25 +154,26 @@ class SampleQueuePanel(QFrame):
def run(self):
self.__recovery_timer.stop()
if hasattr(self, '__warning_msg_box') and self.__warning_msg_box:
self.__warning_msg_box.done(0)
self.__warning_msg_box = None
if CHECK_ENABLED:
if hasattr(self, '__warning_msg_box') and self.__warning_msg_box:
self.__warning_msg_box.done(0)
self.__warning_msg_box = None
if self.__beamline_state != BeamlineStateEnum.SampleAlignment:
self.show_error_dialog(title="wrong beamline state",
msg="Cannot run automation while beamline is not in sample alignment state",
info="Please change the state at the bottom of the menu")
return
if self.__beamline_state != BeamlineStateEnum.SampleAlignment:
self.show_error_dialog(title="wrong beamline state",
msg="Cannot run automation while beamline is not in sample alignment state",
info="Please change the state at the bottom of the menu")
return
if self.__pause:
if len(self.table_model.samples) > 0:
if CHECK_ENABLED:
if not self.ring_current_check():
logger.debug("low ring current, skipping")
return
if not self.ring_current_check():
logger.debug("low ring current, skipping")
return
elif not experiment_hutch_shutter_check(parent=self, shutter_state=self._experiment_shutter_state):
logger.debug("experiment shutter closed, user chose to skip")
elif not experiment_hutch_shutter_check(parent=self, shutter_state=self._experiment_shutter_state):
logger.debug("experiment shutter closed, user chose to skip")
self.table_model.set_running(True)
self.__set_to_pause = False
@@ -206,15 +209,15 @@ class SampleQueuePanel(QFrame):
if self._current_db_id is not None and db_id != self._current_db_id:
return
def current_ok() -> bool:
return (self.ring_current is not None) and (self.ring_current >= LOW_CURRENT_THRESHOLD)
if self.ring_current is None or (self.ring_current < LOW_CURRENT_THRESHOLD):
if CHECK_ENABLED and (self.ring_current is None or (self.ring_current < LOW_CURRENT_THRESHOLD)):
# Pause UI state
self.pause_automation(set_id_to_None=False)
# This dialog should auto-accept when current_ok() returns True.
# No user button press is required to continue.
def current_ok() -> bool:
return (self.ring_current is not None) and (self.ring_current >= LOW_CURRENT_THRESHOLD)
if ring_current_auto_check(self, self.ring_current, current_ok):
logger.debug("Ring current recovered or user chose to continue,"
"resuming automation")