Skip to content
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

[REQUEST] Renderable for solid bar #293

Closed
ssbarnea opened this issue Sep 19, 2020 · 3 comments
Closed

[REQUEST] Renderable for solid bar #293

ssbarnea opened this issue Sep 19, 2020 · 3 comments
Labels

Comments

@ssbarnea
Copy link

ssbarnea commented Sep 19, 2020

One common UI element is the display of a percentage as a small column, often also using a semaphore color gradient.
Most of the time these columns are very narrow, 4-5 chars like.

Current example with rich:
screenshot

Example of desired look (Gerrit review size )

gerrit-review-size-column

Details

  • User may want to render nothing when value is either min or max
  • User may want to left or right alignment
  • I am not sure if reuse of current progressbar may be possible for this special usecase, especially as this requires use of https://en.wikipedia.org/wiki/Block_Elements for drawing in a very small space.
  • Computing color gradient may be tricky, so it may worth allowing user to implement in and only supporting a single color.
@ssbarnea ssbarnea changed the title [REQUEST] Document display of pecentage inside tables. [REQUEST] Document display of percentage bars (blocks) Sep 19, 2020
@willmcgugan
Copy link
Collaborator

You could use rich.bar which is what Progress uses internally. Although the line characters it uses give you a granularity of 1/2 a 'cell'.

It wouldn't be that hard to implement something like bar.Bar using the more granular block characters. Which is probably a nice addition to Rich. I'll tag this as an enhancement, but you might want to tackle it yourself if you need it sooner.

@willmcgugan willmcgugan added the enhancement New feature or request label Sep 21, 2020
@willmcgugan willmcgugan changed the title [REQUEST] Document display of percentage bars (blocks) [REQUEST] Renderable for solid bar Sep 21, 2020
@ssbarnea
Copy link
Author

I will try to look at bar, even 1/2 bars provide decent size estimate. 5 chars => 10% range which is quite precise IMHO.

@megaserg megaserg mentioned this issue Oct 8, 2020
9 tasks
@willmcgugan
Copy link
Collaborator

See the new Bar class in v9.0.0 https://rich.readthedocs.io/en/latest/reference/bar.html

Note that rich.bar.Bar was renamed to rich.progress_bar.ProgessBar in v9, and rich.bar.Bar is the new solid bar.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants