GUI: Check beamline state before running automation.
This commit is contained in:
@@ -2,7 +2,7 @@ from PySide6.QtCore import Signal, Slot, Qt, QTimer
|
||||
from PySide6.QtWidgets import QFrame, QVBoxLayout, QHBoxLayout, QPushButton, QHeaderView, QSizePolicy, \
|
||||
QTableView, QMessageBox
|
||||
from PySide6.QtGui import QKeySequence, QShortcut
|
||||
from aaredaqlib.models import SampleShortInfoList, SampleShortInfo
|
||||
from aaredaqlib.models import SampleShortInfoList, SampleShortInfo, BeamlineStateEnum
|
||||
|
||||
from aaregui.models.sample_queue_model import SampleQueueSpreadsheet
|
||||
from aaregui.widgets.message_box import ring_current_low_check, experiment_hutch_shutter_check, LOW_CURRENT_THRESHOLD, \
|
||||
@@ -21,6 +21,7 @@ class SampleQueuePanel(QFrame):
|
||||
|
||||
def __init__(self, parent=None, samples: SampleShortInfoList | None = None):
|
||||
super().__init__(parent)
|
||||
self.__beamline_state = None
|
||||
self.__pause = True
|
||||
self.__set_to_pause = False
|
||||
self._current_db_id: int | None = None
|
||||
@@ -155,7 +156,13 @@ class SampleQueuePanel(QFrame):
|
||||
self.__warning_msg_box.done(0)
|
||||
self.__warning_msg_box = None
|
||||
|
||||
elif self.__pause:
|
||||
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 not self.ring_current_check():
|
||||
@@ -185,6 +192,7 @@ class SampleQueuePanel(QFrame):
|
||||
def update_daq_status(self, s: DAQStatusModel):
|
||||
self.ring_current = s.bl.ring_current_mA
|
||||
self._experiment_shutter_state = s.bl.exp_shutter_open
|
||||
self.__beamline_state = s.state
|
||||
|
||||
def pause_automation(self, set_id_to_None: bool = True):
|
||||
self.table_model.set_running(False)
|
||||
|
||||
Reference in New Issue
Block a user