diff --git a/csaxs_bec/bec_widgets/widgets/xray_eye/x_ray_eye.py b/csaxs_bec/bec_widgets/widgets/xray_eye/x_ray_eye.py index 6ed7758d..e170f304 100644 --- a/csaxs_bec/bec_widgets/widgets/xray_eye/x_ray_eye.py +++ b/csaxs_bec/bec_widgets/widgets/xray_eye/x_ray_eye.py @@ -580,15 +580,11 @@ class OMNY_XRayEye(BECWidget, QWidget): self._update_calibration_readout() self.control_panel_layout.addLayout(form) - # Fix panel width and allow vertical expansion. The actual width-fixing - # is deferred (see _fix_control_panel_width()) rather than computed - # here -- sizeHint() called before the widget has ever been shown/laid - # out is unreliable (no real screen geometry yet, fonts not fully - # resolved -- worse over a remote desktop session), which froze - # control_panel at a wrong width until the operator manually resized - # the window (forcing Qt to redo layout with correct geometry). + # Fix panel width and allow vertical expansion + self.control_panel.adjustSize() + p_hint = self.control_panel.sizeHint() + self.control_panel.setFixedWidth(p_hint.width()) self.control_panel.setSizePolicy(QSizePolicy.Policy.Fixed, QSizePolicy.Policy.Expanding) - QTimer.singleShot(0, self._fix_control_panel_width) # Core Layout: image (expanding) | control panel (fixed) self.core_layout.addWidget(self.image) @@ -745,14 +741,6 @@ class OMNY_XRayEye(BECWidget, QWidget): sep.setLineWidth(1) return sep - def _fix_control_panel_width(self): - """Lock the control panel to its natural width. Scheduled via - QTimer.singleShot(0, ...) from _init_ui() to run on the next event-loop - iteration, after the widget has actually been shown/laid out at least - once -- sizeHint() is not reliable before that point.""" - self.control_panel.adjustSize() - self.control_panel.setFixedWidth(self.control_panel.sizeHint().width()) - def _init_gui_trigger(self): self.dev.omny_xray_gui.read() self.dev.fsh.read()