From 6590a65488d12a3763f889cbcbfa3417073b14ad Mon Sep 17 00:00:00 2001 From: x12sa Date: Wed, 17 Jun 2026 10:13:42 +0200 Subject: [PATCH] Automatic backup triggered by new deployment --- .../plugins/flomni/gui_tools.py | 94 +++++++++---------- 1 file changed, 47 insertions(+), 47 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 5d03537..a3a4995 100644 --- a/csaxs_bec/bec_ipython_client/plugins/flomni/gui_tools.py +++ b/csaxs_bec/bec_ipython_client/plugins/flomni/gui_tools.py @@ -231,56 +231,56 @@ class flomniGuiTools: client.get_global_var("tomo_progress") """ - 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 = ( - self.progress["subtomo_projection"] - / self.progress["subtomo_total_projections"] - * 100 - ) - main_progress_ring.set_value(progress) - subtomo_progress_ring.set_value(subtomo_progress) + # 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 = ( + # self.progress["subtomo_projection"] + # / self.progress["subtomo_total_projections"] + # * 100 + # ) + # main_progress_ring.set_value(progress) + # subtomo_progress_ring.set_value(subtomo_progress) - # --- format start time for display -------------------------------- - start_str = self.progress.get("tomo_start_time") - if start_str is not None: - import datetime as _dt - start_display = _dt.datetime.fromisoformat(start_str).strftime("%Y-%m-%d %H:%M:%S") + # --- format start time for display -------------------------------- + start_str = self.progress.get("tomo_start_time") + if start_str is not None: + import datetime as _dt + start_display = _dt.datetime.fromisoformat(start_str).strftime("%Y-%m-%d %H:%M:%S") + else: + start_display = "N/A" + + # --- format estimated remaining time ------------------------------ + remaining_s = self.progress.get("estimated_remaining_time") + if remaining_s is not None and remaining_s >= 0: + import datetime as _dt + remaining_s = int(remaining_s) + h, rem = divmod(remaining_s, 3600) + m, s = divmod(rem, 60) + if h > 0: + eta_display = f"{h}h {m:02d}m {s:02d}s" + elif m > 0: + eta_display = f"{m}m {s:02d}s" else: - start_display = "N/A" + eta_display = f"{s}s" + else: + eta_display = "N/A" + # ------------------------------------------------------------------ - # --- format estimated remaining time ------------------------------ - remaining_s = self.progress.get("estimated_remaining_time") - if remaining_s is not None and remaining_s >= 0: - import datetime as _dt - remaining_s = int(remaining_s) - h, rem = divmod(remaining_s, 3600) - m, s = divmod(rem, 60) - if h > 0: - eta_display = f"{h}h {m:02d}m {s:02d}s" - elif m > 0: - eta_display = f"{m}m {s:02d}s" - else: - eta_display = f"{s}s" - else: - eta_display = "N/A" - # ------------------------------------------------------------------ - - text = ( - f"Progress report:\n" - f" Tomo type: {self.progress['tomo_type']}\n" - f" Projection: {self.progress['projection']:.0f}\n" - f" Total projections expected {self.progress['total_projections']:.1f}\n" - f" Angle: {self.progress['angle']:.1f}\n" - f" Current subtomo: {self.progress['subtomo']}\n" - f" Current projection within subtomo: {self.progress['subtomo_projection']}\n" - f" Total projections per subtomo: {int(self.progress['subtomo_total_projections'])}\n" - f" Scan started: {start_display}\n" - f" Est. remaining: {eta_display}" - ) - self.progressbar.set_center_label(text) + text = ( + f"Progress report:\n" + f" Tomo type: {self.progress['tomo_type']}\n" + f" Projection: {self.progress['projection']:.0f}\n" + f" Total projections expected {self.progress['total_projections']:.1f}\n" + f" Angle: {self.progress['angle']:.1f}\n" + f" Current subtomo: {self.progress['subtomo']}\n" + f" Current projection within subtomo: {self.progress['subtomo_projection']}\n" + f" Total projections per subtomo: {int(self.progress['subtomo_total_projections'])}\n" + f" Scan started: {start_display}\n" + f" Est. remaining: {eta_display}" + ) + # self.progressbar.set_center_label(text) if __name__ == "__main__":