Fix testregistry.py
authorMike Gorse <mgorse@suse.com>
Mon, 23 Dec 2013 20:32:58 +0000 (15:32 -0500)
committerMike Gorse <mgorse@suse.com>
Mon, 23 Dec 2013 20:32:58 +0000 (15:32 -0500)
testregistry.py was not kept up-to-date with various AT-SPI changes. Update
to at least run and give output similar to its former output.

registryd/testregistry.py [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index 9469525..db85e74
@@ -10,43 +10,50 @@ from dbus.mainloop.glib import DBusGMainLoop
 DBusGMainLoop(set_as_default=True)
 
 class IdleStateM (object):
-       def __init__(self, bus, loop):
-               self._bus = bus
-               self._loop = loop
-               self._func = self.setup
-
-       def idle_handler(self):
-               self._func = self._func()
-               if self._func == None:
-                       self._func = self.teardown
-               return True
-
-       def setup(self):
-               self.obj = self._bus.get_object("org.a11y.atspi.Registry",
-                                                "/org/a11y/atspi/registry",
+        def __init__(self, bus, loop):
+                self._bus = bus
+                self._loop = loop
+                self._func = self.setup
+
+        def idle_handler(self):
+                self._func = self._func()
+                if self._func == None:
+                        self._func = self.teardown
+                return True
+
+        def setup(self):
+                self.obj = self._bus.get_object("org.a11y.atspi.Registry",
+                                                "/org/a11y/atspi/accessible/root",
                                                 introspect=False)
-               self.itf = dbus.Interface(self.obj, dbus_interface="org.a11y.atspi.Registry")
-               return self.register_apps
+                self.itf = dbus.Interface(self.obj, dbus_interface="org.a11y.atspi.Accessible")
+                return self.register_apps
 
-       def register_apps(self):
-               #self.itf.registerApplication(":R456", ignore_reply=True)
-               #self.itf.registerApplication(":R123", ignore_reply=True)
-               return self.print_applications
+        def register_apps(self):
+                #self.itf.registerApplication(":R456", ignore_reply=True)
+                #self.itf.registerApplication(":R123", ignore_reply=True)
+                return self.print_applications
 
-       def print_applications(self):
-               apps = self.itf.getApplications()
-               print apps
-               return self.teardown
+        def print_applications(self):
+                apps = self.itf.GetChildren()
+                print apps
+                return self.teardown
 
-       def teardown(self):
-               self._loop.quit()
+        def teardown(self):
+                self._loop.quit()
 
 def main(argv):
-       bus = dbus.SessionBus()
-       loop = gobject.MainLoop()
-       stateM = IdleStateM(bus, loop)
-       gobject.idle_add(stateM.idle_handler)
-       loop.run()
+        bus = dbus.SessionBus()
+        obj = bus.get_object("org.a11y.Bus",
+                             "/org/a11y/bus",
+                             introspect=False)
+        itf = dbus.Interface(obj, dbus_interface="org.a11y.Bus")
+        address = itf.GetAddress()
+
+        bus = dbus.bus.BusConnection(str(address))
+        loop = gobject.MainLoop()
+        stateM = IdleStateM(bus, loop)
+        gobject.idle_add(stateM.idle_handler)
+        loop.run()
 
 if __name__=="__main__":
-       sys.exit(main(sys.argv))
+        sys.exit(main(sys.argv))