|
Panda3D
|
Public Member Functions | |
| __init__ (self) | |
| __repr__ (self) | |
| accept (self, event, object, method, extraArgs=[], persistent=1) | |
| clear (self) | |
| detailedRepr (self) | |
| find (self, needle) | |
| findAll (self, needle, limit=None) | |
| future (self, event) | |
| getAllAccepting (self, object) | |
| getEvents (self) | |
| ignore (self, event, object) | |
| ignoreAll (self, object) | |
| isAccepting (self, event, object) | |
| isEmpty (self) | |
| isIgnoring (self, event, object) | |
| quiet (self, message) | |
| replaceMethod (self, oldMethod, newFunction) | |
| send (self, event, sentArgs=[], taskChain=None) | |
| toggleVerbose (self) | |
| unquiet (self, message) | |
| unwatch (self, needle) | |
| watch (self, needle) | |
| whoAccepts (self, event) | |
Public Attributes | |
| lock = Lock() | |
| dict | quieting |
Static Public Attributes | |
| detailed_repr = detailedRepr | |
| find_all = findAll | |
| get_all_accepting = getAllAccepting | |
| get_events = getEvents | |
| ignore_all = ignoreAll | |
| is_accepting = isAccepting | |
| is_empty = isEmpty | |
| is_ignoring = isIgnoring | |
| notify = DirectNotifyGlobal.directNotify.newCategory("Messenger") | |
| replace_method = replaceMethod | |
| toggle_verbose = toggleVerbose | |
| who_accepts = whoAccepts | |
Protected Member Functions | |
| _getEvents (self) | |
| _getMessengerId (self, object) | |
| _getNumListeners (self, event) | |
| _getObject (self, id) | |
| _getObjects (self) | |
| _releaseObject (self, object) | |
| _storeObject (self, object) | |
Protected Attributes | |
| dict | _eventQueuesByTaskChain = {} |
| dict | _id2object = {} |
| int | _messengerIdGen = 0 |
| __init__ | ( | self | ) |
One is keyed off the event name. It has the following structure::
{event1: {object1: [method, extraArgs, persistent],
object2: [method, extraArgs, persistent]},
event2: {object1: [method, extraArgs, persistent],
object2: [method, extraArgs, persistent]}}
This dictionary allows for efficient callbacks when the
messenger hears an event.
A second dictionary remembers which objects are accepting which
events. This allows for efficient ignoreAll commands.
Or, for an example with more real data::
{'mouseDown': {avatar: [avatar.jump, [2.0], 1]}}
| __repr__ | ( | self | ) |
Compact version of event, acceptor pairs
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
| accept | ( | self, | |
| event, | |||
| object, | |||
| method, | |||
| extraArgs = [], | |||
| persistent = 1 ) |
accept(self, string, DirectObject, Function, List, Boolean) Make this object accept this event. When the event is sent (using Messenger.send or from C++), method will be executed, optionally passing in extraArgs. If the persistent flag is set, it will continue to respond to this event, otherwise it will respond only once.
| clear | ( | self | ) |
Start fresh with a clear dict
Reimplemented in NetMessenger.
| detailedRepr | ( | self | ) |
Print out the table in a detailed readable format
| find | ( | self, | |
| needle ) |
return a matching event (needle) if found (in haystack). This is primarily a debugging tool.
| findAll | ( | self, | |
| needle, | |||
| limit = None ) |
return a dict of events (needle) if found (in haystack). limit may be None or an integer (e.g. 1). This is primarily a debugging tool.
| future | ( | self, | |
| event ) |
Returns a future that is triggered by the given event name. This will function only once.
| getAllAccepting | ( | self, | |
| object ) |
Returns the list of all events accepted by the indicated object.
| getEvents | ( | self | ) |
| ignore | ( | self, | |
| event, | |||
| object ) |
ignore(self, string, DirectObject) Make this object no longer respond to this event. It is safe to call even if it was not already accepting
| ignoreAll | ( | self, | |
| object ) |
Make this object no longer respond to any events it was accepting Useful for cleanup
| isAccepting | ( | self, | |
| event, | |||
| object ) |
isAccepting(self, string, DirectOject) Is this object accepting this event?
| isEmpty | ( | self | ) |
| isIgnoring | ( | self, | |
| event, | |||
| object ) |
isIgnorning(self, string, DirectObject) Is this object ignoring this event?
| quiet | ( | self, | |
| message ) |
When verbose mode is on, don't spam the output with messages marked as quiet. This is primarily a debugging tool. This is intended for debugging use only. This function is not defined if python is ran with -O (optimize). See Also: `unquiet`
| replaceMethod | ( | self, | |
| oldMethod, | |||
| newFunction ) |
This is only used by Finder.py - the module that lets you redefine functions with Control-c-Control-v
| send | ( | self, | |
| event, | |||
| sentArgs = [], | |||
| taskChain = None ) |
Send this event, optionally passing in arguments.
Args:
event (str): The name of the event.
sentArgs (list): A list of arguments to be passed along to the
handlers listening to this event.
taskChain (str, optional): If not None, the name of the task chain
which should receive the event. If None, then the event is
handled immediately. Setting a non-None taskChain will defer
the event (possibly till next frame or even later) and create a
new, temporary task within the named taskChain, but this is the
only way to send an event across threads.
Reimplemented in NetMessenger.
| toggleVerbose | ( | self | ) |
| unquiet | ( | self, | |
| message ) |
Remove a message from the list of messages that are not reported in verbose mode. This is primarily a debugging tool. This is intended for debugging use only. This function is not defined if python is ran with -O (optimize). See Also: `quiet`
| unwatch | ( | self, | |
| needle ) |
return a matching event (needle) if found (in haystack). This is primarily a debugging tool. This is intended for debugging use only. This function is not defined if python is ran with -O (optimize). See Also: `watch`
| watch | ( | self, | |
| needle ) |
return a matching event (needle) if found (in haystack). This is primarily a debugging tool. This is intended for debugging use only. This function is not defined if python is ran with -O (optimize). See Also: `unwatch`
| whoAccepts | ( | self, | |
| event ) |
Return objects accepting the given event
|
protected |
|
protected |
|
protected |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
| lock = Lock() |
|
static |
| dict quieting |
|
static |
|
static |
|
static |