Definition at line 5 of file ProgressBar.py.
 
◆ __init__()
      
        
          | def python.ProgressBar.progressBar.__init__ | ( |  | self, | 
        
          |  |  |  | minValue = 0, | 
        
          |  |  |  | maxValue = 10, | 
        
          |  |  |  | totalWidth = 12, | 
        
          |  |  |  | prefix = "", | 
        
          |  |  |  | suffix = "" | 
        
          |  | ) |  |  | 
      
 
Definition at line 6 of file ProgressBar.py.
    6     def __init__(self, minValue = 0, maxValue = 10, totalWidth=12, prefix="", suffix=""):
 
   10         self.span = maxValue - minValue
 
   12         self.nextUpdate = minValue+
float(self.span/100.0)
 
   14             self.prefix=prefix+
" [" 
   18             self.suffix=
"] " + suffix
 
   21         self.width = totalWidth - len(self.prefix) - len(self.suffix)
 
 
 
◆ __str__()
      
        
          | def python.ProgressBar.progressBar.__str__ | ( |  | self | ) |  | 
      
 
 
◆ done()
      
        
          | def python.ProgressBar.progressBar.done | ( |  | self | ) |  | 
      
 
Definition at line 59 of file ProgressBar.py.
   61         sys.stdout.write(
'\r' + self.progBar + 
'\n')
 
 
 
 
◆ update()
      
        
          | def python.ProgressBar.progressBar.update | ( |  | self, | 
        
          |  |  |  | newAmount = 0 | 
        
          |  | ) |  |  | 
      
 
Definition at line 24 of file ProgressBar.py.
   24     def update(self, newAmount = 0):
 
   25         if newAmount < self.min:
 
   27         if newAmount > self.max:
 
   31         if newAmount < self.nextUpdate 
and newAmount<self.max :
 
   33         self.nextUpdate = self.nextUpdate+
float(self.span/100.0)
 
   34         self.amount = newAmount
 
   37         diffFromMin = 
float(self.amount - self.min)
 
   38         percentDone = (diffFromMin / 
float(self.span)) * 100.0 
if self.span>0 
else 100.
 
   39         percentDone = 
round(percentDone)
 
   40         percentDone = 
int(percentDone)
 
   43         numHashes = (percentDone / 100.0) * self.width
 
   47         self.progBar = self.prefix + 
'#'*numHashes + 
' '*(self.width-numHashes) + self.suffix
 
   50         percentPlace = (len(self.progBar) // 2) - len(
str(percentDone))
 
   51         percentString = 
str(percentDone) + 
"%" 
   54         self.progBar = self.progBar[0:percentPlace] + percentString + self.progBar[percentPlace+len(percentString):]
 
   56         sys.stdout.write(
'\r' + self.progBar)
 
 
 
◆ amount
      
        
          | python.ProgressBar.progressBar.amount | 
      
 
 
◆ max
      
        
          | python.ProgressBar.progressBar.max | 
      
 
 
◆ min
      
        
          | python.ProgressBar.progressBar.min | 
      
 
 
◆ nextUpdate
      
        
          | python.ProgressBar.progressBar.nextUpdate | 
      
 
 
◆ prefix
      
        
          | python.ProgressBar.progressBar.prefix | 
      
 
 
◆ progBar
      
        
          | python.ProgressBar.progressBar.progBar | 
      
 
 
◆ span
      
        
          | python.ProgressBar.progressBar.span | 
      
 
 
◆ suffix
      
        
          | python.ProgressBar.progressBar.suffix | 
      
 
 
◆ width
      
        
          | python.ProgressBar.progressBar.width | 
      
 
 
The documentation for this class was generated from the following file: