49 |
except KeyError: |
except KeyError: |
50 |
self.__incomingEvents[event] = [events[event]] |
self.__incomingEvents[event] = [events[event]] |
51 |
|
|
52 |
|
def startCachingEvents(self): |
53 |
|
self.__cache = [] |
54 |
|
|
55 |
|
def stopCachingEvents(self): |
56 |
|
cache = self.__cache |
57 |
|
del self.__cache |
58 |
|
for event, arg, parms in cache: |
59 |
|
self.dispatchEvent(event, *arg, **parms) |
60 |
|
|
61 |
def dispatchEvent(self, event, *args, **parms): |
def dispatchEvent(self, event, *args, **parms): |
62 |
# Hackery so dispatchEvent can be passed |
|
63 |
# either an Event() object, or a text string |
# If we are caching our events, cache it: |
64 |
|
try: |
65 |
|
self.__cache.append((event, args, parms)) |
66 |
|
return |
67 |
|
except AttributeError: |
68 |
|
pass |
69 |
|
|
70 |
|
# Hackery so dispatchEvent can be passed |
71 |
|
# either an Event() object, or a text string |
72 |
# identifying the type of event. If the |
# identifying the type of event. If the |
73 |
# latter, an event is created on the fly. |
# latter, an event is created on the fly. |
74 |
try: |
try: |