~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/ui/text.py

  • Committer: Aaron Bentley
  • Date: 2009-06-29 14:51:13 UTC
  • mfrom: (4489 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4490.
  • Revision ID: aaron@aaronbentley.com-20090629145113-3w350dxgqppnzo4g
Merge bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
138
138
        # true when there's output on the screen we may need to clear
139
139
        self._have_output = False
140
140
        # XXX: We could listen for SIGWINCH and update the terminal width...
 
141
        # https://launchpad.net/bugs/316357
141
142
        self._width = osutils.terminal_width()
142
143
        self._last_transport_msg = ''
143
144
        self._spin_pos = 0
245
246
        # XXX: Probably there should be a transport activity model, and that
246
247
        # too should be seen by the progress view, rather than being poked in
247
248
        # here.
 
249
        if not self._have_output:
 
250
            # As a workaround for <https://launchpad.net/bugs/321935> we only
 
251
            # show transport activity when there's already a progress bar
 
252
            # shown, which time the application code is expected to know to
 
253
            # clear off the progress bar when it's going to send some other
 
254
            # output.  Eventually it would be nice to have that automatically
 
255
            # synchronized.
 
256
            return
248
257
        self._total_byte_count += byte_count
249
258
        self._bytes_since_update += byte_count
250
259
        now = time.time()
254
263
            # guard against clock stepping backwards, and don't update too
255
264
            # often
256
265
            rate = self._bytes_since_update / (now - self._transport_update_time)
257
 
            scheme = getattr(transport, '_scheme', None) or repr(transport)
258
 
            if direction == 'read':
259
 
                dir_char = '>'
260
 
            elif direction == 'write':
261
 
                dir_char = '<'
262
 
            else:
263
 
                dir_char = ' '
264
 
            msg = ("%.7s %s %6dKB %5dKB/s" %
265
 
                    (scheme, dir_char, self._total_byte_count>>10, int(rate)>>10,))
 
266
            msg = ("%6dKB %5dKB/s" %
 
267
                    (self._total_byte_count>>10, int(rate)>>10,))
266
268
            self._transport_update_time = now
267
269
            self._last_repaint = now
268
270
            self._bytes_since_update = 0
269
271
            self._last_transport_msg = msg
270
272
            self._repaint()
271
 
 
272