added textbox to gui

This commit is contained in:
Holler Mirko
2024-11-07 11:40:49 +01:00
parent 55aa7128e2
commit a70c4588a0
2 changed files with 20 additions and 7 deletions

View File

@@ -37,6 +37,7 @@ class OMNYGuiTools:
self.fig202 = None
self.fig203 = None
self.progressbar = None
self.text_box = None
def omnygui_start_gui(self):
if self.gui is None or self.gui.gui_is_alive() is False:
@@ -46,6 +47,7 @@ class OMNYGuiTools:
self.fig201 = None
self.fig202 = None
self.fig203 = None
self.text_box = None
def omnygui_stop_gui(self):
self.gui.close()
@@ -102,6 +104,7 @@ class OMNYGuiTools:
self.fig202 = None
self.fig203 = None
self.progressbar = None
self.text_box = None
def _omnycam_clear(self):
self.omnygui_remove_all_docks()
@@ -151,9 +154,13 @@ class OMNYGuiTools:
# 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.set_number_of_bars(2)
# Set the values of the rings to 50, 75, and 25 from outer to inner ring
self.progressbar.set_value([50, 75, 25])
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:")
try:
self.gui.remove_dock(name="default_figure")
except:
@@ -161,5 +168,9 @@ class OMNYGuiTools:
def _omnygui_update_progress(self):
if self.progressbar is not None:
projection = self.progress["projection"]
self.progressbar.set_value([projection, 75, 25])
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']}"
self.text_box.set_plain_text(text)

View File

@@ -578,9 +578,9 @@ class OMNY(
self.progress = {}
self.progress["subtomo"] = 0
self.progress["subtomo_projection"] = 0
self.progress["subtomo_total_projections"] = 0
self.progress["subtomo_total_projections"] = 1
self.progress["projection"] = 0
self.progress["total_projections"] = 0
self.progress["total_projections"] = 1
self.progress["angle"] = 0
self.progress["tomo_type"] = 0
self.OMNYTools = OMNYTools(self.client)
@@ -1152,7 +1152,9 @@ class OMNY(
print(f"Total projections expected ....... {self.progress['total_projections']}")
print(f"Angle: ........................... {self.progress['angle']}")
print(f"Current subtomo: ................. {self.progress['subtomo']}")
print(f"Current projection within subtomo: {self.progress['subtomo_projection']}\x1b[0m")
print(f"Current projection within subtomo: {self.progress['subtomo_projection']}")
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