Coverage for src/fsl_pipe_gui/summary.py: 22%
23 statements
« prev ^ index » next coverage.py v7.2.7, created at 2023-07-11 11:06 +0100
« prev ^ index » next coverage.py v7.2.7, created at 2023-07-11 11:06 +0100
1"""Displays summary of what will be run using Rich."""
2from rich import print
3from rich.columns import Columns
4from rich.prompt import Confirm
6from .all_panes import AllPanes, PipelineSelector
9def show_summary(selector: PipelineSelector):
10 """
11 Display summary of what will be run using Rich.
13 Will ask confirmation of whether to continue.
14 """
15 if len(selector.all_jobs[0]) == 0:
16 if len(selector.selected_files) == 0:
17 print("No output files were selected, so the pipeline cannot be run.\n")
18 else:
19 print("All output files for selected templates already exists.\n")
20 if Confirm.ask(
21 "Do you want to return to the selector pane to select output files?"
22 ):
23 return AllPanes.SELECTOR
24 return None
26 print("[b]Selected output files[/b]")
27 print(Columns(sorted(selector.selected_files)))
29 print("")
30 print("[b]Pipeline report[/b]")
31 selector.job_list.report()
33 print("")
34 print("[b]Jobs[/b]")
35 print(Columns(sorted([str(job) for job in selector.all_jobs[0]])))
36 if Confirm.ask("Do you want to run this pipeline?"):
37 return AllPanes.RUN
38 return AllPanes.SELECTOR