~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to progress.py

  • Committer: Aaron Bentley
  • Date: 2013-08-20 03:02:43 UTC
  • Revision ID: aaron@aaronbentley.com-20130820030243-r8v1xfbcnd8f10p4
Fix zap command for 2.6/7

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