From 93ad00dffb8f348661f55b3aeb353f72e6869fc2 Mon Sep 17 00:00:00 2001 From: ptmcg Date: Thu, 10 Feb 2022 09:33:30 -0600 Subject: [PATCH] Add MofNCompleteColumn ProgressColumn and Progress.get_default_column notes to docs --- CHANGELOG.md | 2 +- docs/source/progress.rst | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1386aae0..9bbd6379 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Added ProgressColumn `MofNCompleteColumn` to display raw `completed/total` column (similar to DownloadColumn, but displays values as ints, does not convert to floats or add bit/bytes units). - https://github.com/Textualize/rich/discussions/1899 + https://github.com/Textualize/rich/pull/1941 ## [11.2.0] - 2022-02-08 diff --git a/docs/source/progress.rst b/docs/source/progress.rst index 1a4e02ed..4ce35883 100644 --- a/docs/source/progress.rst +++ b/docs/source/progress.rst @@ -113,12 +113,21 @@ The defaults are roughly equivalent to the following:: TimeRemainingColumn(), ) +To create a Progress with your own columns in addition to the defaults, use :meth:`~rich.progress.Progress.get_default_columns`:: + + progress = Progress( + SpinnerColumn(), + *Progress.get_default_columns(), + TimeElapsedColumn(), + ) + The following column objects are available: - :class:`~rich.progress.BarColumn` Displays the bar. - :class:`~rich.progress.TextColumn` Displays text. - :class:`~rich.progress.TimeElapsedColumn` Displays the time elapsed. - :class:`~rich.progress.TimeRemainingColumn` Displays the estimated time remaining. +- :class:`~rich.progress.MofNCompleteColumn` Displays completion progress as ``"{task.completed}/{task.total}"`` (works best if completed and total are ints). - :class:`~rich.progress.FileSizeColumn` Displays progress as file size (assumes the steps are bytes). - :class:`~rich.progress.TotalFileSizeColumn` Displays total file size (assumes the steps are bytes). - :class:`~rich.progress.DownloadColumn` Displays download progress (assumes the steps are bytes). @@ -128,6 +137,7 @@ The following column objects are available: To implement your own columns, extend the :class:`~rich.progress.ProgressColumn` class and use it as you would the other columns. + Table Columns ~~~~~~~~~~~~~