Logo Search packages:      
Sourcecode: babiloo version File versions  Download package

babiloo-2.0.11::core::modules::progressbar::ProgressBar Class Reference

List of all members.


Detailed Description

This is the ProgressBar class, it updates and prints the bar.

The term_width parameter may be an integer. Or None, in which case
it will try to guess it, if it fails it will default to 80 columns.

The simple use is like this:
>>> pbar = ProgressBar().start()
>>> for i in xrange(100):
...    # do something
...    pbar.update(i+1)
...
>>> pbar.finish()

But anything you want to do is possible (well, almost anything).
You can supply different widgets of any type in any order. And you
can even write your own widgets! There are many widgets already
shipped and you should experiment with them.

When implementing a widget update method you may access any
attribute or function of the ProgressBar object calling the
widget's update method. The most important attributes you would
like to access are:
- currval: current value of the progress, 0 <= currval <= maxval
- maxval: maximum (and final) value of the progress
- finished: True if the bar is have finished (reached 100%), False o/w
- start_time: first time update() method of ProgressBar was called
- seconds_elapsed: seconds elapsed since start_time
- percentage(): percentage of the progress (this is a method)

Definition at line 186 of file progressbar.py.


Public Member Functions

def __init__
def finish
def handle_resize
def percentage
def set_maxval
def start
def update

Public Attributes

 currval
 fd
 finished
 maxval
 prev_percentage
 seconds_elapsed
 signal_set
 start_time
 term_width
 widgets

Private Member Functions

def _format_line
def _format_widgets
def _need_update

The documentation for this class was generated from the following file:

Generated by  Doxygen 1.6.0   Back to index