Eidolon
|
Inherits object.
Public Member Functions | |
def | __init__ (self, label, func=None, args=(), kwargs={}, selfName=None, parentTask=None) |
def | start (self, useThread=False) |
def | isDone (self) |
def | setLabel (self, label) |
def | getLabel (self) |
def | setProgress (self, curprogress) |
def | setMaxProgress (self, maxprogress) |
def | getProgress (self) |
def | __repr__ (self) |
Static Public Member Functions | |
def | Null () |
Public Attributes | |
curprogress | |
maxprogress | |
result | |
completed | |
started | |
flushQueue | |
parentTask | |
func | |
args | |
kwargs | |
label | |
This class represents the abstract notion of a task, with a 'curprogress' value to indicate progress in relation to a 'maxprogress' value. Tasks may have their own threads or be executed by their containers. Normally tasks are executed by a TaskQueue object. The actual action of the Task object should be implemented by the supplied `func' argument, which must be a callable accepting the positional and keyword arguments given by `args' and `kwargs'. When a Task object is executed, it's start() method is called which will call self.func in the calling thread. A Task object can have a parent Task, which occurs when the body of one task invokes an operation that normally adds a task to a queue. When this occurs the progress and label methods call into the parent Task object.
def __init__ | ( | self, | |
label, | |||
func = None , |
|||
args = () , |
|||
kwargs = {} , |
|||
selfName = None , |
|||
parentTask = None |
|||
) |
def __repr__ | ( | self | ) |
def getLabel | ( | self | ) |
Get the task's label, or that of the parent if present.
def getProgress | ( | self | ) |
Returns the current progress value and maximum value, or that of the parent if present, or (0,0) if unknown.
def isDone | ( | self | ) |
Returns True if the task has started and self.complete is True.
|
static |
def setLabel | ( | self, | |
label | |||
) |
Set the task's label (or that of the parent if present), this will be used by UI to indicate current task.
def setMaxProgress | ( | self, | |
maxprogress | |||
) |
Set the max progress value of this or the parent task to the integer value `maxprogress'.
def setProgress | ( | self, | |
curprogress | |||
) |
Set the progress of this or the parent task to the integer value `curprogress'.
def start | ( | self, | |
useThread = False |
|||
) |
Perform the execution of the task. This will set the label, set self.started to True, and then set self.result to the result of calling self.func with self.args and self.kwargs as arguments. Finally self.complete is set to True once this is done.
args |
completed |
curprogress |
flushQueue |
func |
kwargs |
label |
maxprogress |
parentTask |
result |
started |