Class p.u.g.AsyncTask(object):

Part of pida.utils.gthreads View In Hierarchy

Known subclasses: pida.utils.gthreads.GeneratorTask

AsyncTask is used to help you perform lengthy tasks without delaying the UI loop cycle, causing the app to look frozen. It is also assumed that each action that the async worker performs cancels the old one (if it's still working), thus there's no problem when the task takes too long. You can either extend this class or pass two callable objects through its constructor.

The first on is the 'work_callback' this is where the lengthy operation must be performed. This object may return an object or a group of objects, these will be passed onto the second callback 'loop_callback'. You must be aware on how the argument passing is done. If you return an object that is not a tuple then it's passed directly to the loop callback. If you return None no arguments are supplied. If you return a tuple object then these will be the arguments sent to the loop callback.

The loop callback is called inside Gtk+'s main loop and it's where you should stick code that affects the UI.

Line # Kind Name Docs
49 Method __init__ Undocumented
57 Method start Please note that start is not thread safe. It is assumed that this
66 Method work_callback Undocumented
69 Method loop_callback Undocumented
72 Method _work_callback Undocumented
76 Method _loop_callback Undocumented
def __init__(self, work_callback=None, loop_callback=None):
Undocumented
def start(self, *args, **kwargs):
Please note that start is not thread safe. It is assumed that this method is called inside gtk's main loop there for the lock is taken care there.
def work_callback(self):
Undocumented
def loop_callback(self):
Undocumented
def _work_callback(self, counter, *args, **kwargs):
Undocumented
def _loop_callback(self, vargs):
Undocumented
API Documentation for PIDA, generated by pydoctor.