[pyatspi2] Fixes to get Orca running with refactored pyatspi.



commit 34f0beb954407e8bccb3e0ac6dcd1029a13b7297
Author: Mark Doffman <mark doffman codethink co uk>
Date:   Wed Oct 28 17:43:50 2009 +0000

    Fixes to get Orca running with refactored pyatspi.

 pyatspi/appevent.py    |   12 ++++++++++--
 pyatspi/cache.py       |    4 ++--
 pyatspi/deviceevent.py |    4 +++-
 pyatspi/loop.py        |    5 +++--
 pyatspi/registry.py    |    2 +-
 pyatspi/settings.py    |    5 +++--
 6 files changed, 22 insertions(+), 10 deletions(-)
---
diff --git a/pyatspi/appevent.py b/pyatspi/appevent.py
index 701f8c1..a75edad 100644
--- a/pyatspi/appevent.py
+++ b/pyatspi/appevent.py
@@ -262,7 +262,9 @@ class Event(object):
 
 class _ApplicationEventRegister (object):
 
-        def __init__ (self):
+        def __init__ (self, bus):
+                self._bus = bus
+                self._cache = None
                 self._event_listeners = {}
 
                 # All of this special casing is for the 'faked'
@@ -281,6 +283,9 @@ class _ApplicationEventRegister (object):
                 for client in register.keys():
                         client(event)
 
+        def setCache (self, cache):
+                self._cache = cache
+
         def notifyNameChange(self, event):
                 self._callClients(self._name_listeners, event)
 
@@ -346,7 +351,7 @@ class _ApplicationEventRegister (object):
                 for name in names:
                         new_type = EventType(name)
                         registered.append((new_type.name,
-                                           _event_type_to_signal_reciever(self._bus, self._app_cache, client, new_type)))
+                                           event_type_to_signal_reciever(self._bus, self._cache, client, new_type)))
 
                 self._registerFake(self._name_type, self._name_listeners, client, *names)
                 self._registerFake(self._description_type, self._description_listeners, client, *names)
@@ -391,6 +396,9 @@ class _ApplicationEventRegister (object):
 
 class _NullApplicationEventRegister (object):
 
+        def setCache (self, cache):
+                pass
+
         def notifyNameChange(self, event):
                 pass
 
diff --git a/pyatspi/cache.py b/pyatspi/cache.py
index 14156e5..5761767 100644
--- a/pyatspi/cache.py
+++ b/pyatspi/cache.py
@@ -119,8 +119,8 @@ class ApplicationCache(object):
                         if bus_name != self._connection.get_unique_name ():
                                 self._application_list.append(bus_name)
                                 self._application_cache[bus_name] = AccessibleCache(self._event_dispatcher,
-                                                                                   self._connection,
-                                                                                   bus_name)
+                                                                                    self._connection,
+                                                                                    bus_name)
                                 event = Event(self,
                                                ATSPI_DESKTOP_PATH,
                                                ATSPI_REGISTRY_NAME,
diff --git a/pyatspi/deviceevent.py b/pyatspi/deviceevent.py
index acacffa..b1b233b 100644
--- a/pyatspi/deviceevent.py
+++ b/pyatspi/deviceevent.py
@@ -520,7 +520,9 @@ class KeyboardDeviceEventListener(_service.Object):
 
 class _DeviceEventRegister (object):
         
-        def __init__ (self):
+        def __init__ (self, bus):
+                self.dev = DeviceEventController (bus)
+                self._bus = bus
                 self.deviceClients = {}
 
         def registerKeystrokeListener(self,
diff --git a/pyatspi/loop.py b/pyatspi/loop.py
index ee7f1e8..fb19e2a 100644
--- a/pyatspi/loop.py
+++ b/pyatspi/loop.py
@@ -36,12 +36,13 @@ class GObjectMain (object):
                 from dbus.mainloop.glib import DBusGMainLoop
                 DBusGMainLoop (set_as_default=True)
                 del DBusGMainLoop
+                self._loop = gobject.MainLoop()
         
         def run (self):
-                gobject.MainLoop.run()
+                self._loop.run()
 
         def stop (self):
-                gobject.MainLoop.quit()
+                self._loop.quit()
 
 class GObjectProxy (dbus.connection.ProxyObject):
         
diff --git a/pyatspi/registry.py b/pyatspi/registry.py
index c5efc7d..ae3b111 100644
--- a/pyatspi/registry.py
+++ b/pyatspi/registry.py
@@ -82,7 +82,7 @@ class Registry(object):
                 @type gil: boolean
                 """
                 try:
-                        self._main_loop.run()
+                        self.main_loop.run()
                 except KeyboardInterrupt:
                         pass
 
diff --git a/pyatspi/settings.py b/pyatspi/settings.py
index b102d7b..b40a16b 100644
--- a/pyatspi/settings.py
+++ b/pyatspi/settings.py
@@ -72,8 +72,8 @@ def get_registry (main_loop_type, app_name=None):
                 devreg = _NullDeviceEventRegister()
                 appreg = _NullApplicationEventRegister()
         else:
-                devreg = _DeviceEventRegister()
-                appreg = _ApplicationEventRegister()
+                devreg = _DeviceEventRegister(connection)
+                appreg = _ApplicationEventRegister(connection)
 
         # Set up the cache / desktop and accesible factories.
         if main_loop_type == MAIN_LOOP_GLIB:
@@ -81,6 +81,7 @@ def get_registry (main_loop_type, app_name=None):
                         cache = AccessibleCache(appreg, connection, app_name)
                 else:
                         cache = ApplicationCache(appreg, connection)
+                appreg.setCache (cache)
                 factory = CachedAccessibleFactory (cache, connection, proxy)
                 desktop = CachedDesktop (cache, factory)
 



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