CMS 3D CMS Logo

Public Member Functions | Public Attributes | Static Private Attributes

progressbar::Bar Class Reference

Inheritance diagram for progressbar::Bar:
progressbar::WidgetHFill progressbar::Widget progressbar::BouncingBar

List of all members.

Public Member Functions

def __init__
def update

Public Attributes

 fill
 fill_left
 left
 marker
 right

Static Private Attributes

tuple __slots__ = ('marker', 'left', 'right', 'fill', 'fill_left')

Detailed Description

Definition at line 72 of file progressbar.py.


Constructor & Destructor Documentation

def progressbar::Bar::__init__ (   self,
  marker = '#',
  left = '|',
  right = '|',
  fill = ' ',
  fill_left = True 
)
Creates a customizable progress bar.

marker - string or updatable object to use as a marker
left - string or updatable object to use as a left border
right - string or updatable object to use as a right border
fill - character to use for the empty part of the progress bar
fill_left - whether to fill from the left or the right

Definition at line 77 of file progressbar.py.

00079                                 :
00080         '''Creates a customizable progress bar.
00081 
00082         marker - string or updatable object to use as a marker
00083         left - string or updatable object to use as a left border
00084         right - string or updatable object to use as a right border
00085         fill - character to use for the empty part of the progress bar
00086         fill_left - whether to fill from the left or the right
00087         '''
00088         self.marker = marker
00089         self.left = left
00090         self.right = right
00091         self.fill = fill
00092         self.fill_left = fill_left
00093 


Member Function Documentation

def progressbar::Bar::update (   self,
  pbar,
  width 
)
Updates the widget providing the total width the widget must fill.

pbar - a reference to the calling ProgressBar
width - The total width the widget must fill

Reimplemented from progressbar::WidgetHFill.

Reimplemented in progressbar::BouncingBar.

Definition at line 94 of file progressbar.py.

00095                                  :
00096         'Updates the progress bar and its subcomponents'
00097 
00098         left, marked, right = (format_updatable(i, pbar) for i in
00099             (self.left, self.marker, self.right))
00100 
00101         width -= len(left) + len(right)
00102         # Marked must *always* have length of 1
00103         if pbar.maxval:
00104             marked *= int(pbar.currval / pbar.maxval * width)
00105         else:
00106             marked = ''
00107 
00108         if self.fill_left:
00109             return '%s%s%s' % (left, marked.ljust(width, self.fill), right)
00110         else:
            return '%s%s%s' % (left, marked.rjust(width, self.fill), right)

Member Data Documentation

tuple progressbar::Bar::__slots__ = ('marker', 'left', 'right', 'fill', 'fill_left') [static, private]

Reimplemented from progressbar::Widget.

Definition at line 75 of file progressbar.py.

Definition at line 84 of file progressbar.py.

Definition at line 84 of file progressbar.py.

Definition at line 84 of file progressbar.py.

Definition at line 84 of file progressbar.py.

Definition at line 84 of file progressbar.py.