Skip to content

Commit fccaee0

Browse files
authored
Merge pull request #175 from scipp/remove-progress-done
fix: remove progress when reduction is finished
2 parents 5c17fe9 + 992ce90 commit fccaee0

File tree

1 file changed

+11
-14
lines changed

1 file changed

+11
-14
lines changed

src/ess/reflectometry/gui.py

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,7 @@ def _init_runs_table_component(self):
481481
def _init_reduction_table_component(self):
482482
reduce_button = widgets.Button(description="Reduce")
483483
plot_button = widgets.Button(description="Plot")
484+
self.progress_log = widgets.VBox([])
484485

485486
def reduce_data(_):
486487
self.log("reduce data")
@@ -535,7 +536,7 @@ def delete_row(_):
535536

536537
add_row_button.on_click(add_row)
537538
delete_row_button.on_click(delete_row)
538-
data_buttons = widgets.HBox([reduce_button, plot_button])
539+
data_buttons = widgets.HBox([reduce_button, plot_button, self.progress_log])
539540

540541
self.reduction_table_component = widgets.VBox(
541542
[
@@ -563,19 +564,10 @@ def delete_row(_):
563564
)
564565

565566
def _init_display_component(self):
566-
self.progress_log = widgets.VBox([])
567567
self.plot_log = widgets.VBox([])
568568
self.display_component = widgets.VBox(
569-
[
570-
widgets.VBox(
571-
[widgets.Label("Progress"), self.progress_log],
572-
layout={'width': '100%', 'margin': '10px 0'},
573-
),
574-
widgets.VBox(
575-
[widgets.Label("Plots"), self.plot_log],
576-
layout={'width': '100%', 'margin': '10px 0'},
577-
),
578-
]
569+
[widgets.Label("Plots"), self.plot_log],
570+
layout={'width': '100%', 'margin': '10px 0'},
579571
)
580572

581573
def _init_settings_component(self):
@@ -701,9 +693,12 @@ def log_text(self, message):
701693
display(message)
702694
self.text_log.children = (out, *self.text_log.children)
703695

704-
def log_progress(self, progress):
696+
def show_progress(self, progress):
705697
self.progress_log.children = (progress,)
706698

699+
def hide_progress(self):
700+
self.progress_log.children = ()
701+
707702

708703
class AmorBatchReductionGUI(ReflectometryBatchReductionGUI):
709704
def __init__(self):
@@ -988,7 +983,7 @@ def run_workflow(self):
988983
workflow[ChopperPhase[SampleRun]] = sc.scalar(7.5, unit='deg')
989984

990985
progress = widgets.IntProgress(min=0, max=len(sample_df) + len(used_references))
991-
self.log_progress(progress)
986+
self.show_progress(progress)
992987

993988
for _, params in sample_df.iterrows():
994989
if (key := self.get_row_key(params)) in self.results:
@@ -1062,3 +1057,5 @@ def run_workflow(self):
10621057
params, params["Scale"] * wf.compute(ReflectivityOverQ).hist()
10631058
)
10641059
progress.value += 1
1060+
1061+
self.hide_progress()

0 commit comments

Comments
 (0)