mirror of
https://github.com/Textualize/rich.git
synced 2025-08-04 10:08:40 +00:00
progress improvements
This commit is contained in:
parent
5bebc17ad0
commit
2d0276c2a1
14 changed files with 373 additions and 80 deletions
|
@ -81,6 +81,24 @@ The following column objects are available:
|
|||
- :class:`~rich.progress.DownloadColumn` Displays download progress (assumes the steps are bytes).
|
||||
- :class:`~rich.progress.TransferSpeedColumn` Displays transfer speed (assumes the steps are bytes.
|
||||
|
||||
Print / log
|
||||
~~~~~~~~~~~
|
||||
|
||||
When a progress display is running, printing or logging anything directly to the console will break the visuals. To work around this, the Progress class provides :meth:`~rich.progress.Progress.print` and :meth:`~rich.progress.Progress.log` which work the same as their counterparts on :class:`~rich.console.Console` but will move the cursor and refresh automatically -- ensure that everything renders properly.
|
||||
|
||||
|
||||
Extending
|
||||
~~~~~~~~~
|
||||
|
||||
If the progress API doesn't offer exactly what you need in terms of a progress display, you can extend the :class:`~rich.progress.Progress` class by overriding the :class:`~rich.progress.Progress.get_renderables` method. For example, the following class will render a :class:`~rich.panel.Panel` around the progress display::
|
||||
|
||||
from rich.panel import Panel
|
||||
from rich.progress import Progress
|
||||
|
||||
class MyProgress(Progress):
|
||||
def get_renderables(self):
|
||||
yield Panel(self.make_tasks_table(self.tasks))
|
||||
|
||||
|
||||
Example
|
||||
-------
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue