From 8a1951766b00c1ca7ee4b5f0f8f151c9688b78f5 Mon Sep 17 00:00:00 2001 From: Holler Mirko Date: Thu, 7 Nov 2024 12:09:14 +0100 Subject: [PATCH] fixes --- .../plugins/omny/gui_tools.py | 24 ++++++++++++------- .../bec_ipython_client/plugins/omny/omny.py | 5 ++-- 2 files changed, 18 insertions(+), 11 deletions(-) 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 16aafd1..328b8b8 100644 --- a/csaxs_bec/bec_ipython_client/plugins/omny/gui_tools.py +++ b/csaxs_bec/bec_ipython_client/plugins/omny/gui_tools.py @@ -29,7 +29,6 @@ class OMNYGuiToolsError(Exception): class OMNYGuiTools: - def __init__(self, client): self.gui = getattr(client, "gui", None) self.fig200 = None @@ -53,7 +52,7 @@ class OMNYGuiTools: self.gui.close() def _omnycam_parking(self): - self.gui_show_omnycam_parking() + self.omnygui_show_omnycam_parking() def omnygui_show_omnycam_parking(self): self.omnygui_start_gui() @@ -99,6 +98,10 @@ class OMNYGuiTools: self.gui.remove_dock(name="progress") except: pass + try: + self.gui.remove_dock(name="progress_text") + except: + pass self.fig200 = None self.fig201 = None self.fig202 = None @@ -118,10 +121,10 @@ class OMNYGuiTools: return True def _omnycam_samplestage(self): - self.gui_show_omnycam_samplestage() + self.omnygui_show_omnycam_samplestage() def omnygui_show_omnycam_samplestage(self): - self.start_gui() + self.omnygui_start_gui() if self.fig201 is None: self._omnycam_clear() self.fig201 = self.gui.add_dock(name="omnycam201").add_widget("BECImageWidget") @@ -144,7 +147,9 @@ class OMNYGuiTools: pass def omnygui_show_progress(self): + self.omnygui_start_gui() if self.progressbar is None: + self._omnycam_clear() # Add a new dock with a RingProgressBar widget self.progressbar = self.gui.add_dock(name="progress").add_widget("RingProgressBar") # Customize the size of the progress ring @@ -158,18 +163,19 @@ class OMNYGuiTools: # 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.add_dock().add_widget("TextBox") - # Set the text to display - self.text_box.set_plain_text("Progress:") + self.text_box = self.gui.add_dock(name="progress_text").add_widget("TextBox") try: self.gui.remove_dock(name="default_figure") except: pass + self._omnygui_update_progress() def _omnygui_update_progress(self): if self.progressbar is not None: - progress = self.progress["projection"] / self.progress['total_projections'] - subotmo_progress = self.progress['subtomo_projection'] / self.progress['subtomo_total_projections'] + progress = self.progress["projection"] / self.progress["total_projections"] + subotmo_progress = ( + self.progress["subtomo_projection"] / self.progress["subtomo_total_projections"] + ) self.progressbar.set_value([progress, subotmo_progress]) 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']}" diff --git a/csaxs_bec/bec_ipython_client/plugins/omny/omny.py b/csaxs_bec/bec_ipython_client/plugins/omny/omny.py index 7f2d957..d86d9bb 100644 --- a/csaxs_bec/bec_ipython_client/plugins/omny/omny.py +++ b/csaxs_bec/bec_ipython_client/plugins/omny/omny.py @@ -1153,8 +1153,9 @@ class OMNY( print(f"Angle: ........................... {self.progress['angle']}") print(f"Current subtomo: ................. {self.progress['subtomo']}") print(f"Current projection within subtomo: {self.progress['subtomo_projection']}") - print(f"Total projections per subtomo: ... {self.progress['subtomo_total_projections']}\x1b[0m") - + print( + f"Total projections per subtomo: ... {self.progress['subtomo_total_projections']}\x1b[0m" + ) def add_sample_database( self, samplename, date, eaccount, scan_number, setup, sample_additional_info, user