mirror of https://github.com/Textualize/rich.git
update progress fields
This commit is contained in:
parent
535fe42def
commit
108ce5ab56
|
@ -8,7 +8,7 @@ from urllib.request import urlopen
|
||||||
from rich.progress import bar_widget, Progress, TaskID
|
from rich.progress import bar_widget, Progress, TaskID
|
||||||
|
|
||||||
|
|
||||||
progress = Progress(bar_widget, "{task.percentage:0.1f}%", "{task.fields[filename]}")
|
progress = Progress(bar_widget, "{task.percentage:>3.0f}%", "{task.fields[filename]}")
|
||||||
|
|
||||||
|
|
||||||
def copy_url(task_id: TaskID, url: str, path: str) -> None:
|
def copy_url(task_id: TaskID, url: str, path: str) -> None:
|
||||||
|
|
|
@ -141,6 +141,7 @@ class Progress:
|
||||||
task.completed = completed
|
task.completed = completed
|
||||||
if visible is not None:
|
if visible is not None:
|
||||||
task.visible = True
|
task.visible = True
|
||||||
|
task.fields.update(fields)
|
||||||
|
|
||||||
def refresh(self) -> None:
|
def refresh(self) -> None:
|
||||||
"""Refresh (render) the progress information."""
|
"""Refresh (render) the progress information."""
|
||||||
|
|
|
@ -457,7 +457,7 @@ class Table:
|
||||||
yield new_line
|
yield new_line
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__": # pragma: no cover
|
if __name__ == "__main__":
|
||||||
from .console import Console
|
from .console import Console
|
||||||
|
|
||||||
c = Console(width=80)
|
c = Console(width=80)
|
||||||
|
|
Loading…
Reference in New Issue