~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/ui/text.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2009-08-06 02:23:37 UTC
  • mfrom: (4332.3.36 check)
  • Revision ID: pqm@pqm.ubuntu.com-20090806022337-7c2oni07fsjq6gun
(robertc) Partial overhaul of check to do less duplicate work.
        (Robert Collins)

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
from bzrlib.lazy_import import lazy_import
28
28
lazy_import(globals(), """
29
29
from bzrlib import (
 
30
    debug,
30
31
    progress,
31
32
    osutils,
32
33
    symbol_versioning,
221
222
        self._last_task = None
222
223
        self._total_byte_count = 0
223
224
        self._bytes_since_update = 0
 
225
        self._fraction = 0
224
226
 
225
227
    def _show_line(self, s):
226
228
        # sys.stderr.write("progress %r\n" % s)
245
247
            cols = 20
246
248
            if self._last_task is None:
247
249
                completion_fraction = 0
 
250
                self._fraction = 0
248
251
            else:
249
252
                completion_fraction = \
250
253
                    self._last_task._overall_completion_fraction() or 0
 
254
            if (completion_fraction < self._fraction and 'progress' in
 
255
                debug.debug_flags):
 
256
                import pdb;pdb.set_trace()
 
257
            self._fraction = completion_fraction
251
258
            markers = int(round(float(cols) * completion_fraction)) - 1
252
259
            bar_str = '[' + ('#' * markers + spin_str).ljust(cols) + '] '
253
260
            return bar_str