2008-10-28 Mark Doffman <mark.doffman@codethink.co.uk>
authorMark Doffman <mdoff@silver-wind.(none)>
Tue, 28 Oct 2008 16:39:30 +0000 (16:39 +0000)
committerMark Doffman <mdoff@silver-wind.(none)>
Tue, 28 Oct 2008 16:39:30 +0000 (16:39 +0000)
        * pyatspi/Makefile.am
        Add missing files.

        * pyatspi/*.py
        Changes to event name translation and
        equality checks neccessary to get orca to talk
        using new pyatspi.

pyatspi/Makefile.am
pyatspi/base.py
pyatspi/constants.py
pyatspi/desktop.py
pyatspi/event.py

index c204ab4..f7bf95a 100644 (file)
@@ -2,10 +2,11 @@ pyatspidir = $(pythondir)/pyatspi
 pyatspi_PYTHON = \
                Accessibility.py        \
                accessible.py           \
+               accessiblecache.py      \
                action.py               \
                application.py          \
+               applicationcache.py     \
                base.py                 \
-               cache.py                \
                collection.py           \
                component.py            \
                constants.py            \
@@ -28,7 +29,6 @@ pyatspi_PYTHON = \
                state.py                \
                streamablecontent.py    \
                table.py                \
-               test.py                 \
                text.py                 \
                utils.py                \
                value.py
index a6f993b..0c62530 100644 (file)
@@ -113,8 +113,11 @@ class BaseProxy(object):
                               return '[DEAD]'
 
         def __eq__(self, other):
+                if other is None:
+                        return False
+
                 if self._app_name == other._app_name and \
-                   self._acc_path == other._app_path:
+                   self._acc_path == other._acc_path:
                         return True
                 else:
                         return False
index 006723c..eab731c 100644 (file)
@@ -45,6 +45,8 @@ CACHE_EVENTS = ['object:property-change:accessible-name',
                 'object:property-change:accessible-role',
                 'object:property-change:accessible-parent']
 
+CACHE_PROPERTIES = ""
+
 # Dictionary used to correct the bug of not being able to register for all the
 # subevents given only an AT-SPI event class (i.e. first part of the event
 # name) keys are event names having subevents and values are the subevents
index 1abfce2..a75cf92 100644 (file)
@@ -177,8 +177,11 @@ class Desktop(object):
                         return self.getChildAtIndex(index)
 
         def __eq__(self, other):
+                if other is None:
+                        return False
+
                 if self._app_name == other._app_name and \
-                   self._acc_path == other._app_path:
+                   self._acc_path == other._acc_path:
                         return True
                 else:
                         return False
@@ -351,6 +354,6 @@ class Desktop(object):
                 else:
                                 raise NotImplementedError(
                                                 "%s not supported by accessible object at path %s"
-                                                % (interface, self.path))
+                                                % (interface, self._acc_path))
 
 #END----------------------------------------------------------------------------
index 4f66857..1065f20 100644 (file)
@@ -93,8 +93,6 @@ class EventType(str):
                 self.minor = self._separated[2]
                 self.detail = self._separated[3]
 
-                self._name = ":".join(separated)
-
         def is_subtype(self, event_type):
                 """
                 Determines if the passed event type is a subtype
@@ -112,11 +110,11 @@ class EventType(str):
 
         @property
         def name(self):
-                return self._name
+                return str(self)
 
         @property
         def value(self):
-                return self._name
+                return str(self)
 
 #------------------------------------------------------------------------------
 
@@ -145,6 +143,22 @@ def event_type_to_signal_reciever(bus, cache, event_handler, event_type):
 
 #------------------------------------------------------------------------------
 
+def signal_spec_to_event_string (interface, name, minor):
+        interface = _interface_to_klass[interface]
+        name = name.replace('_', '-')
+
+        if interface == "focus":
+                return "focus:"
+
+        result = interface + ':'
+        if name:
+                result += name + ':'
+        if minor:
+                result += minor
+        return result
+
+#------------------------------------------------------------------------------
+
 class Event(object):
         """
         Wraps an AT-SPI event with a more Pythonic interface managing exceptions,
@@ -191,12 +205,8 @@ class Event(object):
                 self._source = None
                 self._application = None
 
-                self._klass = _interface_to_klass[interface]
-                # The replace is neccessary as '-' not legal as signal name
-                # so translated on the server side.
-                self._major = name.replace('_', '-')
-                self._minor = event[0]
-                self.type = EventType(':'.join([self._klass, self._major, self._minor]))
+                self.type = EventType(signal_spec_to_event_string(interface, name, event[0]))
+
                 self.detail1 = event[1]
                 self.detail2 = event[2]