1 #Copyright (C) 2008 Codethink Ltd
3 #This library is free software; you can redistribute it and/or
4 #modify it under the terms of the GNU Lesser General Public
5 #License version 2 as published by the Free Software Foundation.
7 #This program is distributed in the hope that it will be useful,
8 #but WITHOUT ANY WARRANTY; without even the implied warranty of
9 #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 #GNU General Public License for more details.
11 #You should have received a copy of the GNU Lesser General Public License
12 #along with this program; if not, write to the Free Software
13 #Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
15 from base import BaseProxy
17 from accessible import Accessible
19 class Desktop(Accessible):
21 The desktop class implements the
22 accessible interface, but uses a different
23 method to access its chilren and to obtain cached
26 This is because application caches are separate
27 and the children of the desktop are applications.
28 The child access must get the root accessible
29 of the application cache that is accessed.
31 The data is accessed from the desktop cache.
37 data = self._cache._objects[self._path]
38 except KeyError, ReferenceError:
39 raise AccessibleObjectNoLongerExists, 'Cache data cannot be found for path %s' % (self._path,)
42 def getApplication(self, *args, **kwargs):
44 Get the containing Application for this object.
45 @return the Application instance to which this object belongs.
47 func = self.get_dbus_method("getApplication")
48 return func(*args, **kwargs)
50 def getAttributes(self, *args, **kwargs):
52 Get a list of properties applied to this object as a whole, as
53 an AttributeSet consisting of name-value pairs. As such these
54 attributes may be considered weakly-typed properties or annotations,
55 as distinct from the strongly-typed interface instance data declared
56 using the IDL "attribute" keyword.
57 Not all objects have explicit "name-value pair" AttributeSet
59 Attribute names and values may have any UTF-8 string value, however
60 where possible, in order to facilitate consistent use and exposure
61 of "attribute" properties by applications and AT clients, attribute
62 names and values should chosen from a publicly-specified namespace
64 Where possible, the names and values in the name-value pairs
65 should be chosen from well-established attribute namespaces using
66 standard semantics. For example, attributes of Accessible objects
67 corresponding to XHTML content elements should correspond to
68 attribute names and values specified in the w3c XHTML specification,
69 at http://www.w3.org/TR/xhtml2, where such values are not already
70 exposed via a more strongly-typed aspect of the AT-SPI API. Metadata
71 names and values should be chosen from the 'Dublin Core' Metadata
72 namespace using Dublin Core semantics: http://dublincore.org/dcregistry/
73 Similarly, relevant structural metadata should be exposed using
74 attribute names and values chosen from the CSS2 and WICD specification:
75 http://www.w3.org/TR/1998/REC-CSS2-19980512 WICD (http://www.w3.org/TR/2005/WD-WICD-20051121/).
76 @return : an AttributeSet encapsulating any "attribute values"
77 currently defined for the object.
79 func = self.get_dbus_method("getAttributes")
80 return func(*args, **kwargs)
82 def getChildAtIndex(self, *args, **kwargs):
84 Get the accessible child of this object at index.
86 an in parameter indicating which child is requested (zero-indexed).
87 @return : the 'nth' Accessible child of this object.
89 func = self.get_dbus_method("getChildAtIndex")
90 return func(*args, **kwargs)
92 def getIndexInParent(self, *args, **kwargs):
94 Get the index of this object in its parent's child list.
95 @return : a long integer indicating this object's index in the
98 func = self.get_dbus_method("getIndexInParent")
99 return func(*args, **kwargs)
101 def getLocalizedRoleName(self, *args, **kwargs):
103 Get a string indicating the type of UI role played by this object,
104 translated to the current locale.
105 @return : a UTF-8 string indicating the type of UI role played
108 func = self.get_dbus_method("getLocalizedRoleName")
109 return func(*args, **kwargs)
111 def getRelationSet(self, *args, **kwargs):
113 Get a set defining this object's relationship to other accessible
115 @return : a RelationSet defining this object's relationships.
117 func = self.get_dbus_method("getRelationSet")
118 return func(*args, **kwargs)
120 def getRole(self, *args, **kwargs):
122 Get the Role indicating the type of UI role played by this object.
123 @return : a Role indicating the type of UI role played by this
126 func = self.get_dbus_method("getRole")
127 return func(*args, **kwargs)
129 def getRoleName(self, *args, **kwargs):
131 Get a string indicating the type of UI role played by this object.
132 @return : a UTF-8 string indicating the type of UI role played
135 func = self.get_dbus_method("getRoleName")
136 return func(*args, **kwargs)
138 def getState(self, *args, **kwargs):
140 Get the current state of the object as a StateSet.
141 @return : a StateSet encapsulating the currently true states
144 func = self.get_dbus_method("getState")
145 return func(*args, **kwargs)
147 def isEqual(self, *args, **kwargs):
149 Determine whether an Accessible refers to the same object as
150 another. This method should be used rather than brute-force comparison
151 of object references (i.e. "by-value" comparison), as two object
152 references may have different apparent values yet refer to the
155 an Accessible object reference to compare to
156 @return : a boolean indicating whether the two object references
157 point to the same object.
159 func = self.get_dbus_method("isEqual")
160 return func(*args, **kwargs)
162 def unimplemented(self, *args, **kwargs):
164 /cond future expansion
166 func = self.get_dbus_method("unimplemented")
167 return func(*args, **kwargs)
169 def get_childCount(self):
170 self._pgetter(self._dbus_interface, "childCount")
171 def set_childCount(self, value):
172 self._psetter(self._dbus_interface, "childCount", value)
175 childCount: the number of children contained by this object.
177 childCount = property(fget=get_childCount, fset=set_childCount, doc=_childCountDoc)
179 def get_description(self):
180 self._pgetter(self._dbus_interface, "description")
181 def set_description(self, value):
182 self._psetter(self._dbus_interface, "description", value)
185 a string describing the object in more detail than name.
187 description = property(fget=get_description, fset=set_description, doc=_descriptionDoc)
190 self._pgetter(self._dbus_interface, "name")
191 def set_name(self, value):
192 self._psetter(self._dbus_interface, "name", value)
195 a (short) string representing the object's name.
197 name = property(fget=get_name, fset=set_name, doc=_nameDoc)
199 def get_parent(self):
200 self._pgetter(self._dbus_interface, "parent")
201 def set_parent(self, value):
202 self._psetter(self._dbus_interface, "parent", value)
205 an Accessible object which is this object's containing object.
207 parent = property(fget=get_parent, fset=set_parent, doc=_parentDoc)