CMS 3D CMS Logo

Public Member Functions | Public Attributes | Static Public Attributes | Static Private Attributes

progressbar::FormatLabel Class Reference

Inheritance diagram for progressbar::FormatLabel:
progressbar::Timer progressbar::Widget

List of all members.

Public Member Functions

def __init__
def update

Public Attributes

 format

Static Public Attributes

dictionary mapping

Static Private Attributes

tuple __slots__ = ('format',)

Detailed Description

Definition at line 132 of file progressbar.py.


Constructor & Destructor Documentation

def progressbar::FormatLabel::__init__ (   self,
  format 
)

Reimplemented from progressbar::Timer.

Definition at line 146 of file progressbar.py.

00147                               :
00148         self.format = format


Member Function Documentation

def progressbar::FormatLabel::update (   self,
  pbar 
)
Updates the widget.

pbar - a reference to the calling ProgressBar

Reimplemented from progressbar::Timer.

Definition at line 149 of file progressbar.py.

00150                           :
00151         context = {}
00152         for name, (key, transform) in self.mapping.items():
00153             try:
00154                 value = getattr(pbar, key)
00155 
00156                 if transform is None:
00157                     context[name] = value
00158                 else:
00159                     context[name] = transform(value)
00160             except: pass
00161 
00162         return self.format % context


Member Data Documentation

tuple progressbar::FormatLabel::__slots__ = ('format',) [static, private]

Reimplemented from progressbar::Timer.

Definition at line 145 of file progressbar.py.

Reimplemented from progressbar::Timer.

Definition at line 146 of file progressbar.py.

dictionary progressbar::FormatLabel::mapping [static]
Initial value:
{
        'elapsed': ('seconds_elapsed', Timer.format_time),
        'finished': ('finished', None),
        'last_update': ('last_update_time', None),
        'max': ('maxval', None),
        'seconds': ('seconds_elapsed', None),
        'start': ('start_time', None),
        'value': ('currval', None)
    }

Definition at line 135 of file progressbar.py.