~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/ui/text.py

  • Committer: Andrew Bennetts
  • Date: 2009-08-05 02:37:11 UTC
  • mfrom: (4589 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4608.
  • Revision ID: andrew.bennetts@canonical.com-20090805023711-1mu01azkgbrw4fl1
Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
49
49
                 stderr=None):
50
50
        """Create a TextUIFactory.
51
51
 
52
 
        :param bar_type: The type of progress bar to create. It defaults to
53
 
                         letting the bzrlib.progress.ProgressBar factory auto
54
 
                         select.   Deprecated.
 
52
        :param bar_type: The type of progress bar to create.  Deprecated
 
53
            and ignored; a TextProgressView is always used.
55
54
        """
56
55
        super(TextUIFactory, self).__init__()
57
56
        # TODO: there's no good reason not to pass all three streams, maybe we
224
223
        self._bytes_since_update = 0
225
224
 
226
225
    def _show_line(self, s):
 
226
        # sys.stderr.write("progress %r\n" % s)
227
227
        n = self._width - 1
228
228
        self._term_file.write('\r%-*.*s\r' % (n, n, s))
229
229
 
283
283
            task_msg = self._format_task(self._last_task)
284
284
        else:
285
285
            task_msg = ''
286
 
        trans = self._last_transport_msg
287
 
        if trans:
288
 
            trans += ' | '
 
286
        if self._last_task and not self._last_task.show_transport_activity:
 
287
            trans = ''
 
288
        else:
 
289
            trans = self._last_transport_msg
 
290
            if trans:
 
291
                trans += ' | '
289
292
        return (bar_string + trans + task_msg)
290
293
 
291
294
    def _repaint(self):
302
305
        must_update = task is not self._last_task
303
306
        self._last_task = task
304
307
        now = time.time()
305
 
        if (not must_update) and (now < self._last_repaint + 0.1):
 
308
        if (not must_update) and (now < self._last_repaint + task.update_latency):
306
309
            return
307
310
        if now > self._transport_update_time + 10:
308
311
            # no recent activity; expire it
330
333
        self._total_byte_count += byte_count
331
334
        self._bytes_since_update += byte_count
332
335
        now = time.time()
 
336
        if self._total_byte_count < 2000:
 
337
            # a little resistance at first, so it doesn't stay stuck at 0
 
338
            # while connecting...
 
339
            return
333
340
        if self._transport_update_time is None:
334
341
            self._transport_update_time = now
335
342
        elif now >= (self._transport_update_time + 0.5):