2009-27-09 Mark Doffman <mark.doffman@codethink.co.uk>
[platform/core/uifw/at-spi2-atk.git] / pyatspi / base.py
index ae097d1..7096d1b 100644 (file)
@@ -20,19 +20,43 @@ import interfaces
 
 __all__ = [
            "AccessibleObjectNoLongerExists",
+           "AccessibleObjectNotAvailable",
            "Enum",
            "BaseProxy",
+           "_repack_tuple",
           ]
 
 class AccessibleObjectNoLongerExists(Exception):
         pass
 
+class AccessibleObjectNotAvailable(Exception):
+        pass
+
+#------------------------------------------------------------------------------
+
+def _repack_tuple (tup):
+        """
+        Re-packs a tuple moving the last element to the beginning.
+        """
+        return (tup[-1] ,) + tup[:-1]
+
 #------------------------------------------------------------------------------
 
-class Enum(int):
+class Enum(dbus.UInt32):
         def __str__(self):
                 return self._enum_lookup[int(self)]
 
+        def __eq__(self, other):
+                if other is None:
+                        return False
+                if int(self) == int(other):
+                        return True
+                else:
+                        return False
+
+        def __hash__(self):
+                return int(self)
+
 #------------------------------------------------------------------------------
 
 
@@ -127,6 +151,9 @@ class BaseProxy(object):
         def __ne__(self, other):
                 return not self.__eq__(other)
 
+        def __hash__(self):
+                return hash(self._app_name + self._acc_path)
+
         def get_dbus_method(self, *args, **kwargs):
                 method =  self._dbus_object.get_dbus_method(*args, **kwargs)
 
@@ -170,4 +197,7 @@ class BaseProxy(object):
                                 "%s not supported by accessible object at path %s"
                                 % (interface, self._acc_path))
 
+        def flushCache(self):
+                pass
+
 #END----------------------------------------------------------------------------