~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/ui/__init__.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2009-02-23 17:00:36 UTC
  • mfrom: (4032.1.4 jam-integration)
  • Revision ID: pqm@pqm.ubuntu.com-20090223170036-3q1v68ewdt8i0to5
(Marius Kruger) Remove all trailing whitespace and add tests to
        enforce this.

Show diffs side-by-side

added added

removed removed

Lines of Context:
87
87
            warnings.warn("%r finished but nothing is active"
88
88
                % (task,))
89
89
        elif task != self._task_stack[-1]:
90
 
            warnings.warn("%r is not the active task %r" 
 
90
            warnings.warn("%r is not the active task %r"
91
91
                % (task, self._task_stack[-1]))
92
92
        else:
93
93
            del self._task_stack[-1]
100
100
 
101
101
    def _progress_updated(self, task):
102
102
        """Called by the ProgressTask when it changes.
103
 
        
 
103
 
104
104
        Should be specialized to draw the progress.
105
105
        """
106
106
        pass
114
114
        pass
115
115
 
116
116
    def get_boolean(self, prompt):
117
 
        """Get a boolean question answered from the user. 
 
117
        """Get a boolean question answered from the user.
118
118
 
119
119
        :param prompt: a message to prompt the user with. Should be a single
120
120
        line without terminating \n.
137
137
 
138
138
    def report_transport_activity(self, transport, byte_count, direction):
139
139
        """Called by transports as they do IO.
140
 
        
 
140
 
141
141
        This may update a progress bar, spinner, or similar display.
142
142
        By default it does nothing.
143
143
        """
147
147
 
148
148
class CLIUIFactory(UIFactory):
149
149
    """Common behaviour for command line UI factories.
150
 
    
 
150
 
151
151
    This is suitable for dumb terminals that can't repaint existing text."""
152
152
 
153
153
    def __init__(self, stdin=None, stdout=None, stderr=None):
180
180
        :param kwargs: Arguments which will be expanded into the prompt.
181
181
                       This lets front ends display different things if
182
182
                       they so choose.
183
 
        :return: The password string, return None if the user 
 
183
        :return: The password string, return None if the user
184
184
                 canceled the request.
185
185
        """
186
186
        prompt += ': '
224
224
 
225
225
 
226
226
ui_factory = SilentUIFactory()
227
 
"""IMPORTANT: never import this symbol directly. ONLY ever access it as 
 
227
"""IMPORTANT: never import this symbol directly. ONLY ever access it as
228
228
ui.ui_factory."""
229
229
 
230
230
 
231
231
def make_ui_for_terminal(stdin, stdout, stderr):
232
232
    """Construct and return a suitable UIFactory for a text mode program.
233
233
 
234
 
    If stdout is a smart terminal, this gets a smart UIFactory with 
 
234
    If stdout is a smart terminal, this gets a smart UIFactory with
235
235
    progress indicators, etc.  If it's a dumb terminal, just plain text output.
236
236
    """
237
237
    cls = None