~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/progress.py

  • Committer: John Arbash Meinel
  • Date: 2010-08-23 19:10:35 UTC
  • mto: This revision was merged to the branch mainline in revision 5390.
  • Revision ID: john@arbash-meinel.com-20100823191035-57bojnmqw54nutsz
switch 'x += 1' to 'x = x + 1' to deal with brain-damaged old versions of pyrex.

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
import os
28
28
 
29
29
 
30
 
from bzrlib import (
31
 
    errors,
32
 
    )
33
 
from bzrlib.trace import mutter
34
30
from bzrlib.symbol_versioning import (
35
 
    deprecated_function,
36
31
    deprecated_in,
37
32
    deprecated_method,
38
33
    )
157
152
                own_fraction = 0.0
158
153
            return self._parent_task._overall_completion_fraction(own_fraction)
159
154
 
160
 
    @deprecated_method(deprecated_in((2, 1, 0)))
161
 
    def note(self, fmt_string, *args):
162
 
        """Record a note without disrupting the progress bar.
163
 
        
164
 
        Deprecated: use ui_factory.note() instead or bzrlib.trace.  Note that
165
 
        ui_factory.note takes just one string as the argument, not a format
166
 
        string and arguments.
167
 
        """
168
 
        if args:
169
 
            self.ui_factory.note(fmt_string % args)
170
 
        else:
171
 
            self.ui_factory.note(fmt_string)
172
 
 
173
155
    def clear(self):
174
156
        # TODO: deprecate this method; the model object shouldn't be concerned
175
157
        # with whether it's shown or not.  Most callers use this because they
225
207
        self.clear()
226
208
        self._stack.return_pb(self)
227
209
 
228
 
    def note(self, fmt_string, *args, **kwargs):
229
 
        """Record a note without disrupting the progress bar."""
230
 
        self.clear()
231
 
        self.to_messages_file.write(fmt_string % args)
232
 
        self.to_messages_file.write('\n')
233
 
 
234
210
 
235
211
class DummyProgress(object):
236
212
    """Progress-bar standin that does nothing.
253
229
    def clear(self):
254
230
        pass
255
231
 
256
 
    def note(self, fmt_string, *args, **kwargs):
257
 
        """See _BaseProgressBar.note()."""
258
 
 
259
232
    def child_progress(self, **kwargs):
260
233
        return DummyProgress(**kwargs)
261
234
 
316
289
        else:
317
290
            self.cur_phase += 1
318
291
        self.pb.update(self.message, self.cur_phase, self.total)
319
 
 
320
 
 
321
 
_progress_bar_types = {}
322
 
_progress_bar_types['dummy'] = DummyProgress
323
 
_progress_bar_types['none'] = DummyProgress