rsalmei / alive-progress

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

Further customizing possible? #189

Closed arvitus closed 1 year ago

arvitus commented 2 years ago

I already figured out how to customize the bar using the monitor and stats argument and that works just fine. However I was wondering if it's possible to customize these strings even more. I'm thinking of this string (for monitor) for example which is supposed to show the {count} variable divided by 10 and rounded to 2 decimal places -> "{round(count/10, 2)}/{total}". Basically I want to process the shown values even further. Is customization like this already possible?

edit: A related question that just came to my mind is if the order in which the items are shown can be customized. Currently it's this layout: title [----progress----] monitor elapsed stats. Can this order be changed?

rsalmei commented 1 year ago

Humm no, it isn't possible to customize it that way yet. I did think about allowing this kind of freedom, but thought it could cause all kinds of trouble like making the bar slow, or crash in new and unknown ways, which would make me protect these methods with try/finally blocks to give friendlier errors, which would make it even slower for everyone, even when not using these customizations. So, between no customization and total freedom, I chose this middle ground, where I only do safe string formatting, and check the variable names one sends right at the start, within the configuration.

The order of the widgets never seemed helpful to change, nor anyone has ever asked for that... I feel the ability to turn on and off individual widgets has always satisfied all tastes. Actually, the unreleased 3.0 will have some news in this regard, but still not changeable. Would you like that?

arvitus commented 1 year ago

Thanks for the answer. I'm the type of person that wants to customise EVERYTHING xD But I do unterstand that it's inconvenient and can cause problems so it's fine. I actually already just went with it as is, it was just a question/idea that came to mind when first testing this library. So there's no immediate need for this anymore, but I appreciate the explanation :)

rsalmei commented 1 year ago

Sure, you're welcome!