From 60286c8248e660f6c3bd015da37a8f2db108e879 Mon Sep 17 00:00:00 2001 From: x12sa Date: Thu, 29 Jan 2026 11:33:57 +0100 Subject: [PATCH] wip adjusting to V3 --- .../plugins/flomni/gui_tools.py | 27 +++++++++--------- .../plugins/flomni/x_ray_eye_align.py | 8 +++--- .../plugins/omny/gui_tools.py | 2 +- .../bec_widgets/widgets/xray_eye/x_ray_eye.py | 14 ++++++---- csaxs_bec/device_configs/ptycho_flomni.yaml | 28 +++++++++---------- 5 files changed, 42 insertions(+), 37 deletions(-) diff --git a/csaxs_bec/bec_ipython_client/plugins/flomni/gui_tools.py b/csaxs_bec/bec_ipython_client/plugins/flomni/gui_tools.py index 1f0d06d..2f0491d 100644 --- a/csaxs_bec/bec_ipython_client/plugins/flomni/gui_tools.py +++ b/csaxs_bec/bec_ipython_client/plugins/flomni/gui_tools.py @@ -1,6 +1,6 @@ import builtins -from bec_widgets.cli.client import BECDockArea +from bec_widgets.cli.client import AdvancedDockArea # from csaxs_bec.bec_ipython_client.plugins.cSAXS import epics_get, epics_put, fshopen, fshclose @@ -26,10 +26,11 @@ class flomniGuiTools: self.gui = self.client.gui def flomnigui_show_gui(self): - if "flomni" in self.gui.windows: - self.gui.flomni.show() - else: - self.gui.new("flomni") + self.gui.new("flomni") + # if "flomni" in self.gui.windows: + # self.gui.flomni.show() + # else: + # self.gui.new("flomni") def flomnigui_stop_gui(self): self.gui.flomni.hide() @@ -41,7 +42,7 @@ class flomniGuiTools: self.flomnigui_show_gui() if self._flomnigui_check_attribute_not_exists("xeyegui"): self.flomnigui_remove_all_docks() - self.xeyegui = self.gui.flomni.new("xeyegui").new("XRayEye") + self.xeyegui = self.gui.flomni.new("XRayEye",object_name='xrayeye') # start live if not dev.cam_xeye.live_mode_enabled.get(): # dev.cam_xeye.live_mode = True @@ -52,7 +53,7 @@ class flomniGuiTools: self.flomnigui_show_gui() if self._flomnigui_check_attribute_not_exists("xeyegui"): self.flomnigui_remove_all_docks() - self.xeyegui = self.gui.flomni.new("xeyegui").new("XRayEye") + self.xeyegui = self.gui.flomni.new("XRayEye") self.xeyegui.switch_tab('fit') def _flomnigui_check_attribute_not_exists(self, attribute_name): @@ -66,7 +67,7 @@ class flomniGuiTools: self.flomnigui_show_gui() if self._flomnigui_check_attribute_not_exists("camera_gripper") or self._flomnigui_check_attribute_not_exists("camera_overview"): self.flomnigui_remove_all_docks() - camera_gripper_image = self.gui.flomni.new("camera_gripper").new("Image") + camera_gripper_image = self.gui.flomni.new("Image") if self._flomnicam_check_device_exists(dev.cam_flomni_gripper): camera_gripper_image.image(("cam_flomni_gripper", "preview")) camera_gripper_image.lock_aspect_ratio = True @@ -77,7 +78,7 @@ class flomniGuiTools: dev.cam_flomni_gripper.start_live_mode() else: print("Cannot open camera_gripper. Device does not exist.") - camera_overview_image = self.gui.flomni.new("camera_overview").new("Image") + camera_overview_image = self.gui.flomni.new("Image") if self._flomnicam_check_device_exists(dev.cam_flomni_overview): camera_overview_image.image(("cam_flomni_overview", "preview")) camera_overview_image.lock_aspect_ratio = True @@ -101,7 +102,7 @@ class flomniGuiTools: self.flomnigui_show_gui() if self._flomnigui_check_attribute_not_exists("idle_text_box"): self.flomnigui_remove_all_docks() - idle_text_box = self.gui.flomni.new("idle_textbox").new("TextBox") + idle_text_box = self.gui.flomni.new("TextBox") text = ( "
"
             + " ,---.,--. ,-----. ,--.   ,--.,--.  ,--.,--. \n"
@@ -161,7 +162,7 @@ class flomniGuiTools:
             self.pdf_viewer = self.gui.flomni.new(widget="PdfViewerWidget")
 
         # --- Load PDF ---------------------------------------------------------
-        self.pdf_viewer.PdfViewerWidget.load_pdf(str(pdf_file.resolve()))
+        self.PdfViewerWidget.load_pdf(str(pdf_file.resolve()))
         print(f"\nLoaded: {pdf_file.name}\n")
 
 
@@ -178,7 +179,7 @@ class flomniGuiTools:
         if self._flomnigui_check_attribute_not_exists("progressbar"):
             self.flomnigui_remove_all_docks()
             # Add a new dock with a RingProgressBar widget
-            self.progressbar = self.gui.flomni.new("progressbar").new("RingProgressBar")
+            self.progressbar = self.gui.flomni.new("RingProgressBar")
             # Customize the size of the progress ring
             self.progressbar.set_line_widths(20)
             # Disable automatic updates and manually set the self.progressbar value
@@ -193,7 +194,7 @@ class flomniGuiTools:
             # Set the values of the rings to 50, 75, and 25 from outer to inner ring
             # self.progressbar.set_value([50, 75])
             # Add a new dock with a TextBox widget
