Open guano opened 3 months ago
Thanks for reporting! I left some comments on the PR, but I think the main thing to sort out is when to determine the clock should be stopped for status bars. You went with the closed time which does make sense in some cases, but there could be an argument for the last update in other cases. I'm not sure what the right answer is. I'm leaning towards agreeing with you, but my hesitation is this is different than the way it's handled in progress bars. That may be ok, but I think the "why" needs to be understood and documented.
Yeah, it definitely is a decision that can be disputed either way.
In the meantime I have figured out a workaround for my use case at least. The elapsed
variable can just be read at close time and inserted as a static string rather than being dynamically updated whenever the manager adds/removes another bar.
from enlighten._util import format_time
# start, sleep, update, etc as in original code sample
sb.update(f"statusbar finished. time elapsed when closed: {format_time(sb.elapsed)}")
sb.close()
Describe the bug A statusbar's
elapsed
field gets updated, even if it is closed and not refreshed.Looks like this bug was fixed for counters but not statusbars see issue #62
To Reproduce
sb's elapsed time gets updated even though it's not being updated and is in fact closed.
Environment (please complete the following infkkkormation):
master
as of May 31, 2024)