Skip to content

Commit b1544f0

Browse files
committed
Improve progress bar label during processing by showing current progress out of total objects and parameters
1 parent 4735b78 commit b1544f0

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

datalab/gui/processor/base.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1085,17 +1085,16 @@ def _compute_1_to_1_subroutine(
10851085
assert len(funcs) == len(params)
10861086
objs = self.panel.objview.get_sel_objects(include_groups=True)
10871087
grps = self.panel.objview.get_sel_groups()
1088+
n_glob = len(objs) * len(params)
10881089
new_gids = {}
1089-
with create_progress_bar(
1090-
self.panel, title, max_=len(objs) * len(params)
1091-
) as progress:
1090+
with create_progress_bar(self.panel, title, max_=n_glob) as progress:
10921091
for i_row, obj in enumerate(objs):
10931092
for i_param, (param, func) in enumerate(zip(params, funcs)):
10941093
name = func.__name__
1095-
i_title = f"{title} ({i_row + 1}/{len(objs)})"
1096-
progress.setLabelText(i_title)
10971094
pvalue = (i_row + 1) * (i_param + 1)
10981095
pvalue = 0 if pvalue == 1 else pvalue
1096+
i_title = f"{title} ({pvalue}/{n_glob})"
1097+
progress.setLabelText(i_title)
10991098
progress.setValue(pvalue)
11001099
args = (obj,) if param is None else (obj, param)
11011100
result = self.__exec_func(func, args, progress)

0 commit comments

Comments
 (0)