You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm writing an application that can take a long time to run. I'm using a progress bar to show an overview of progress, but I'd like to also show a log of what's being done. I don't want to fill the screen with the log (I'm processing tens of thousands of items) but I'd like to be able to print something like "Processing item X" and have only the last (say) 10 messages displayed above the progress bar.
I can build something like this myself fairly easily, by adding a renderable to the progress bar live display - something like the following code works fine:
class MyProgress(Progress):
def __init__(self, *args, **kw):
self.messages = deque(maxlen=10)
super().__init__(*args, **kw)
def get_renderables(self):
for line in self.messages:
yield line
for r in super().get_renderables():
yield r
But it seems like something that would be a fairly common requirement, and I'm a bit surprised that there's nothing more "built in". Also, it needs a bit more polish (for example, at the moment, it doesn't limit the number of lines, just the number of messages, which could be multi-line).
Did I miss a feature that handles this already? If not, is it something that would be a useful feature request?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I'm writing an application that can take a long time to run. I'm using a progress bar to show an overview of progress, but I'd like to also show a log of what's being done. I don't want to fill the screen with the log (I'm processing tens of thousands of items) but I'd like to be able to print something like "Processing item X" and have only the last (say) 10 messages displayed above the progress bar.
I can build something like this myself fairly easily, by adding a renderable to the progress bar live display - something like the following code works fine:
But it seems like something that would be a fairly common requirement, and I'm a bit surprised that there's nothing more "built in". Also, it needs a bit more polish (for example, at the moment, it doesn't limit the number of lines, just the number of messages, which could be multi-line).
Did I miss a feature that handles this already? If not, is it something that would be a useful feature request?
Beta Was this translation helpful? Give feedback.
All reactions