From 8a1585f2cf88da8c51a80bde3114e1023539fb17 Mon Sep 17 00:00:00 2001 From: Kenneth Hoste Date: Sat, 16 Oct 2021 13:48:36 +0200 Subject: [PATCH] put app progress in panel, speed things up --- examples/dynamic_progress.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/examples/dynamic_progress.py b/examples/dynamic_progress.py index d45bb377..a1101928 100644 --- a/examples/dynamic_progress.py +++ b/examples/dynamic_progress.py @@ -9,6 +9,7 @@ each of which consisting of multiple steps. import time from rich.console import Group +from rich.panel import Panel from rich.live import Live from rich.progress import ( BarColumn, @@ -29,7 +30,7 @@ def run_steps(name, step_times, app_steps_task_id): # run steps, update progress for _ in range(step_time): - time.sleep(1) + time.sleep(0.5) step_progress.update(step_task_id, advance=1) # stop and hide progress bar for this step when done @@ -69,15 +70,15 @@ overall_progress = Progress( # group of progress bars; # some are always visible, others will disappear when progress is complete progress_group = Group( - current_app_progress, step_progress, app_steps_progress, overall_progress + Panel(Group(current_app_progress, step_progress, app_steps_progress)), overall_progress ) # tuple specifies how long each step takes for that app step_actions = ("downloading", "configuring", "building", "installing") apps = [ - ("one", (3, 2, 5, 3)), - ("two", (2, 5, 10, 6)), - ("three", (5, 1, 5, 3)), + ("one", (2, 1, 4, 2)), + ("two", (1, 3, 8, 4)), + ("three", (2, 1, 3, 2)), ] # create overall progress bar