~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/progress.py

  • Committer: Martin Pool
  • Date: 2010-04-21 11:27:04 UTC
  • mto: This revision was merged to the branch mainline in revision 5189.
  • Revision ID: mbp@canonical.com-20100421112704-zijso22b6pdevrxy
Simplify various code to use user_url

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
30
34
from bzrlib.symbol_versioning import (
 
35
    deprecated_function,
31
36
    deprecated_in,
32
37
    deprecated_method,
33
38
    )
152
157
                own_fraction = 0.0
153
158
            return self._parent_task._overall_completion_fraction(own_fraction)
154
159
 
 
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
 
155
173
    def clear(self):
156
174
        # TODO: deprecate this method; the model object shouldn't be concerned
157
175
        # with whether it's shown or not.  Most callers use this because they
207
225
        self.clear()
208
226
        self._stack.return_pb(self)
209
227
 
 
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
 
210
234
 
211
235
class DummyProgress(object):
212
236
    """Progress-bar standin that does nothing.
229
253
    def clear(self):
230
254
        pass
231
255
 
 
256
    def note(self, fmt_string, *args, **kwargs):
 
257
        """See _BaseProgressBar.note()."""
 
258
 
232
259
    def child_progress(self, **kwargs):
233
260
        return DummyProgress(**kwargs)
234
261