GUI: park and dry toggle when automation finishes.

This commit is contained in:
appleb_m committed 2026-05-01 14:28:49 +02:00
1 parent f4718d396c
commit ed17af9dec
3 files changed
+21 -15

No files matched your search

+5 -5
View File
@@ -634,7 +634,6 @@ async def samcam_autoexposure(token: str = Depends(oauth2_scheme)):
Returns:
"OK" on success.
"""
logger.debug(f"SamCam settings: {s}")
auth.check_jwt_rw(cfg, auth.parse_token(token))
daq.auto_exposure()
return "OK"
@@ -725,6 +724,8 @@ async def sample(token: str = Depends(oauth2_scheme)) -> SampleShortInfo:
location=s.location
)
@app.post("/sample/park_and_dry")
async def park_and_dry(token: str = Depends(oauth2_scheme)):
"""
Execute the 'park and dry' procedure for the sample changer (TELL).
@@ -735,12 +736,11 @@ async def park_and_dry(token: str = Depends(oauth2_scheme)):
Returns:
Dictionary with status and message.
"""
token_data = auth.parse_token(token)
auth.check_jwt_ro(cfg, auth.parse_token(token))
auth.check_jwt_rw(cfg, auth.parse_token(token))
daq.park_and_dry()
return {
return {
"ok": True,
"message": "TELL has been dryed and parked",
"message": "TELL has been dried and parked",
}
+1
View File
@@ -526,6 +526,7 @@ class MainWindow(QMainWindow):
self.job_list_panel.auto_scan.connect(self.daq.automated_scan)
self.job_list_panel.unmount.connect(self.daq.unmount)
self.job_list_panel.park_and_dry.connect(self.daq.park_and_dry)
self.tell_samples.mount.connect(self.daq.mount)
self.tell_samples.unmount.connect(self.daq.unmount)
+15 -10
View File
@@ -1,6 +1,6 @@
from PySide6.QtCore import Signal, Slot, Qt, QTimer
from PySide6.QtWidgets import QFrame, QVBoxLayout, QHBoxLayout, QPushButton, QHeaderView, QSizePolicy, \
QTableView, QMessageBox
QTableView, QMessageBox, QCheckBox
from PySide6.QtGui import QKeySequence, QShortcut
from aare.common.models import SampleShortInfoList, SampleShortInfo, BeamlineStateEnum
@@ -19,6 +19,7 @@ CHECK_ENABLED = False
class SampleQueuePanel(QFrame):
auto_scan = Signal(SampleShortInfo)
unmount = Signal()
park_and_dry = Signal()
viewer_track_online = Signal()
def __init__(self, parent=None, samples: SampleShortInfoList | None = None):
@@ -83,11 +84,13 @@ class SampleQueuePanel(QFrame):
self.clear_button = QPushButton("✖ Clear list", self)
self.clear_button.clicked.connect(self.clear)
self.clear_button.clicked.connect(self.table_model.clearSamples)
self.park_and_dry_when_cleared = QCheckBox("Park and dry when automation finishes", self)
self.park_and_dry_when_cleared.setChecked(True)
button_layout.addWidget(self.play_button)
button_layout.addWidget(self.remove_button)
button_layout.addWidget(self.clear_button)
button_layout.addWidget(self.park_and_dry_when_cleared)
# Add the button layout to the main layout
layout.addLayout(button_layout)
@@ -157,6 +160,15 @@ class SampleQueuePanel(QFrame):
def is_running(self):
return not self.__pause
def _finish_empty_queue(self):
self.pause_automation()
if self.park_and_dry_when_cleared.isChecked():
logger.info("Automation queue empty; parking and drying TELL.")
self.park_and_dry.emit()
else:
logger.info("Automation queue empty; unmounting current sample.")
self.unmount.emit()
def run(self):
self.__recovery_timer.stop()
if CHECK_ENABLED:
@@ -260,12 +272,6 @@ class SampleQueuePanel(QFrame):
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")
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."
@@ -285,5 +291,4 @@ class SampleQueuePanel(QFrame):
self._current_db_id = next_item.db_id
self.auto_scan.emit(next_item)
else:
self.pause_automation()
self.unmount.emit()
self._finish_empty_queue()