[pyatspi2] Fixes to the Test desktop allowing the unit tests to be run



commit 82956655576cabbc382e7468022562223eadd116
Author: Mark Doffman <mark doffman codethink co uk>
Date:   Wed Dec 9 23:06:16 2009 -0800

    Fixes to the Test desktop allowing the unit tests to be run
    in non-cached mode.

 pyatspi/accessible.py     |    3 ++-
 pyatspi/busutils/bus.py   |    2 --
 pyatspi/busutils/proxy.py |    1 -
 pyatspi/desktop.py        |   36 +++++++++++++++++++-----------------
 4 files changed, 21 insertions(+), 21 deletions(-)
---
diff --git a/pyatspi/accessible.py b/pyatspi/accessible.py
index cd0f667..e98b62e 100644
--- a/pyatspi/accessible.py
+++ b/pyatspi/accessible.py
@@ -263,8 +263,9 @@ class AccessibleImpl (BaseProxy):
                 return self._pgetter(self.dbus_interface, "Name")
 
         def get_parent(self):
+		name, path = self._pgetter (self.dbus_interface, "Parent")
                 return self.acc_factory.create_accessible(self._app_name,
-                                                          self._pgetter (self.dbus_interface, "Parent"),
+                                                          path,
                                                           ATSPI_ACCESSIBLE)
 
         def get_interfaces (self):
diff --git a/pyatspi/busutils/bus.py b/pyatspi/busutils/bus.py
index 8717e4c..9646153 100644
--- a/pyatspi/busutils/bus.py
+++ b/pyatspi/busutils/bus.py
@@ -101,7 +101,6 @@ class AccessibilityBus (_AccessibilityBus):
 			try:
 				AccessibilityBus._shared_instance = _AccessibilityBus.__new__ (cls, _get_accessibility_bus_address(), None)
 			except Exception:
-				print "AT-SPI: Could not find accessibility bus, using session bus"
 				AccessibilityBus._shared_instance = _AccessibilityBus.__new__ (cls, _bus.BusConnection.TYPE_SESSION, None)
 			
 			return AccessibilityBus._shared_instance
@@ -110,5 +109,4 @@ class AccessibilityBus (_AccessibilityBus):
 		try:
 			_AccessibilityBus.__init__ (self, _get_accessibility_bus_address(), None)
 		except Exception:
-			print "AT-SPI: Could not find accessibility bus, using session bus"
 			_AccessibilityBus.__init__ (self, _bus.BusConnection.TYPE_SESSION, None)
diff --git a/pyatspi/busutils/proxy.py b/pyatspi/busutils/proxy.py
index 0d9fb0a..42b5abc 100644
--- a/pyatspi/busutils/proxy.py
+++ b/pyatspi/busutils/proxy.py
@@ -14,7 +14,6 @@
 
 import dbus.connection as _connection
 import gobject
-import gtk
 
 import Queue
 
diff --git a/pyatspi/desktop.py b/pyatspi/desktop.py
index 34ac529..2d9c7dc 100644
--- a/pyatspi/desktop.py
+++ b/pyatspi/desktop.py
@@ -413,22 +413,26 @@ class TestDesktop (BaseDesktop):
         _TREE_PATH = '/org/freedesktop/atspi/tree'
         _TREE_INTERFACE = 'org.freedesktop.atspi.Tree'
 
-        def __init__(self, app_name):
-                Accessible.__init__(self, *args);
+        def __init__(self, app_name, factory):
+                BaseDesktop.__init__(self, factory);
                 obj = AccessibilityBus().get_object (app_name,
                                                      self._TREE_PATH)
                 tree = dbus.Interface (obj, self._TREE_INTERFACE)
 
                 self._single_app = app_name
-                self._root = self.tree.getRoot ()
+                self._root = tree.GetRoot ()
 
         def getChildAtIndex(self, index):
-                return self.create_application (self._root)
+		#TODO - Check index
+                return self._acc_factory.create_accessible (self._single_app,
+                                                            self._root,
+                                                            interfaces.ATSPI_APPLICATION)
 
         def create_application (self, app_name):
-                return self.acc_factory.create_accessible (app_name,
-                                                           self._root,
-                                                           interfaces.ATSPI_APPLICATION)
+		#TODO - Check name
+                return self._acc_factory.create_accessible (self._single_app,
+                                                            self._root,
+                                                            interfaces.ATSPI_APPLICATION)
 
         def get_childCount(self):
                 return 1
@@ -445,32 +449,30 @@ class Desktop (BaseDesktop):
         _TREE_PATH = '/org/freedesktop/atspi/tree'
         _TREE_INTERFACE = 'org.freedesktop.atspi.Tree'
 
-        def __init__(self, connection, *args):
+        def __init__(self, *args):
                 BaseDesktop.__init__(self, *args);
 
-                self._connection = connection
-                obj = connection.get_object(interfaces.ATSPI_REGISTRY_NAME,
-                                            interfaces.ATSPI_REGISTRY_PATH,
-                                            introspect=False)
+                self._connection = AccessibilityBus()
+                obj = self._connection.get_object(interfaces.ATSPI_REGISTRY_NAME,
+                                                  interfaces.ATSPI_REGISTRY_PATH)
                 self._app_register = dbus.Interface(obj, interfaces.ATSPI_REGISTRY_INTERFACE)
 
         def create_application (self, app_name):
                 obj = self._connection.get_object (app_name,
-                                                   self._TREE_PATH,
-                                                   introspect=False)
+                                                   self._TREE_PATH)
                 tree = dbus.Interface (obj, self._TREE_INTERFACE)
-                root = tree.getRoot ()
+                root = tree.GetRoot ()
 
                 return self.acc_factory.create_accessible (app_name,
                                                            root,
                                                            interfaces.ATSPI_APPLICATION)
 
         def getChildAtIndex(self, index):
-                applications = self._app_register.getApplications()
+                applications = self._app_register.GetApplications()
                 return self.acc_factory.create_application(applications[index])
 
         def get_childCount(self):
-                applications = self._app_register.getApplications()
+                applications = self._app_register.GetApplications()
                 return len (applications)
 
 #------------------------------------------------------------------------------



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