~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/ui/__init__.py

  • Committer: Martin Pool
  • Date: 2009-06-22 08:33:51 UTC
  • mto: This revision was merged to the branch mainline in revision 4558.
  • Revision ID: mbp@sourcefrog.net-20090622083351-7y1qejei1b3ds1hc
Move NullProgressView and make_progress_view up to UIFactory base class

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
for a GUI.
24
24
 
25
25
UIFactory
26
 
    Abstract base class
27
 
 
28
 
CLIUIFactory
29
 
    Basic text output, and can read input from the user.
30
 
 
31
 
TextUIFactory
32
 
    Can also repaint the screen to draw progress bars.
 
26
    Semi-abstract base class
33
27
 
34
28
SilentUIFactory
35
29
    Produces no output and cannot take any input; useful for programs using
36
30
    bzrlib in batch mode or for programs such as loggerhead.
 
31
 
 
32
TextUIFactory
 
33
    Standard text command-line interface, with stdin, stdout, stderr.
 
34
    May make more or less advanced use of them, eg in drawing progress bars,
 
35
    depending on the detected capabilities of the terminal.
37
36
"""
38
37
 
39
38
import os
132
131
        """
133
132
        raise NotImplementedError(self.get_boolean)
134
133
 
 
134
    def make_progress_view(self):
 
135
        """Construct a new ProgressView object for this UI.
 
136
 
 
137
        Application code should normally not call this but instead
 
138
        nested_progress_bar().
 
139
        """
 
140
        return NullProgressView()
 
141
 
135
142
    def recommend_upgrade(self,
136
143
        current_format_name,
137
144
        basedir):
302
309
        from bzrlib.ui.text import TextUIFactory
303
310
        cls = TextUIFactory
304
311
    return cls(stdin=stdin, stdout=stdout, stderr=stderr)
 
312
 
 
313
 
 
314
class NullProgressView(object):
 
315
    """Soak up and ignore progress information."""
 
316
 
 
317
    def clear(self):
 
318
        pass
 
319
 
 
320
    def show_progress(self, task):
 
321
        pass
 
322
 
 
323
    def show_transport_activity(self, transport, direction, byte_count):
 
324
        pass