~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to progress.py

  • Committer: Robert Collins
  • Date: 2005-09-07 13:02:59 UTC
  • mto: (147.2.6) (364.1.3 bzrtools)
  • mto: This revision was merged to the branch mainline in revision 324.
  • Revision ID: robertc@robertcollins.net-20050907130259-35bb613478f3ec74
start adding baz_import unit test cases

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
# Copyright (C) 2005 Aaron Bentley
2
 
# <aaron@aaronbentley.com>
 
2
# <aaron.bentley@utoronto.ca>
3
3
#
4
4
#    This program is free software; you can redistribute it and/or modify
5
5
#    it under the terms of the GNU General Public License as published by
16
16
#    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17
17
 
18
18
import sys
 
19
import datetime
 
20
from bzrlib.progress import ProgressBar
19
21
 
20
22
class Progress(object):
21
23
    def __init__(self, units, current, total=None):
35
37
            return "%i of %i %s %.1f%%" % (self.current, self.total, self.units,
36
38
                                         self.percent)
37
39
        else:
38
 
            return "%i %s" (self.current, self.units)
 
40
            return "%i %s" (self.current, self.units) 
39
41
 
40
42
def show_progress(pi, prog):
41
43
    pi.update(prog.units, prog.current, prog.total)
42
 
 
 
44
        
43
45
def clear_progress_bar():
44
46
    sys.stderr.write('\r%s\r' % (' '*79))