[pyatspi2] Cache an eventType created for an event
- From: Mike Gorse <mgorse src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pyatspi2] Cache an eventType created for an event
- Date: Fri, 27 May 2011 04:31:59 +0000 (UTC)
commit b9bd51bc1c1fd0e8fae35fb1f1e7c031889957b1
Author: Mike Gorse <mgorse novell com>
Date: Thu May 26 23:31:29 2011 -0500
Cache an eventType created for an event
Creating an eventType seems to be expensive, so avoid doing this multiple
times for a single event.
pyatspi/Accessibility.py | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/pyatspi/Accessibility.py b/pyatspi/Accessibility.py
index 865930a..ec67cbc 100644
--- a/pyatspi/Accessibility.py
+++ b/pyatspi/Accessibility.py
@@ -103,7 +103,11 @@ def hashToAttributeList(h):
return [x + ":" + h[x] for x in h.keys()]
def getEventType(event):
- return EventType(event.rawType)
+ try:
+ return event.pyType
+ except:
+ event.pyType = EventType(event.rawType)
+ return event.pyType
def DeviceEvent_str(self):
'''
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]