From b2db41088725f6dbaadbaeccde47811e3313d7a4 Mon Sep 17 00:00:00 2001 From: hitz_s Date: Thu, 11 Jun 2026 10:34:34 +0200 Subject: [PATCH] Add manual beamline selection (for development) --- .../widgets/digital_twin/digital_twin.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/debye_bec/bec_widgets/widgets/digital_twin/digital_twin.py b/debye_bec/bec_widgets/widgets/digital_twin/digital_twin.py index 41b8833..03d1ba9 100644 --- a/debye_bec/bec_widgets/widgets/digital_twin/digital_twin.py +++ b/debye_bec/bec_widgets/widgets/digital_twin/digital_twin.py @@ -136,7 +136,7 @@ class DigitalTwin(BECWidget, QWidget): widget_layout.setSpacing(0) widget_layout.addWidget(self.content_widget) self.setWindowTitle("Digital Twin") - self.resize(1450, 760) + self.resize(1450, 950) self.input.energy.value_changed_connect(self.calc_assistant) self.input.sldi_hacc.value_changed_connect(self.calc_assistant) @@ -219,7 +219,17 @@ class DigitalTwin(BECWidget, QWidget): case _: raise ValueError(f"Not implemented beamline {beamline}") else: - raise ValueError(f"Failed to extract beamline from bec server hostname {bec_hostname}") + logger.warning(f"Failed to extract beamline from bec server hostname {bec_hostname}") + choice = input("Do you want to manually select a beamline? (yes/no): ").strip().lower() + if choice in ["yes", "y"]: + bl = input(f"Choose from: {[bl.value for bl in BeamlineId]}") + if bl in BeamlineId: + logger.info(f'Manually selected beamline {bl}') + return BeamlineId(bl) + else: + raise ValueError(f'Wrong selection {bl}') + else: + raise ValueError('Cannot open digital twin without a beamline') @SafeSlot() def check_bec_config(self, *args):