2009-27-09 Mark Doffman <mark.doffman@codethink.co.uk>
[platform/core/uifw/at-spi2-atk.git] / pyatspi / document.py
index 8b0ccc2..038b1fd 100644 (file)
@@ -12,9 +12,9 @@
 #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",
@@ -22,7 +22,7 @@ __all__ = [
 
 #------------------------------------------------------------------------------
 
-class Document(BaseProxy):
+class Document(Accessible):
         """
         Primarily a 'tagging' interface which indicates the start of
         document content in the Accessibility hierarchy. Accessible objects
@@ -33,7 +33,7 @@ class Document(BaseProxy):
         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.
@@ -44,10 +44,10 @@ class Document(BaseProxy):
                 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
@@ -55,20 +55,20 @@ class Document(BaseProxy):
                 @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----------------------------------------------------------------------------