From b210f1cb50dfc22ffd1d2190c3f055df5aaf3126 Mon Sep 17 00:00:00 2001 From: wyzula-jan Date: Tue, 3 Mar 2026 16:17:36 +0100 Subject: [PATCH] WIP flomni gui_tools progress update migrated --- .../plugins/flomni/gui_tools.py | 31 +++++++++---------- 1 file changed, 15 insertions(+), 16 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 526d12a..47a774a 100644 --- a/csaxs_bec/bec_ipython_client/plugins/flomni/gui_tools.py +++ b/csaxs_bec/bec_ipython_client/plugins/flomni/gui_tools.py @@ -27,11 +27,10 @@ class flomniGuiTools: self.gui = self.client.gui def flomnigui_show_gui(self): - self.gui.new("flomni") - # if "flomni" in self.gui.windows: - # self.gui.flomni.show() - # else: - # self.gui.new("flomni") + if "flomni" in self.gui.windows: + self.gui.flomni.raise_window() + else: + self.gui.new("flomni") def flomnigui_stop_gui(self): self.gui.flomni.hide() @@ -180,17 +179,14 @@ class flomniGuiTools: self.flomnigui_remove_all_docks() # Add a new dock with a RingProgressBar widget 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 - self.progressbar.enable_auto_updates(False) + # # Disable automatic updates and manually set the self.progressbar value + # self.progressbar.enable_auto_updates(False) # Set precision for the self.progressbar display - self.progressbar.set_precision(1) # Display self.progressbar with one decimal places - # Setting multiple rigns with different values - self.progressbar.set_number_of_bars(3) - self.progressbar.rings[0].set_update("manual") - self.progressbar.rings[1].set_update("manual") - self.progressbar.rings[2].set_update("scan") + # self.progressbar.set_precision(1) # Display self.progressbar with one decimal places + # Setting multiple rings with different values + self.progressbar.add_ring().set_update("manual") + self.progressbar.add_ring().set_update("manual") + self.progressbar.add_ring().set_update("scan") # 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 @@ -199,6 +195,8 @@ class flomniGuiTools: self._flomnigui_update_progress() def _flomnigui_update_progress(self): + main_progress_ring = self.progressbar.rings[0] + subtomo_progress_ring = self.progressbar.rings[1] if self.progressbar is not None: progress = self.progress["projection"] / self.progress["total_projections"] * 100 subtomo_progress = ( @@ -206,7 +204,8 @@ class flomniGuiTools: / self.progress["subtomo_total_projections"] * 100 ) - self.progressbar.set_value([progress, subtomo_progress, 0]) + main_progress_ring.set_value(progress) + subtomo_progress_ring.set_value(subtomo_progress) if self.text_box is not None: text = f"Progress report:\n Tomo type: ....................... {self.progress['tomo_type']}\n Projection: ...................... {self.progress['projection']:.0f}\n Total projections expected ....... {self.progress['total_projections']}\n Angle: ........................... {self.progress['angle']}\n Current subtomo: ................. {self.progress['subtomo']}\n Current projection within subtomo: {self.progress['subtomo_projection']}\n Total projections per subtomo: ... {self.progress['subtomo_total_projections']}" self.text_box.set_plain_text(text)