8 from dbus.mainloop.glib import DBusGMainLoop
10 DBusGMainLoop(set_as_default=True)
12 class IdleStateM (object):
13 def __init__(self, bus, loop):
16 self._func = self.setup
18 def idle_handler(self):
19 self._func = self._func()
20 if self._func == None:
21 self._func = self.teardown
25 self.obj = self._bus.get_object("org.a11y.atspi.Registry",
26 "/org/a11y/atspi/accessible/root",
28 self.itf = dbus.Interface(self.obj, dbus_interface="org.a11y.atspi.Accessible")
29 return self.register_apps
31 def register_apps(self):
32 #self.itf.registerApplication(":R456", ignore_reply=True)
33 #self.itf.registerApplication(":R123", ignore_reply=True)
34 return self.print_applications
36 def print_applications(self):
37 apps = self.itf.GetChildren()
45 bus = dbus.SessionBus()
46 obj = bus.get_object("org.a11y.Bus",
49 itf = dbus.Interface(obj, dbus_interface="org.a11y.Bus")
50 address = itf.GetAddress()
52 bus = dbus.bus.BusConnection(str(address))
53 loop = gobject.MainLoop()
54 stateM = IdleStateM(bus, loop)
55 gobject.idle_add(stateM.idle_handler)
58 if __name__=="__main__":
59 sys.exit(main(sys.argv))