28
28
displays no output.
31
35
import bzrlib.progress
34
class UIFactory(object):
37
This tells the library how to display things to the user. Through this
38
layer different applications can choose the style of UI.
38
class TextUIFactory(object):
40
39
def progress_bar(self):
41
"""Return a progress bar object"""
42
raise NotImplementedError
44
def get_password(self, prompt='', **kwargs):
45
"""Prompt the user for a password.
47
:param prompt: The prompt to present the user
48
:param kwargs: Arguments which will be expanded into the prompt.
49
This lets front ends display different things if
51
:return: The password string, return None if the user
54
raise NotImplementedError
57
class SilentUIFactory(UIFactory):
58
"""A UI Factory which never prints anything.
60
This is the default UI, if another one is never registered.
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()
46
class SilentUIFactory(object):
62
47
def progress_bar(self):
63
48
return bzrlib.progress.DummyProgress()
65
def get_password(self, prompt='', **kwargs):
69
51
ui_factory = SilentUIFactory()