~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to progress.py

  • Committer: Aaron Bentley
  • Date: 2006-06-14 18:09:53 UTC
  • mto: This revision was merged to the branch mainline in revision 395.
  • Revision ID: abentley@panoramicfeedback.com-20060614180953-4671478534fd8823
Update NEWS

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))