Skip to content

Commit 666d3b8

Browse files
committed
fix(processor): add refresh_plot parameter to auto_recompute_analysis method
1 parent 51dfa33 commit 666d3b8

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

datalab/gui/processor/base.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -945,7 +945,9 @@ def _handle_keep_results(self, result_obj: SignalObj | ImageObj) -> None:
945945
TableAdapter.remove_all_from(result_obj)
946946
GeometryAdapter.remove_all_from(result_obj)
947947

948-
def auto_recompute_analysis(self, obj: SignalObj | ImageObj) -> None:
948+
def auto_recompute_analysis(
949+
self, obj: SignalObj | ImageObj, refresh_plot: bool = True
950+
) -> None:
949951
"""Automatically recompute analysis (1-to-0) operations after data changes.
950952
951953
This method checks if the object has 1-to-0 analysis parameters (analysis
@@ -962,6 +964,7 @@ def auto_recompute_analysis(self, obj: SignalObj | ImageObj) -> None:
962964
963965
Args:
964966
obj: The object whose data was modified
967+
refresh_plot: Whether to refresh the plot after recomputation
965968
"""
966969
# Check if object has 1-to-0 analysis parameters (analysis operations)
967970
proc_params = extract_analysis_parameters(obj)
@@ -982,7 +985,8 @@ def auto_recompute_analysis(self, obj: SignalObj | ImageObj) -> None:
982985
# Update the view
983986
obj_uuid = get_uuid(obj)
984987
self.panel.objview.update_item(obj_uuid)
985-
self.panel.refresh_plot(obj_uuid, update_items=True, force=True)
988+
if refresh_plot:
989+
self.panel.refresh_plot(obj_uuid, update_items=True, force=True)
986990

987991
def __exec_func(
988992
self,
@@ -2390,8 +2394,13 @@ def edit_roi_graphically(
23902394
)
23912395
# Auto-recompute analysis operations for objects with modified ROIs
23922396
if mode == "apply":
2393-
for obj_i in objs:
2394-
self.auto_recompute_analysis(obj_i)
2397+
with create_progress_bar(
2398+
self.panel, _("Recomputing..."), max_=len(objs)
2399+
) as progress:
2400+
for idx, obj_i in enumerate(objs):
2401+
progress.setValue(idx)
2402+
self.auto_recompute_analysis(obj_i, refresh_plot=False)
2403+
self.panel.manual_refresh()
23952404
return edited_roi
23962405

23972406
def edit_roi_numerically(self) -> TypeROI:

0 commit comments

Comments
 (0)