~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/progress.py

  • Committer: Robert Collins
  • Date: 2010-06-25 06:23:08 UTC
  • mto: This revision was merged to the branch mainline in revision 5324.
  • Revision ID: robertc@robertcollins.net-20100625062308-qx287gzfrehs1d21
Restore the original ui_factory when existing BzrLibraryState.

Show diffs side-by-side

added added

removed removed

Lines of Context:
152
152
                own_fraction = 0.0
153
153
            return self._parent_task._overall_completion_fraction(own_fraction)
154
154
 
 
155
    @deprecated_method(deprecated_in((2, 1, 0)))
 
156
    def note(self, fmt_string, *args):
 
157
        """Record a note without disrupting the progress bar.
 
158
        
 
159
        Deprecated: use ui_factory.note() instead or bzrlib.trace.  Note that
 
160
        ui_factory.note takes just one string as the argument, not a format
 
161
        string and arguments.
 
162
        """
 
163
        if args:
 
164
            self.ui_factory.note(fmt_string % args)
 
165
        else:
 
166
            self.ui_factory.note(fmt_string)
 
167
 
155
168
    def clear(self):
156
169
        # TODO: deprecate this method; the model object shouldn't be concerned
157
170
        # with whether it's shown or not.  Most callers use this because they
207
220
        self.clear()
208
221
        self._stack.return_pb(self)
209
222
 
 
223
    def note(self, fmt_string, *args, **kwargs):
 
224
        """Record a note without disrupting the progress bar."""
 
225
        self.clear()
 
226
        self.to_messages_file.write(fmt_string % args)
 
227
        self.to_messages_file.write('\n')
 
228
 
210
229
 
211
230
class DummyProgress(object):
212
231
    """Progress-bar standin that does nothing.
229
248
    def clear(self):
230
249
        pass
231
250
 
 
251
    def note(self, fmt_string, *args, **kwargs):
 
252
        """See _BaseProgressBar.note()."""
 
253
 
232
254
    def child_progress(self, **kwargs):
233
255
        return DummyProgress(**kwargs)
234
256