Files
BA-AD/baad/helpers/progress.py
ヒヤシンス d4b9e8530d restructured: init
- refactored entire codebase
- remove --category
- remove --version
- docs: updated tutorial
- docs: readme update
- renamed files to proper python style guide
- replace old crypto with ba-cy
- moved images to .github/resources
- moved extractors to its own folder (extractors)
- renamed lib to crypto
- moved some functions to its own helper
- added helper scripts
2025-06-14 20:52:12 +08:00

40 lines
1.2 KiB
Python

from rich.console import Console, Group
from rich.live import Live
from rich.progress import BarColumn, DownloadColumn, Progress, TextColumn, TimeRemainingColumn, TransferSpeedColumn
def create_progress_group() -> tuple:
console = Console()
print_progress = Progress(TextColumn('{task.description}'), console=console)
download_progress = Progress(
TextColumn('[bold blue]{task.description}', justify='right'),
BarColumn(bar_width=None, finished_style='green'),
'[progress.percentage]{task.percentage:>3.1f}%',
'',
DownloadColumn(),
'',
TransferSpeedColumn(),
'',
TimeRemainingColumn(),
expand=True,
)
extract_progress = Progress(
TextColumn('[bold green]{task.description}', justify='right'),
BarColumn(bar_width=None, finished_style='green'),
'[progress.percentage]{task.percentage:>3.1f}%',
'',
TimeRemainingColumn(),
expand=True,
)
progress_group = Group(print_progress, download_progress, extract_progress)
return progress_group, download_progress, extract_progress, print_progress, console
def create_live_display() -> Live:
return Live(create_progress_group()[0], refresh_per_second=10)