@@ -17,11 +17,11 @@ class ProgressBar(object):
1717 def __init__ (self , minValue = 0 , maxValue = 10 , totalWidth = None ):
1818 self ._progBar = "[]"
1919 self ._oldProgBar = ""
20- self .__min = int (minValue )
21- self .__max = int (maxValue )
22- self .__span = self .__max - self .__min
23- self .__width = totalWidth if totalWidth else conf .progressWidth
24- self .__amount = 0
20+ self ._min = int (minValue )
21+ self ._max = int (maxValue )
22+ self ._span = self ._max - self ._min
23+ self ._width = totalWidth if totalWidth else conf .progressWidth
24+ self ._amount = 0
2525 self .update ()
2626
2727 def _convertSeconds (self , value ):
@@ -36,21 +36,21 @@ def update(self, newAmount=0):
3636 This method updates the progress bar
3737 """
3838
39- if newAmount < self .__min :
40- newAmount = self .__min
41- elif newAmount > self .__max :
42- newAmount = self .__max
39+ if newAmount < self ._min :
40+ newAmount = self ._min
41+ elif newAmount > self ._max :
42+ newAmount = self ._max
4343
44- self .__amount = newAmount
44+ self ._amount = newAmount
4545
4646 # Figure out the new percent done, round to an integer
47- diffFromMin = float (self .__amount - self .__min )
48- percentDone = (diffFromMin / float (self .__span )) * 100.0
47+ diffFromMin = float (self ._amount - self ._min )
48+ percentDone = (diffFromMin / float (self ._span )) * 100.0
4949 percentDone = round (percentDone )
5050 percentDone = int (percentDone )
5151
5252 # Figure out how many hash bars the percentage should be
53- allFull = self .__width - 2
53+ allFull = self ._width - 2
5454 numHashes = (percentDone / 100.0 ) * allFull
5555 numHashes = int (round (numHashes ))
5656
@@ -75,11 +75,11 @@ def draw(self, eta=0):
7575 if self ._progBar != self ._oldProgBar :
7676 self ._oldProgBar = self ._progBar
7777
78- if eta and self .__amount < self .__max :
79- dataToStdout ("\r %s %d/%d ETA %s" % (self ._progBar , self .__amount , self .__max , self ._convertSeconds (int (eta ))))
78+ if eta and self ._amount < self ._max :
79+ dataToStdout ("\r %s %d/%d ETA %s" % (self ._progBar , self ._amount , self ._max , self ._convertSeconds (int (eta ))))
8080 else :
81- blank = " " * (80 - len ("\r %s %d/%d" % (self ._progBar , self .__amount , self .__max )))
82- dataToStdout ("\r %s %d/%d%s" % (self ._progBar , self .__amount , self .__max , blank ))
81+ blank = " " * (80 - len ("\r %s %d/%d" % (self ._progBar , self ._amount , self ._max )))
82+ dataToStdout ("\r %s %d/%d%s" % (self ._progBar , self ._amount , self ._max , blank ))
8383
8484 def __str__ (self ):
8585 """
0 commit comments