From 90e0fe039d405a95a0a82f255f0647677b5deb65 Mon Sep 17 00:00:00 2001 From: x01dc Date: Mon, 27 Jul 2026 10:11:03 +0200 Subject: [PATCH] fix(LamNI): open X-ray eye GUI widget in update_frame() if not already open update_frame() (reached via lamni.leye_in() -> xrayeye_update_frame()) used self.gui (lamni.xeyegui) directly, but that's None until the widget has been opened by lamnigui_show_xeyealign() -- which align() and find_rotation_center() call first, but update_frame() never did. If it's the first X-ray-eye call of a session, this raised AttributeError: 'NoneType' object has no attribute 'on_live_view_enabled'. Co-Authored-By: Claude Sonnet 5 --- .../bec_ipython_client/plugins/LamNI/x_ray_eye_align.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/csaxs_bec/bec_ipython_client/plugins/LamNI/x_ray_eye_align.py b/csaxs_bec/bec_ipython_client/plugins/LamNI/x_ray_eye_align.py index 9abe225..c9a3fcd 100644 --- a/csaxs_bec/bec_ipython_client/plugins/LamNI/x_ray_eye_align.py +++ b/csaxs_bec/bec_ipython_client/plugins/LamNI/x_ray_eye_align.py @@ -144,6 +144,12 @@ class XrayEyeAlign: it is hard to locate the sample between rotations. The caller is responsible for closing the shutter afterwards. """ + # self.gui is lamni.xeyegui, which is None until the widget has been + # opened at least once -- unlike align()/find_rotation_center(), this + # is often the first X-ray-eye call of a session (see leye_in()), so + # it must open the widget itself rather than assume it already exists. + if self.gui is None: + self.lamni.lamnigui_show_xeyealign() if not dev.cam_xeye.live_mode_enabled.get(): dev.cam_xeye.live_mode_enabled.put(True) self.gui.on_live_view_enabled(True) -- 2.54.0