[pyatspi2] Fix relationToString and remove relation.py



commit 3fa1b414965ada5bba2b06a00883313227dc62de
Author: Mike Gorse <mgorse novell com>
Date:   Thu Dec 2 08:26:31 2010 -0500

    Fix relationToString and remove relation.py

 pyatspi/Accessibility.py |    7 ++
 pyatspi/Makefile.am      |    1 -
 pyatspi/relation.py      |  140 ----------------------------------------------
 pyatspi/utils.py         |    4 +-
 4 files changed, 9 insertions(+), 143 deletions(-)
---
diff --git a/pyatspi/Accessibility.py b/pyatspi/Accessibility.py
index 43663d6..58ea369 100644
--- a/pyatspi/Accessibility.py
+++ b/pyatspi/Accessibility.py
@@ -314,6 +314,13 @@ RELATION_PARENT_WINDOW_OF = Atspi.RelationType.PARENT_WINDOW_OF
 RELATION_DESCRIPTION_FOR = Atspi.RelationType.DESCRIPTION_FOR
 RELATION_DESCRIBED_BY = Atspi.RelationType.DESCRIBED_BY
 
+# Build a dictionary mapping relation values to names based on the prefix of the enum constants.
+
+RELATION_VALUE_TO_NAME = dict(((value, name[9:].lower().replace('_', ' ')) 
+                               for name, value 
+                               in globals().items()
+                               if name.startswith('RELATION_')))
+
 ### ModifierType ###
 MODIFIER_SHIFT = Atspi.ModifierType.SHIFT
 MODIFIER_SHIFTLOCK = Atspi.ModifierType.SHIFTLOCK
diff --git a/pyatspi/Makefile.am b/pyatspi/Makefile.am
index 128e4ab..cb127be 100644
--- a/pyatspi/Makefile.am
+++ b/pyatspi/Makefile.am
@@ -19,7 +19,6 @@ pyatspi_PYTHON = \
 		__init__.py		\
 		interfaces.py		\
 		registry.py		\
-		relation.py		\
 		role.py			\
 		state.py		\
 		utils.py
diff --git a/pyatspi/utils.py b/pyatspi/utils.py
index 3143818..d505125 100644
--- a/pyatspi/utils.py
+++ b/pyatspi/utils.py
@@ -19,7 +19,7 @@
 
 #authors: Peter Parente, Mark Doffman
 
-#import relation
+import Accessibility
 import state
 import registry
 
@@ -153,7 +153,7 @@ def relationToString(value):
         @return: Human readable, untranslated name of the relation
         @rtype: string
         """
-        return relation.RELATION_VALUE_TO_NAME.get(value)
+        return Accessibility.RELATION_VALUE_TO_NAME.get(value)
 
 
 def findDescendant(acc, pred, breadth_first=False):



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]