-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add condensed time column #1992
Add condensed time column #1992
Conversation
rich/progress.py
Outdated
@@ -357,6 +357,30 @@ def render(self, task: "Task") -> Text: | |||
return Text(str(remaining_delta), style="progress.remaining") | |||
|
|||
|
|||
class CondensedTimeColumn(ProgressColumn): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The naming isn't clear. What is condensed time? How is it different from TimeRemaining or TimeElapsed? I know the answers, but I don't think it would be obvious to a user.
I do like the functionality. But if we add it I think it should be rolled in to the TimeRemainingColumn
class so that the defaults continue to work as before, but with options for the new features.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I don't love Condensed
, but I chose that thinking of "a shorter time column with more information". Maybe Compact
would be clearer.
However, I'm happy to roll it into TimeRemainingColumn
. How about:
class TimeRemainingColumn(ProgressColumn):
"""Renders estimated time remaining.
Args:
compact (bool, optional): Render MM:SS when time remaining is less than an hour. Defaults to False.
elapsed_when_finished (bool, optional): Render time elapsed when the task is finished. Defaults to False.
"""
Or, should compact
(or another name) encompass both behaviors? Or ???
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like that idea!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
Codecov Report
@@ Coverage Diff @@
## master #1992 +/- ##
==========================================
- Coverage 99.82% 99.81% -0.02%
==========================================
Files 71 71
Lines 6943 7055 +112
==========================================
+ Hits 6931 7042 +111
- Misses 12 13 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
Thanks. |
My pleasure; thanks for accepting it. Any idea of when it might be released? No pressure, just curious when I can start using this in Twine. 😉 |
Just a few days I expect. |
Type of changes
Checklist
Description
While replacing Twine's progress bar with Rich, I got into some bike-shedding/yak-shaving to declutter the time column. After looking at several download progress indicators (e.g. Chrome, Firefox,
wget
,scp
), it seems more common to show time remaining than time elapsed. Bothwget
andscp
show time remaining until the download is finished, then switch to time elapsed. So, I implemented that behavior here.For example:
twine-progress-rich-time.mp4