Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@jeking3
Copy link

@jeking3 jeking3 commented Apr 17, 2019

  • added bar_width to initializer and format_meter
  • added better ncols handling for overflows on l_bar, bar, r_bar
  • added tests

This fixes #623
This fixes #690
This helps prevent the spillover seen in #630

This option (bar_width) prevents the bar portion of the output from being resized dynamically, and makes the r_bar portion dynamic (it gets chopped). This addresses some of the concerns of #630 as well, but does not make an individual bar multi-line capable. It just ensures you do not get multiple lines.

If the l_bar side is larger than ncols, you get ncols of l_bar.
If l_bar + bar is larger than ncols, you get l_bar + some of the bar.
If t_bar + bar + r_bar is larger than ncols, some of r_bar gets chopped.

Is there anything else I need to do for this to be accepted?

Thanks.

  • I have visited the source website, and in particular
    read the known issues
  • I have searched through the issue tracker for duplicates
  • I have mentioned version numbers, operating system and
    environment, where applicable:
    import tqdm, sys
    print(tqdm.__version__, sys.version, sys.platform)
  • If applicable, I have mentioned the relevant/related issue(s)

@jeking3 jeking3 changed the title Implement fixed width bar [bar_width] Implement fixed width bar [bar_width] and chop overflow on ncols Apr 17, 2019
@codecov-io
Copy link

codecov-io commented Apr 18, 2019

Codecov Report

Merging #716 into master will increase coverage by 0.03%.
The diff coverage is 100%.

@@            Coverage Diff             @@
##           master     #716      +/-   ##
==========================================
+ Coverage   98.86%   98.89%   +0.03%     
==========================================
  Files          10       10              
  Lines         790      818      +28     
  Branches      143      150       +7     
==========================================
+ Hits          781      809      +28     
  Misses          5        5              
  Partials        4        4

@jeking3 jeking3 force-pushed the fixed-width-bar branch from 7f4092c to 419108e Compare June 4, 2019 12:15
@jeking3 jeking3 changed the title Implement fixed width bar [bar_width] and chop overflow on ncols Fix #623, #690: Implement fixed width bar [bar_width] and chop overflow on ncols Jun 4, 2019
- added bar_width to initializer and format_meter that sets a fixed
  bar width that never changes (unless:)
- added better ncols handling for overflows on l_bar, bar, r_bar
  specifically, output is restricted to one line (of length ncols)
  and will be chopped to ensure that is always true
- added tests

This fixes tqdm#623
This fixes tqdm#690
This helps prevent the spillover seen in tqdm#630
@jeking3 jeking3 force-pushed the fixed-width-bar branch from 419108e to bc96fd5 Compare June 4, 2019 12:23
@jeking3
Copy link
Author

jeking3 commented Jun 4, 2019

@casperdcl anything else I need to do with this to get it moving?

@casperdcl casperdcl self-assigned this Jun 17, 2019
@casperdcl casperdcl changed the title Fix #623, #690: Implement fixed width bar [bar_width] and chop overflow on ncols Add fixed width bar bar_width and chop overflow on ncols Jun 17, 2019
@casperdcl casperdcl added p3-enhancement πŸ”₯ Much new such feature to-review πŸ” Awaiting final confirmation labels Jun 17, 2019
jeking3 referenced this pull request Aug 28, 2019
- supporting `{bar:[width][type]}` format string
- fixes #623
@casperdcl
Copy link
Member

Thanks @jeking3 for bumping this PR; I didn't look at it when implementing #800. It looks like both need to be combined. __format__ is more pythonic and avoids adding even more clutter to the argument list (bar_width), but the ansilen logic is needed to fix #690

@jeking3
Copy link
Author

jeking3 commented Aug 30, 2019

Regarding the clutter: I was just following the pattern that was existed when I wrote this code. It solves a serious issue that I could not get around by allowing the left, bar, and right sides of the progress bar to be set to a fixed width that cannot change. I've never seen the progress bar jump or duplicate itself on multiple lines since I put this in place. I've been using this for over 4 months, and it is (or at least, was...) properly tested, but since it was not actioned and the master code has moved forward, it looks like I'll need to spend more time on it, but I'd like to know it would be considered before I spend that time as it's difficult to schedule right now.

@casperdcl
Copy link
Member

@jeking3 don't worry about spending time on this; I'll rebase your commits in a new PR and ping you. Can't promise when as I don't get paid for this :P

@casperdcl casperdcl mentioned this pull request Nov 23, 2019
2 tasks
casperdcl added a commit that referenced this pull request Dec 19, 2019
- closes #716
- fixes #690
- related to #623
- helps avoid #630
@casperdcl casperdcl mentioned this pull request Dec 19, 2019
@casperdcl casperdcl added this to the v5.0.0 milestone Dec 19, 2019
@casperdcl casperdcl closed this in 680d1aa Dec 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

p3-enhancement πŸ”₯ Much new such feature to-review πŸ” Awaiting final confirmation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

set_description causes ghosting with long text specify bar width format-spec

3 participants