Eidolon
Public Member Functions | Public Attributes | Private Member Functions | List of all members
EventHandler Class Reference

Inherits object.

Collaboration diagram for EventHandler:
Collaboration graph

Public Member Functions

def __init__ (self)
 
def addEventHandler (self, name, cb, isPriority=False, isPostEvent=False)
 
def removeEventHandler (self, cb)
 

Public Attributes

 eventHandlers
 
 eventPostHandlers
 
 handleLock
 
 suppressedEvents
 

Private Member Functions

def _triggerEvent (self, name, args)
 

Detailed Description

Event broadcast class which invokes callable objects when an EventType event occurs. For every named event, this
maintains a list of callback callable objects which accept a set of parameters specific for each event type. When
_triggerEvent() is called, each callback associated with the given event name is called with the given arguments
passed in. If the callback returns True then subsequent callbacks for that type are ignored. A second list of post
event handlers is also maintained which is processed after regular events with the return value ignored. This can be
used to register events which must occur last and which must not be skipped.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self)

Member Function Documentation

◆ _triggerEvent()

def _triggerEvent (   self,
  name,
  args 
)
private
Broadcast event to handler callback functions, stopping for any regular callback that returns True. For every 
callback associated with event `name', call it expanding `args' as the arguments. This must be called in the 
main thread. Callbacks stored as post event handlers are called after regular ones with the stop feature ignored.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addEventHandler()

def addEventHandler (   self,
  name,
  cb,
  isPriority = False,
  isPostEvent = False 
)
Add the callback callable `cb' for event named `name'. If `isPriority', `cb' is placed at the start of the event 
list, and the end otherwise. If `isPostEvent' is True then `cb' is added as a post event callback which is then
called after regular callbacks with the return value ignored, ie. always gets called.

◆ removeEventHandler()

def removeEventHandler (   self,
  cb 
)
Remove the callback `cb' from wherever it occurs.

Member Data Documentation

◆ eventHandlers

eventHandlers

◆ eventPostHandlers

eventPostHandlers

◆ handleLock

handleLock

◆ suppressedEvents

suppressedEvents

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