GUI: fixed bug in automation where sample table wasnt updated when an error occured

This commit is contained in:
appleb_m
2025-12-11 13:33:03 +01:00
parent d53bb581eb
commit 13cb35b2c6
+38 -14
View File
@@ -26,7 +26,6 @@ class SampleQueuePanel(QFrame):
self._current_db_id: int | None = None
self.ring_current = None
self._experiment_shutter_state = None
self.__consecutive_missing_samples = 0
self.__recovery_timer = QTimer(self)
self.__recovery_timer.setSingleShot(True)
@@ -127,34 +126,45 @@ class SampleQueuePanel(QFrame):
self.__warning_msg_box = QMessageBox(self)
self.__warning_msg_box.setIcon(QMessageBox.Icon.Warning)
self.__warning_msg_box.setWindowTitle("TELL Warning")
self.__warning_msg_box.setText("TELL reported a warning (e.g. drying).")
self.__warning_msg_box.setText("TELL reported a warning. Please see console for details.")
self.__warning_msg_box.setInformativeText(
"Automation paused for 10 minutes.\nClick 'Continue Now' to resume immediately, or wait for auto-resume.")
"Automation paused for 10 minutes to allow sufficient dry time."
"\nClick 'Continue Now' to resume immediately, or wait for auto-resume.")
continue_btn = self.__warning_msg_box.addButton("Continue Now", QMessageBox.ButtonRole.AcceptRole)
self.__warning_msg_box.setWindowModality(Qt.WindowModality.NonModal)
continue_btn.clicked.connect(self.manual_resume_from_warning)
self.__warning_msg_box.show()
def show_error_dialog(self, title:str, msg:str, info:str = None):
self.__warning_msg_box = QMessageBox(self)
self.__warning_msg_box.setIcon(QMessageBox.Icon.Warning)
self.__warning_msg_box.setWindowTitle(title)
self.__warning_msg_box.setText(msg)
if info:
self.__warning_msg_box.setInformativeText(info)
self.__warning_msg_box.setWindowModality(Qt.WindowModality.NonModal)
self.__warning_msg_box.show()
def is_running(self):
return not self.__pause
def run(self):
self.__consecutive_missing_samples = 0
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 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 self.__pause:
if len(self.table_model.samples) > 0:
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")
self.table_model.set_running(True)
self.__set_to_pause = False
self.__pause = False
@@ -217,22 +227,36 @@ class SampleQueuePanel(QFrame):
self._current_db_id = next_item.db_id
self.auto_scan.emit(next_item)
else:
self.table_model.set_running(False)
self.__pause = True
self.play_button.setText("▶ Run")
self.pause_automation()
self.unmount.emit()
else:
if reply == "Warning":
self.table_model.remove_sample(db_id)
self._current_db_id = None
self.pause_automation()
logger.warning("TELL Warning: Pausing for 10 minutes.")
# recovery timer of ten minutes to allow Tell to dry. However user should be able to interupt
self.__recovery_timer.start()
self.show_warning_recovery_dialog()
elif reply == "Critical":
self.table_model.remove_sample(db_id)
self._current_db_id = None
self.pause_automation()
logger.critical("TELL Critical Error: Stopping automation.")
self.show_error_dialog(title=reply,msg="Critical Error", info="Repeated mount failuers.\n"
"Please check to see if pins"
" are loaded in these postions."
"\n If not please continue with new "
"samples.\nOtherwise contact your"
" local contact for support")
elif reply == "Authentication Error":
self.pause_automation()
self.show_error_dialog(title=reply,msg="Authentication Error", info="Please take the session to continue")
else:
self.table_model.remove_sample(db_id)
self._current_db_id = None
# Missing or other errors -> continue to next sample
if not self.__pause and len(self.table_model.samples) > 0:
next_item = self.table_model.samples[0]