2009-27-09 Mark Doffman <mark.doffman@codethink.co.uk>
[platform/core/uifw/at-spi2-atk.git] / pyatspi / hypertext.py
index 440f227..6e7332f 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__ = [
            "Hypertext",
@@ -22,7 +22,7 @@ __all__ = [
 
 #------------------------------------------------------------------------------
 
-class Hypertext(BaseProxy):
+class Hypertext(Accessible):
         """
         An interface used for objects which implement linking between
         multiple resource or content locations, or multiple 'markers'
@@ -31,7 +31,7 @@ class Hypertext(BaseProxy):
         offsets within the Hypertext's included content.
         """
 
-        def getLink(self, *args, **kwargs):
+        def getLink(self, index):
                 """
                 Get one of the Hyperlinks associated with this Hypertext object,
                 by index.
@@ -39,10 +39,11 @@ class Hypertext(BaseProxy):
                 an integer from 0 to getNLinks() - 1. 
                 @return the Hyperlink in this Hypertext object.
                 """
-                func = self.get_dbus_method("getLink")
-                return func(*args, **kwargs)
+                func = self.get_dbus_method("getLink", dbus_interface=ATSPI_HYPERTEXT)
+                return self._cache.create_accessible(self._app_name, func(index),
+                                                     interfaces.ATSPI_HYPERTEXT)
 
-        def getLinkIndex(self, *args, **kwargs):
+        def getLinkIndex(self, character_index):
                 """
                 Get the hyperlink index, if any, associated with a particular
                 character offset in the Hypertext object. For Hypertext implementors
@@ -52,19 +53,19 @@ class Hypertext(BaseProxy):
                 offset characterIndex, or -1 if no Hyperlink is associated with
                 that character offset.
                 """
-                func = self.get_dbus_method("getLinkIndex")
-                return func(*args, **kwargs)
+                func = self.get_dbus_method("getLinkIndex", dbus_interface=ATSPI_HYPERTEXT)
+                return func(character_index)
 
-        def getNLinks(self, *args, **kwargs):
+        def getNLinks(self):
                 """
                 Query the hypertext object for the number of Hyperlinks it contains.
                 @return the number of Hyperlinks associated with this Hypertext
                 object, as a long integer.
                 """
-                func = self.get_dbus_method("getNLinks")
-                return func(*args, **kwargs)
+                func = self.get_dbus_method("getNLinks", dbus_interface=ATSPI_HYPERTEXT)
+                return func()
 
-# ATTENTION - Register the Application class with the accessible factory.
-add_accessible_class(interfaces.ATSPI_HYPERTEXT, Hypertext)
+# Register the accessible class with the factory.
+accessible_factory.register_accessible_class(ATSPI_HYPERTEXT, Hypertext)
 
 #END----------------------------------------------------------------------------