diff options
author | Mark Doffman <mdoff@silver-wind.(none)> | 2008-05-16 16:11:40 +0100 |
---|---|---|
committer | Mark Doffman <mdoff@silver-wind.(none)> | 2008-05-16 16:16:19 +0100 |
commit | ff143bfb6c3ca9e1a7362bd7f9c7c5eba31eb135 (patch) | |
tree | 3661a3149da6031c5a0e74463fdd428738e2bf1b /tests/testServer.py | |
parent | 5d01be6ec7d2cb2e662c695bd4c28c50ac3f2dab (diff) | |
download | at-spi2-atk-ff143bfb6c3ca9e1a7362bd7f9c7c5eba31eb135.tar.gz |
2008-05-16 Mark Doffman <mark.doffman@codethink.co.uk>
Re-organize the directories. The main purpose of
this change is to remove CORBA code and references
that are no longer used.
* atk-adaptor/
Code here used to live in libspi and atk-bridge.
* droute/
The droute module has been moved from libspi to
its own directory.
* spi-common
Code and definitions common to registryd and
the atk-adaptor. Mostly moved from libspi/dbus.c
and accessible.h.
* cspi/
Removed for the moment. Will have to be
mostly rewritten for D-Bus.
Diffstat (limited to 'tests/testServer.py')
-rw-r--r-- | tests/testServer.py | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/tests/testServer.py b/tests/testServer.py new file mode 100644 index 0000000..7c360a8 --- /dev/null +++ b/tests/testServer.py @@ -0,0 +1,54 @@ +import sys +import gobject +import dbus +from dbus.mainloop.glib import DBusGMainLoop + +from xml.dom import minidom + +from AccessibleTree import AccessibleTree + +DBusGMainLoop(set_as_default=True) + +def getChildrenByName(node, name): + return [child for child in node.childNodes if child.nodeType == child.ELEMENT_NODE and child.nodeName == name] + +def registerObject(tree, parent, node): + reference = node.getAttribute('reference').encode('ASCII') + name = node.getAttribute('name').encode('ASCII') + role = node.getAttribute('role').encode('ASCII') + description = node.getAttribute('description').encode('ASCII') + + interfacen = getChildrenByName(node, 'interface') + interfaces = [itf.getAttribute('name').encode('ASCII') for itf in interfacen] + + childrenn = getChildrenByName(node, 'accessible') + children = [cld.getAttribute('reference').encode('ASCII') for cld in childrenn] + + object = (reference, parent, children, interfaces, name, int(role), description) + tree.updateObject(reference, object) + + for child in childrenn: + registerObject(tree, reference, child) + +def main(argv): + filename = argv[1] + bus = dbus.SessionBus() + + loop = gobject.MainLoop() + + bus.request_name('test.atspi.tree', 0) + + tree = AccessibleTree(bus, '/org/freedesktop/atspi/tree') + doc = minidom.parse(filename) + node = doc.firstChild + tree.setRoot(node.getAttribute('reference').encode('ASCII')) + + registerObject(tree, '/', node) + + try: + loop.run() + except KeyboardInterrupt: + loop.quit() + +if __name__ == '__main__': + sys.exit(main(sys.argv)) |