~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/ui/text.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2006-04-24 01:20:27 UTC
  • mfrom: (1681.1.2 integration)
  • Revision ID: pqm@pqm.ubuntu.com-20060424012027-0017c749480ad462
Make TextUIFactory allow selection of the progress bar type.

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
 
29
29
 
30
30
class TextUIFactory(UIFactory):
 
31
    """A UI factory for Text user interefaces."""
 
32
 
 
33
    def __init__(self, bar_type=None):
 
34
        """Create a TextUIFactory.
 
35
 
 
36
        :param bar_type: The type of progress bar to create. It defaults to 
 
37
                         letting the bzrlib.progress.ProgressBar factory auto
 
38
                         select.
 
39
        """
 
40
        super(TextUIFactory, self).__init__()
 
41
        self._bar_type = bar_type
31
42
 
32
43
    @deprecated_method(zero_eight)
33
44
    def progress_bar(self):
60
71
        may return a tty or dots bar depending on the terminal.
61
72
        """
62
73
        if self._progress_bar_stack is None:
63
 
            self._progress_bar_stack = bzrlib.progress.ProgressBarStack()
 
74
            self._progress_bar_stack = bzrlib.progress.ProgressBarStack(
 
75
                klass=self._bar_type)
64
76
        return self._progress_bar_stack.get_nested()
65
77
 
66
78
    def clear_term(self):