~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to progress.py

  • Committer: Aaron Bentley
  • Date: 2012-01-20 02:07:15 UTC
  • Revision ID: aaron@aaronbentley.com-20120120020715-ar6jbqnrjcuebggz
Tags: release-2.5
Update for 2.5 release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
# Copyright (C) 2005 Aaron Bentley
2
 
# <aaron.bentley@utoronto.ca>
 
2
# <aaron@aaronbentley.com>
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
21
19
 
22
20
class Progress(object):
23
21
    def __init__(self, units, current, total=None):
37
35
            return "%i of %i %s %.1f%%" % (self.current, self.total, self.units,
38
36
                                         self.percent)
39
37
        else:
40
 
            return "%i %s" (self.current, self.units) 
 
38
            return "%i %s" (self.current, self.units)
41
39
 
42
40
def show_progress(pi, prog):
43
41
    pi.update(prog.units, prog.current, prog.total)
44
 
        
 
42
 
45
43
def clear_progress_bar():
46
44
    sys.stderr.write('\r%s\r' % (' '*79))