Closed elbaro closed 6 years ago
What is your use case for having bars with different number of prependers / appenders ?
Should be fixed now. Can you please check?
In my case I have a million urls to download. There is a global bar to show the total progress (# of urls completed) with the remaining time appended, and 10 bars for 10 concurrent downloads with urls prepended and speeds (MB/s) appended.
For example,
(1)
Total Download: |===== | 113686 / 1000000 (xx %)
https://...1.zip |========= | (2.3 MB/s)
https://...2.zip |========= | (152 KB/s)
..
https://...10.zip |========= | (30 KB/s)
The 10 bars should be aligned but the global bar is not.
If 2.zip is completed first, other bars' position remain and 2.zip is replaced with new progress for 11.zip. (#13)
(2)
Total Download: |===== | 113687 / 1000000 (xx %)
https://...1.zip |========= | (2.3 MB/s)
https://...11.zip |=== | (200 KB/s)
..
https://...10.zip |========= | (30 KB/s)
If requesting 11.zip returns an error, it is replaced by a retry bar.
(3)
Total Download: |===== | 113687 / 1000000 (xx %)
https://...1.zip |========= | (2.3 MB/s)
https://...11.zip | Retrying in 3 seconds.. | (2/5)
..
https://...10.zip |========= | (30 KB/s)
This requires putting the text within the bar. Asking for (3) may be too much, but I think scenarios like this (having different kinds of bars and multiple alignment groups) are common.
I wrote a simple test and It works now. https://asciinema.org/a/f0DzxVe6pojSSRmchgGAVumKO
mpb panics when multiple bars have different number of prependers / appenders.
from
progress_posix.go
This assumes all bars use the same number of prependers / appenders. It can be fixed in a naive (slow) way that calculates the maxmium number of columns every tick: