rsalmei / alive-progress

A new kind of Progress Bar, with real-time throughput, ETA, and very cool animations!
MIT License
5.53k stars 206 forks source link

Allow 'total' to be updated during runtime #82

Open DickerDackel opened 3 years ago

DickerDackel commented 3 years ago

Use-Case:

I have a multi-threaded program, where one thread traverses a large
directory tee to searches for files
to work on.  A second thread works on these files, even when the
first thread is still searching.

So while there is already work happening, the list of files to
process can still continue to grow.

This patch adds the functionality to update the total value to
handle this use case.

How: I adapted the mechanism as used in the 'bar.current()' attribute and applied it to the variables 'total', 'logic_total' and 'gen_eta'.

Also a function bar.update_total(nn) has been added, that
regenerates all 3 values appropriately.
rsalmei commented 3 years ago

Yeah, it does indeed, thank you @DickerDackel. I'd change a few things though, like removing the duplicated gen_eta for example, but it's minor. Great idea and implementation!

But unfortunately I'm on the brink of releasing something really big, look #51 So I'm not sure how to proceed... I'll think about it and get back to you.

TheTechRobo commented 2 years ago

@rsalmei what's the status?

rsalmei commented 2 years ago

Hello @TheTechRobo, What do you mean by "what's the status"? I'm not working on this. Maybe I could try to recover it someday if the sender wouldn't, but I can't atm.

TheTechRobo commented 2 years ago

I was asking about your

I'll think about it and get back to you.

rsalmei commented 2 years ago

Ohh, I see! You're right! 😬 I did say I was going to think about it! Well, I did, but forgot to return here... I'll take a look again soon, and can try to re-do it. 👍