#along with this program; if not, write to the Free Software
#Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-import interfaces
-from base import BaseProxy
-from factory import add_accessible_class
+from interfaces import *
+from accessible import Accessible
+from factory import accessible_factory
__all__ = [
"Document",
#------------------------------------------------------------------------------
-class Document(BaseProxy):
+class Document(Accessible):
"""
Primarily a 'tagging' interface which indicates the start of
document content in the Accessibility hierarchy. Accessible objects
as well.
"""
- def getAttributeValue(self, *args, **kwargs):
+ def getAttributeValue(self, key):
"""
Gets the value of a single attribute, if specified for the document
as a whole.
attribute, or an empty string if the attribute is unspecified
for the object.
"""
- func = self.get_dbus_method("getAttributeValue")
- return func(*args, **kwargs)
+ func = self.get_dbus_method("getAttributeValue", dbus_interface=ATSPI_DOCUMENT)
+ return func(key)
- def getAttributes(self, *args, **kwargs):
+ def getAttributes(self):
"""
Gets all attributes specified for a document as a whole. For
attributes which change within the document content, see Accessibility::Text::getAttributes
@return an AttributeSet containing the attributes of the document,
as name-value pairs.
"""
- func = self.get_dbus_method("getAttributes")
- return func(*args, **kwargs)
+ func = self.get_dbus_method("getAttributes", dbus_interface=ATSPI_DOCUMENT)
+ return [key + ':' + value for key, value in func().values()]
- def getLocale(self, *args, **kwargs):
+ def getLocale(self):
"""
Gets the locale associated with the document's content. e.g.
the locale for LOCALE_TYPE_MESSAGES.
@return a string compliant with the POSIX standard for locale
description.
"""
- func = self.get_dbus_method("getLocale")
- return func(*args, **kwargs)
+ func = self.get_dbus_method("getLocale", dbus_interface=ATSPI_DOCUMENT)
+ return func()
-# ATTENTION - Register the Application class with the accessible factory.
-add_accessible_class(interfaces.ATSPI_DOCUMENT, Document)
+# Register the accessible class with the factory.
+accessible_factory.register_accessible_class(ATSPI_DOCUMENT, Document)
#END----------------------------------------------------------------------------