feat: bound Set Energy to a 4-20 keV placeholder range

Both Set Energy rows allowed 1-30 keV, an arbitrary spinbox default;
nothing downstream validates the request (daq.change_energy forwards
straight to bec). Shared ENERGY_MIN/MAX_KEV constants now bound both
spins to 4-20 keV with a tooltip flagging the range as pending
Beamline Scientist confirmation.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
duan_jandClaude Fable 5 authored and duan_j committed 2026-08-24 13:40:03 +02:00
1 parent adc8514174
commit 4bed16e7b4
4 files changed
+30 -2

No files matched your search

@@ -351,6 +351,11 @@ def test_db_override_source_toggle_clears_pending(qapp, qtbot):
def test_energy_spin_pending_until_change_energy(settings_panel):
# same placeholder limits as the Beamline setup row (shared constants)
assert settings_panel.energy_spin.minimum() == 4.0
assert settings_panel.energy_spin.maximum() == 20.0
assert "Beamline Scientist" in settings_panel.energy_spin.toolTip()
box = settings_panel.energy_spin.lineEdit()
settings_panel.energy_spin.setValue(12.4)
assert box.property("movestate") == "pending"
@@ -36,3 +36,13 @@ def test_fast_shutter_row(qtbot, daq_status_factory):
panel.open_shutter_button.click()
with qtbot.waitSignal(panel.close_shutter, timeout=1000):
panel.close_shutter_button.click()
def test_energy_spin_placeholder_limits(qtbot):
# 4-20 keV is a placeholder pending Beamline Scientist confirmation; the
# tooltip must say so because nothing downstream validates the request.
panel = MonochromatorPanel()
qtbot.addWidget(panel)
assert panel.energy_spin.minimum() == 4.0
assert panel.energy_spin.maximum() == 20.0
assert "Beamline Scientist" in panel.energy_spin.toolTip()