~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/ui/text.py

Merge in nested progress bars

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
import sys
24
24
 
25
25
import bzrlib.progress
 
26
from bzrlib.symbol_versioning import *
26
27
from bzrlib.ui import UIFactory
27
28
 
28
29
 
29
30
class TextUIFactory(UIFactory):
 
31
 
 
32
    @deprecated_method(zero_eight)
30
33
    def progress_bar(self):
31
 
 
 
34
        """See UIFactory.nested_progress_bar()."""
32
35
        # this in turn is abstract, and creates either a tty or dots
33
36
        # bar depending on what we think of the terminal
34
37
        return bzrlib.progress.ProgressBar()
50
53
        except KeyboardInterrupt:
51
54
            return None
52
55
 
 
56
    def nested_progress_bar(self):
 
57
        """Return a nested progress bar.
 
58
        
 
59
        The actual bar type returned depends on the progress module which
 
60
        may return a tty or dots bar depending on the terminal.
 
61
        """
 
62
        if self._progress_bar_stack is None:
 
63
            self._progress_bar_stack = bzrlib.progress.ProgressBarStack()
 
64
        return self._progress_bar_stack.get_nested()