Panda3D
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
EventGroup Class Reference
Inheritance diagram for EventGroup:
DirectObject

Public Member Functions

 __init__ (self, name, subEvents=None, doneEvent=None)
 
 __repr__ (self)
 
 addEvent (self, eventName)
 
 destroy (self)
 
 getDoneEvent (self)
 
 getName (self)
 
 isCompleted (self)
 
 newEvent (self, name)
 
- Public Member Functions inherited from DirectObject
 accept (self, event, method, extraArgs=[])
 
 acceptOnce (self, event, method, extraArgs=[])
 
 addTask (self, *args, **kwargs)
 
 detectLeaks (self)
 
 doMethodLater (self, *args, **kwargs)
 
 getAllAccepting (self)
 
 ignore (self, event)
 
 ignoreAll (self)
 
 isAccepting (self, event)
 
 isIgnoring (self, event)
 
 removeAllTasks (self)
 
 removeTask (self, taskOrName)
 

Protected Member Functions

 _signalComplete (self)
 
 _subEventComplete (self, subEventName, *args, **kwArgs)
 
- Protected Member Functions inherited from DirectObject
 _addTask (self, task)
 
 _clearTask (self, task)
 

Protected Attributes

 _completed
 
 _completedEvents
 
 _doneEvent
 
 _name
 
 _subEventComplete
 
 _subEvents
 
- Protected Attributes inherited from DirectObject
 _taskList
 

Static Protected Attributes

 _SerialNumGen = SerialNumGen()
 

Additional Inherited Members

- Static Public Attributes inherited from DirectObject
 accept_once = acceptOnce
 
 add_task = addTask
 
 detect_leaks = detectLeaks
 
 do_method_later = doMethodLater
 
 get_all_accepting = getAllAccepting
 
 ignore_all = ignoreAll
 
 is_accepting = isAccepting
 
 is_ignoring = isIgnoring
 
 remove_all_tasks = removeAllTasks
 
 remove_task = removeTask
 

Detailed Description

This class allows you to group together multiple events and treat
them as a single event. The EventGroup will not send out its event until
all of its sub-events have occured.

Constructor & Destructor Documentation

◆ __init__()

__init__ ( self,
name,
subEvents = None,
doneEvent = None )
Provide a meaningful name to aid debugging.

doneEvent is optional. If not provided, a unique done event will be
generated and is available as EventGroup.getDoneEvent().

Examples:

# waits for gotRed and gotBlue, then sends out 'gotColors'
EventGroup('getRedAndBlue', ('gotRed', 'gotBlue'), doneEvent='gotColors')

# waits for two interests to close, then calls self._handleBothInterestsClosed()
# uses EventGroup.getDoneEvent() and EventGroup.newEvent() to generate unique,
# disposable event names
eGroup = EventGroup('closeInterests')
self.acceptOnce(eGroup.getDoneEvent(), self._handleBothInterestsClosed)
base.cr.closeInterest(interest1, event=eGroup.newEvent('closeInterest1'))
base.cr.closeInterest(interest2, event=eGroup.newEvent('closeInterest2'))

Reimplemented from DirectObject.

Member Function Documentation

◆ __repr__()

__repr__ ( self)

◆ _signalComplete()

_signalComplete ( self)
protected

◆ _subEventComplete()

_subEventComplete ( self,
subEventName,
* args,
** kwArgs )
protected

◆ addEvent()

addEvent ( self,
eventName )
 Adds a new event to the list of sub-events that we're waiting on.
Returns the name of the event. 

◆ destroy()

destroy ( self)

◆ getDoneEvent()

getDoneEvent ( self)

◆ getName()

getName ( self)

◆ isCompleted()

isCompleted ( self)

◆ newEvent()

newEvent ( self,
name )
 Pass in an event name and it will be unique-ified for you and added
to this EventGroup. TIP: there's no need to repeat information in this event
name that is already in the name of the EventGroup object.
Returns the new event name. 

Member Data Documentation

◆ _completed

_completed
protected

◆ _completedEvents

_completedEvents
protected

◆ _doneEvent

_doneEvent
protected

◆ _name

_name
protected

◆ _SerialNumGen

_SerialNumGen = SerialNumGen()
staticprotected

◆ _subEventComplete

_subEventComplete
protected

◆ _subEvents

_subEvents
protected