~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/ui/__init__.py

  • Committer: John Arbash Meinel
  • Date: 2005-11-30 15:43:57 UTC
  • mto: (1185.50.1 jam-integration)
  • mto: This revision was merged to the branch mainline in revision 1518.
  • Revision ID: john@arbash-meinel.com-20051130154357-614206b3a7b83cd0
Refactored bzrlib/ui.py into a module with the possibility for multiple ui forms.

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
displays no output.
29
29
"""
30
30
 
31
 
 
32
 
 
33
 
 
34
 
 
35
31
import bzrlib.progress
36
32
 
37
33
 
38
 
class TextUIFactory(object):
 
34
class UIFactory(object):
 
35
    """UI abstraction.
 
36
 
 
37
    This tells the library how to display things to the user.  Through this
 
38
    layer different applications can choose the style of UI.
 
39
    """
39
40
    def progress_bar(self):
40
 
 
41
 
        # this in turn is abstract, and creates either a tty or dots
42
 
        # bar depending on what we think of the terminal
43
 
        return bzrlib.progress.ProgressBar()
44
 
 
45
 
 
46
 
class SilentUIFactory(object):
 
41
        raise NotImplementedError
 
42
 
 
43
 
 
44
class SilentUIFactory(UIFactory):
 
45
    """A UI Factory which never prints anything.
 
46
 
 
47
    This is the default UI, if another one is never registered.
 
48
    """
47
49
    def progress_bar(self):
48
50
        return bzrlib.progress.DummyProgress()
49
51
 
50
 
 
51
52
ui_factory = SilentUIFactory()