/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/ui/text.py

  • Committer: John Arbash Meinel
  • Date: 2009-12-18 16:39:21 UTC
  • mto: This revision was merged to the branch mainline in revision 4934.
  • Revision ID: john@arbash-meinel.com-20091218163921-tcltjarx4pxxm08y
Basic implementation of logging bytes transferred when bzr exits.

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
    progress,
33
33
    osutils,
34
34
    symbol_versioning,
 
35
    trace,
35
36
    )
36
37
 
37
38
""")
203
204
        self._progress_view.show_transport_activity(transport,
204
205
            direction, byte_count)
205
206
 
 
207
    def log_transport_activity(self, display=False):
 
208
        """See UIFactory.log_transport_activity()"""
 
209
        log = getattr(self._progress_view, 'log_transport_activity', None)
 
210
        if log is not None:
 
211
            log(display=display)
 
212
 
206
213
    def show_error(self, msg):
207
214
        self.clear_term()
208
215
        self.stderr.write("bzr: error: %s\n" % msg)
401
408
            self._last_transport_msg = msg
402
409
            self._repaint()
403
410
 
 
411
    def log_transport_activity(self, display=False):
 
412
        byte_message = 'Total byte count: %.3fMiB (%dB)' % (
 
413
                        self._total_byte_count / 1024. / 1024,
 
414
                        self._total_byte_count)
 
415
        trace.mutter(byte_message)
 
416
        if display:
 
417
            self._term_file.write('\n%s\n' % (byte_message,))
 
418
 
404
419
 
405
420
class TextUIOutputStream(object):
406
421
    """Decorates an output stream so that the terminal is cleared before writing.