nested progress bars...

Robey Pointer robey at lag.net
Tue Mar 7 02:35:01 GMT 2006


On 6 Mar 2006, at 15:15, Robert Collins wrote:

> so do we have consensus on the following?
>
>  * ui_factory.progress_bar is deprecated but continues to operate  
> as it
> does now giving a 'replace the current pb' progress bar to the client,
> which does not stack and does not need to be returned to the ui  
> factory.
>  * ui_factory.get_progress_bar() will produce a nested progress bar
>    which must be returned to the factory via pb.finished()
>
> Nesting can be done by uis any way it wants: replacing the current pb,
> having a spinner, having a two-level bar, having horizontal splits:  
> the
> client won't know.

Yeah, I'm +1 on this.

My experiments with progress-bar were disappointing and I dropped it  
without reporting back -- sorry about that.  I basically came to the  
same conclusion (the API should change; don't clutter up the API with  
'pbar' parameters) and that using a global factory function which  
holds state won't limit us in any way.  (Threaded users of bzrlib can  
use thread-local tricks in their factory function if they need to.)

My disappointment was caused by this: John's method of putting two  
progress bars on one line just doesn't work well for me.  In 80  
columns, it doesn't seem possible to reserve enough space for text  
messages *and* a progress bar without letting the sizes change  
dynamically, which is visually unpleasant and distracting.

I made a patch to do the split-progress-bar and use nesting for the  
test case of 'bzr check', but I just scanned the patch and there's  
nothing particularly interesting or worth saving.  Once the progress- 
bar API changes, anyone will be able to plugin their own TTY progress- 
bar and experiment further with what looks best.

I'll attach my adaptation of John's split-bar class for those who  
want to play further with it.  It does at least handle debouncing and  
has unit tests, so it's a good starting point for implementing  
something different.

robey

-------------- next part --------------
A non-text attachment was scrubbed...
Name: pbar.py
Type: text/x-python-script
Size: 10723 bytes
Desc: not available
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060306/68449303/attachment.bin 


More information about the bazaar mailing list