Public Member Functions | List of all members
EventGroup Class Reference
Inheritance diagram for EventGroup:

Public Member Functions

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

Additional Inherited Members

- Static Public Attributes inherited from DirectObject
def accept_once = acceptOnce
def add_task = addTask
def detect_leaks = detectLeaks
def do_method_later = doMethodLater
def get_all_accepting = getAllAccepting
def ignore_all = ignoreAll
def is_accepting = isAccepting
def is_ignoring = isIgnoring
def remove_all_tasks = removeAllTasks
def 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__()

def __init__ (   self,
  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().


# 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), event=eGroup.newEvent('closeInterest1')), event=eGroup.newEvent('closeInterest2'))

Member Function Documentation

◆ __repr__()

def __repr__ (   self)

◆ addEvent()

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

◆ destroy()

def destroy (   self)

◆ getDoneEvent()

def getDoneEvent (   self)

◆ getName()

def getName (   self)

◆ isCompleted()

def isCompleted (   self)

◆ newEvent()

def newEvent (   self,
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.