Skip to content

Commit

Permalink
Create Progress the way tqdm.rich made it
Browse files Browse the repository at this point in the history
  • Loading branch information
glensc committed Jan 6, 2024
1 parent 0800ebb commit 5c77e1a
Showing 1 changed file with 28 additions and 3 deletions.
31 changes: 28 additions & 3 deletions plextraktsync/rich/RichProgressBar.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,31 @@ def __exit__(self, *exc):

@cached_property
def progress(self):
from rich.progress import Progress

return Progress(**self.options)
from tqdm.rich import FractionColumn, RateColumn

from rich.progress import (BarColumn, Progress, TimeElapsedColumn,
TimeRemainingColumn)

args = (
"[progress.description]{task.description}"
"[progress.percentage]{task.percentage:>4.0f}%",
BarColumn(bar_width=None),
FractionColumn(
unit_scale=False,
unit_divisor=1000,
),
"[",
TimeElapsedColumn(),
"<",
TimeRemainingColumn(),
",",
RateColumn(
unit="it",
unit_scale=False,
unit_divisor=1000,
),
"]"
)
progress = Progress(*args, **self.options)

return progress

0 comments on commit 5c77e1a

Please sign in to comment.