WIP flomni gui_tools progress update migrated

This commit is contained in:
2026-03-03 16:17:36 +01:00
parent e2ab447c8d
commit b210f1cb50

View File

@@ -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)