diff --git a/src/aare/gui/panels/data_collection_settings.py b/src/aare/gui/panels/data_collection_settings.py index 271f5999..167d53ce 100644 --- a/src/aare/gui/panels/data_collection_settings.py +++ b/src/aare/gui/panels/data_collection_settings.py @@ -85,6 +85,17 @@ class DataCollectionSettings(QFrame): centering_layout.addWidget(self.find_tip) centering_layout.addWidget(self.bounding_box) + # Live readout mirrored from the Beamline setup panel, same reason: + # "what is" and "what to set" must not share one ambiguous row. + # Fed per DAQ tick in update_daq_status. + self.current_energy_label = QLabel("—", parent=self) + current_energy_row = QWidget(self) + current_energy_layout = QHBoxLayout(current_energy_row) + current_energy_layout.setContentsMargins(0, 0, 0, 0) + current_energy_layout.addWidget(QLabel("Current energy / λ", parent=current_energy_row)) + current_energy_layout.addWidget(self.current_energy_label) + current_energy_layout.addStretch() + # Energy row copied from the Beamline setup panel so users can change # energy without leaving the experiment configuration. self.energy_spin = QDoubleSpinBox(parent=self) @@ -110,6 +121,7 @@ class DataCollectionSettings(QFrame): # border, and the Abort button should hug the pane. pane_layout.setContentsMargins(6, 6, 6, 0) pane_layout.addWidget(centering_row) + pane_layout.addWidget(current_energy_row) pane_layout.addWidget(energy_row) pane_layout.addWidget(self._stack) @@ -182,6 +194,17 @@ class DataCollectionSettings(QFrame): @Slot(DAQStatusModel) def update_daq_status(self, s: DAQStatusModel): + energy = s.diffraction.energy_keV + # 0.0 is the server's detector-unavailable fallback, and the + # wavelength property divides by it — guard before touching it. + if not energy: + text = "— / —" + else: + text = f"{energy:.3f} keV / {s.diffraction.wavelength_angstrom:.4f} Å" + # Guarded: runs per DAQ tick (2 Hz), skip the repaint when unchanged. + if self.current_energy_label.text() != text: + self.current_energy_label.setText(text) + self.raster.update_daq_status(s) self.screening.update_daq_status(s) self.simple.update_daq_status(s)