-            self.text_box = self.gui.flomni.new(name="progress_text").new("TextBox")
+            self.text_box = self.gui.flomni.new("TextBox")
 
         self._flomnigui_update_progress()
 
diff --git a/csaxs_bec/bec_ipython_client/plugins/flomni/x_ray_eye_align.py b/csaxs_bec/bec_ipython_client/plugins/flomni/x_ray_eye_align.py
index 0581dc8..b2058c5 100644
--- a/csaxs_bec/bec_ipython_client/plugins/flomni/x_ray_eye_align.py
+++ b/csaxs_bec/bec_ipython_client/plugins/flomni/x_ray_eye_align.py
@@ -46,7 +46,7 @@ class XrayEyeAlign:
 
     def update_frame(self, keep_shutter_open=False):
 
-        self.flomni.flomnigui_show_xeyealign()
+        # self.flomni.flomnigui_show_xeyealign()
         if not dev.cam_xeye.live_mode_enabled.get():
             dev.cam_xeye.live_mode_enabled.put(True)
 
@@ -110,8 +110,8 @@ class XrayEyeAlign:
 
         self.flomni.lights_off()
 
-        self.flomni.flomnigui_show_xeyealign()
-        self.flomni.flomnigui_raise()
+        # self.flomni.flomnigui_show_xeyealign()
+        # self.flomni.flomnigui_raise()
 
         if not self.test_wo_movements:
             self.tomo_rotate(0)
@@ -280,4 +280,4 @@ class XrayEyeAlign:
         self.gui.submit_fit_array(data)
         print(f"fit submited with {data}")
         print("todo mirko: submitted data is 1000 fold in amplitude")
-        self.flomni.flomnigui_show_xeyealign_fittab()
+        # self.flomni.flomnigui_show_xeyealign_fittab()
diff --git a/csaxs_bec/bec_ipython_client/plugins/omny/gui_tools.py b/csaxs_bec/bec_ipython_client/plugins/omny/gui_tools.py
index 2ce910f..8a064d4 100644
--- a/csaxs_bec/bec_ipython_client/plugins/omny/gui_tools.py
+++ b/csaxs_bec/bec_ipython_client/plugins/omny/gui_tools.py
@@ -1,6 +1,6 @@
 import builtins
 
-from bec_widgets.cli.client import BECDockArea
+from bec_widgets.cli.client import AdvancedDockArea
 
 # from csaxs_bec.bec_ipython_client.plugins.cSAXS import epics_get, epics_put, fshopen, fshclose
 
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 5e89213..78d516b 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
@@ -376,11 +376,11 @@ class XRayEye(BECWidget, QWidget):
         self.live_preview_toggle.blockSignals(True)
         if enabled:
             self.live_preview_toggle.checked = enabled
-            self.image.image(CAMERA)
+            self.image.image(device_name=CAMERA[0],device_entry=CAMERA[1])
             self.live_preview_toggle.blockSignals(False)
             return
 
-        self.image.disconnect_monitor(CAMERA)
+        self.image.disconnect_monitor(CAMERA[0],CAMERA[1])
         self.live_preview_toggle.checked = enabled
         self.live_preview_toggle.blockSignals(False)
 
@@ -473,10 +473,12 @@ class XRayEye(BECWidget, QWidget):
    
     @SafeSlot()
     def submit_fit_array(self,fit_array):
-
+        self.tab_widget.setCurrentIndex(1)
+        # self.fix_x.title = " got fit array"
         print(f"got fit array {fit_array}")
-        self.fit_x.set_data(x=fit_array[0],y=fit_array[1])
-        self.fit_y.set_data(x=fit_array[0],y=fit_array[2])
+        self.waveform_x.curves[0].set_data(x=fit_array[0],y=fit_array[1])
+        # self.fit_x.set_data(x=fit_array[0],y=fit_array[1])
+        # self.fit_y.set_data(x=fit_array[0],y=fit_array[2])
 
 
     @SafeSlot()
@@ -524,8 +526,10 @@ if __name__ == "__main__":
 
     from qtpy.QtWidgets import QApplication
     from bec_widgets.utils import BECDispatcher
+    from bec_widgets.utils.colors import apply_theme
 
     app = QApplication(sys.argv)
+    apply_theme("light")
     dispatcher = BECDispatcher(gui_id='xray')
     win = XRayEye()
 
diff --git a/csaxs_bec/device_configs/ptycho_flomni.yaml b/csaxs_bec/device_configs/ptycho_flomni.yaml
index 8e5122f..1c5d367 100644
--- a/csaxs_bec/device_configs/ptycho_flomni.yaml
+++ b/csaxs_bec/device_configs/ptycho_flomni.yaml
@@ -408,20 +408,20 @@ cam_xeye:
   readOnly: false
   readoutPriority: async
 
-cam_ids_rgb:
-  description: Camera flOMNI Xray eye ID203
-  deviceClass: csaxs_bec.devices.ids_cameras.ids_camera.IDSCamera
-  deviceConfig:
-    camera_id: 203
-    bits_per_pixel: 24
-    num_rotation_90: 2
-    transpose: false
-    force_monochrome: false
-    m_n_colormode: 1
-  enabled: true
-  onFailure: buffer
-  readOnly: false
-  readoutPriority: async
+# cam_ids_rgb:
+#   description: Camera flOMNI Xray eye ID203
+#   deviceClass: csaxs_bec.devices.ids_cameras.ids_camera.IDSCamera
+#   deviceConfig:
+#     camera_id: 203
+#     bits_per_pixel: 24
+#     num_rotation_90: 2
+#     transpose: false
+#     force_monochrome: false
+#     m_n_colormode: 1
+#   enabled: true
+#   onFailure: buffer
+#   readOnly: false
+#   readoutPriority: async
 
 
 # ############################################################