From 6d191c87bfe13e43dc9016853a7fbb146e46231d Mon Sep 17 00:00:00 2001 From: Filip Leonarski Date: Tue, 25 Nov 2025 09:12:42 +0100 Subject: [PATCH] GUI: file path protection for run numbers based on data collection type --- gui/src/aaregui/main_window.py | 3 +++ .../aaregui/panels/data_collection_settings.py | 15 +++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/gui/src/aaregui/main_window.py b/gui/src/aaregui/main_window.py index b341b6c8..a42d0ff4 100644 --- a/gui/src/aaregui/main_window.py +++ b/gui/src/aaregui/main_window.py @@ -325,6 +325,8 @@ class MainWindow(QMainWindow): self.daq.update.connect(self.beamline.omega_panel.update_daq_status) self.daq.update.connect(self.beamline.smargon_panel.update_daq_status) + self.daq.update.connect(self.job_list_panel.update_daq_status) + self.daq.update.connect(self.data_collection.file_path_panel.update_daq_status) self.daq.update.connect(self.data_collection.update_daq_status) self.daq.update.connect(self.beamline.illumination_panel.update_daq_status) @@ -332,6 +334,7 @@ class MainWindow(QMainWindow): self.daq.update.connect(self.sample_camera.update_daq_status) self.daq.update.connect(self.tell_samples.update_daq_status) self.daq.update.connect(self.ref_tools_panel.update_daq_status) + if self.__decoded_token.staff: self.daq.update.connect(self.beamline.beam_size.update_daq_status) self.daq.update.connect(self.beamline.beam_center.update_daq_status) diff --git a/gui/src/aaregui/panels/data_collection_settings.py b/gui/src/aaregui/panels/data_collection_settings.py index 61728a29..b89d695c 100644 --- a/gui/src/aaregui/panels/data_collection_settings.py +++ b/gui/src/aaregui/panels/data_collection_settings.py @@ -66,11 +66,16 @@ class DataCollectionSettings(QFrame): self.screening.update_filename(self.file_path_panel.filename) self.simple.update_filename(self.file_path_panel.filename) + self.file_path_panel.set_scan_kind("raster") self.file_path_panel.path_updated.connect(raster_mgr.update_filename) self.file_path_panel.path_updated.connect(self.screening.update_filename) self.file_path_panel.path_updated.connect(self.simple.update_filename) self.__sample_id = None + self.__tab_widget.currentChanged.connect(self._on_tab_changed) + + # ... existing code ... + @Slot() def switch_to_raster(self): self.__tab_widget.setCurrentIndex(0) @@ -87,3 +92,13 @@ class DataCollectionSettings(QFrame): if s.sample is not None and s.sample.db_id != self.__sample_id: self.__sample_id = s.sample.db_id self.__tab_widget.setCurrentIndex(0) + + @Slot(int) + def _on_tab_changed(self, idx: int): + # 0: Raster, 1: Rotation (incl. screening), 2: Simple (rotation wrapper), 3: XRF (ignore) + kind = "rotation" + if idx == 0: + kind = "raster" + elif idx == 1 or idx == 2: + kind = "rotation" + self.file_path_panel.set_scan_kind(kind) \ No newline at end of file