Panda3D
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties
Public Member Functions | Static Public Member Functions
PythonTask Class Reference

This class exists to allow association of a Python function with the AsyncTaskManager. More...

Inheritance diagram for PythonTask:
AsyncTask AsyncTaskBase TypedReferenceCount Namable TypedObject ReferenceCount

List of all members.

Public Member Functions

 PythonTask (PyObject function, string name)
 PythonTask (PyObject function)
 PythonTask ()
PyObject getArgs ()
 Returns the argument list that is passed to the task function.
PyObject getattr (string attr_name)
 Maps from an expression like "task.attr_name".
PyObject getFunction ()
 Returns the function that is called when the task runs.
PyObject getOwner ()
 Returns the "owner" object.
PyObject getUponDeath ()
 Returns the function that is called when the task finishes.
 operator new (unsigned int size)
 setArgs (PyObject args, bool append_task)
 Replaces the argument list that is passed to the task function.
int setattr (string attr_name)
 Maps from an expression like "del task.attr_name".
int setattr (string attr_name, PyObject v)
 Maps from an expression like "task.attr_name = v".
 setFunction (PyObject function)
 Replaces the function that is called when the task runs.
 setOwner (PyObject owner)
 Specifies a Python object that serves as the "owner" for the task.
 setUponDeath (PyObject upon_death)
 Replaces the function that is called when the task finishes.

Static Public Member Functions

static TypeHandle getClassType ()

Detailed Description

This class exists to allow association of a Python function with the AsyncTaskManager.


Constructor & Destructor Documentation

PythonTask ( PyObject  function,
string  name 
)
PythonTask ( PyObject  function)

Member Function Documentation

PyObject getArgs ( )

Returns the argument list that is passed to the task function.

PyObject getattr ( string  attr_name)

Maps from an expression like "task.attr_name".

This is customized here so we can support some traditional task interfaces that supported directly querying certain values. We also support adding arbitrary data to the Task object.

static TypeHandle getClassType ( ) [static]

Reimplemented from AsyncTask.

PyObject getFunction ( )

Returns the function that is called when the task runs.

PyObject getOwner ( )

Returns the "owner" object.

See set_owner().

PyObject getUponDeath ( )

Returns the function that is called when the task finishes.

operator new ( unsigned int  size)
setArgs ( PyObject  args,
bool  append_task 
)

Replaces the argument list that is passed to the task function.

The parameter should be a tuple or list of arguments, or None to indicate the empty list.

int setattr ( string  attr_name)

Maps from an expression like "del task.attr_name".

This is customized here so we can support some traditional task interfaces that supported directly assigning certain values. We also support adding arbitrary data to the Task object.

int setattr ( string  attr_name,
PyObject  v 
)

Maps from an expression like "task.attr_name = v".

This is customized here so we can support some traditional task interfaces that supported directly assigning certain values. We also support adding arbitrary data to the Task object.

setFunction ( PyObject  function)

Replaces the function that is called when the task runs.

The parameter should be a Python callable object.

setOwner ( PyObject  owner)

Specifies a Python object that serves as the "owner" for the task.

This owner object must have two methods: _addTask() and _clearTask(), which will be called with one parameter, the task object.

owner._addTask() is called when the task is added into the active task list, and owner._clearTask() is called when it is removed.

setUponDeath ( PyObject  upon_death)

Replaces the function that is called when the task finishes.

The parameter should be a Python callable object.

 All Classes Namespaces Functions Variables Enumerations Enumerator Properties