Changes to introspection generation to remove DOCTYPE and XML
[platform/core/uifw/at-spi2-atk.git] / tools / python / AccessibleTree.py
1 import dbus
2 import dbus.service
3
4 class AccessibleTree(dbus.service.Object):
5         """
6         The Accessible tree provides the interface,
7         for accessing all the accessible objects
8         available on a particular application.
9         """
10
11         def __init__(self, bus, path):
12                 """
13                 Parameters:
14
15                 bus - The D-Bus bus object to use
16                 path - The object path this interface should use
17                 """
18                 dbus.service.Object.__init__(self, bus, path)
19                 self._toSend = {}
20                 self._toRemove = []
21                 self._objects = {}
22                 self._root = '/'
23
24         @dbus.service.method(dbus_interface='org.freedesktop.atspi.Tree',
25                              out_signature='o')
26         def getRoot(self):
27                 return self._root
28
29         @dbus.service.method(dbus_interface='org.freedesktop.atspi.Tree',
30                              out_signature='a(ooaoassus)')
31         def getTree(self):
32                 return self._objects.values()
33
34         @dbus.service.signal(dbus_interface='org.freedesktop.atspi.Tree',
35                              signature=('a(ooaoassus)ao'))
36         def updateTree(self, objects, paths):
37                 #There are some locking issues here.
38                 #Need to make sure that updates are not missed.
39                 oldSend = self._toSend.values()
40                 self._toSend = {}
41                 oldRemove = self._toRemove
42                 self._toRemove = []
43                 return (oldSend, oldRemove)
44
45         def updateObject(self, path, object):
46                 self._objects[path] = object
47                 self._toSend[path] = object
48                 
49         def removeObject(self, path):
50                 if path in self._objects:
51                         self._toRemove.append(path)
52                         del(self._objects[path])
53
54         def setRoot(self, root):
55                 self._root = root