/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: Martin Pool
  • Date: 2009-08-20 05:02:45 UTC
  • mfrom: (4615 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4632.
  • Revision ID: mbp@sourcefrog.net-20090820050245-o7cw6nxrzh1eah8h
News for apport feature

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,
49
50
                 stderr=None):
50
51
        """Create a TextUIFactory.
51
52
 
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.
 
53
        :param bar_type: The type of progress bar to create.  Deprecated
 
54
            and ignored; a TextProgressView is always used.
55
55
        """
56
56
        super(TextUIFactory, self).__init__()
57
57
        # TODO: there's no good reason not to pass all three streams, maybe we
222
222
        self._last_task = None
223
223
        self._total_byte_count = 0
224
224
        self._bytes_since_update = 0
 
225
        self._fraction = 0
225
226
 
226
227
    def _show_line(self, s):
227
228
        # sys.stderr.write("progress %r\n" % s)
246
247
            cols = 20
247
248
            if self._last_task is None:
248
249
                completion_fraction = 0
 
250
                self._fraction = 0
249
251
            else:
250
252
                completion_fraction = \
251
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
252
258
            markers = int(round(float(cols) * completion_fraction)) - 1
253
259
            bar_str = '[' + ('#' * markers + spin_str).ljust(cols) + '] '
254
260
            return bar_str