Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 11 additions & 14 deletions src/ess/reflectometry/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,7 @@ def _init_runs_table_component(self):
def _init_reduction_table_component(self):
reduce_button = widgets.Button(description="Reduce")
plot_button = widgets.Button(description="Plot")
self.progress_log = widgets.VBox([])

def reduce_data(_):
self.log("reduce data")
Expand Down Expand Up @@ -535,7 +536,7 @@ def delete_row(_):

add_row_button.on_click(add_row)
delete_row_button.on_click(delete_row)
data_buttons = widgets.HBox([reduce_button, plot_button])
data_buttons = widgets.HBox([reduce_button, plot_button, self.progress_log])

self.reduction_table_component = widgets.VBox(
[
Expand Down Expand Up @@ -563,19 +564,10 @@ def delete_row(_):
)

def _init_display_component(self):
self.progress_log = widgets.VBox([])
self.plot_log = widgets.VBox([])
self.display_component = widgets.VBox(
[
widgets.VBox(
[widgets.Label("Progress"), self.progress_log],
layout={'width': '100%', 'margin': '10px 0'},
),
widgets.VBox(
[widgets.Label("Plots"), self.plot_log],
layout={'width': '100%', 'margin': '10px 0'},
),
]
[widgets.Label("Plots"), self.plot_log],
layout={'width': '100%', 'margin': '10px 0'},
)

def _init_settings_component(self):
Expand Down Expand Up @@ -701,9 +693,12 @@ def log_text(self, message):
display(message)
self.text_log.children = (out, *self.text_log.children)

def log_progress(self, progress):
def show_progress(self, progress):
self.progress_log.children = (progress,)

def hide_progress(self):
self.progress_log.children = ()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this going to move the UI elements around? Can the progress bar be placed somewhere where adding / removing it doesn't change the layout?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. I moved the progress bar next to the reduction buttons. That's going to make it not move things around, and it is probably also better UX because the progress bar shows up where you are looking when you press "Plot" or "Reduce".



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

progress = widgets.IntProgress(min=0, max=len(sample_df) + len(used_references))
self.log_progress(progress)
self.show_progress(progress)

for _, params in sample_df.iterrows():
if (key := self.get_row_key(params)) in self.results:
Expand Down Expand Up @@ -1062,3 +1057,5 @@ def run_workflow(self):
params, params["Scale"] * wf.compute(ReflectivityOverQ).hist()
)
progress.value += 1

self.hide_progress()
Loading