This commit is contained in:
Holler Mirko
2024-11-07 12:09:14 +01:00
parent a70c4588a0
commit 8a1951766b
2 changed files with 18 additions and 11 deletions
@@ -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']}"
@@ -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