2009-27-09 Mark Doffman <mark.doffman@codethink.co.uk>
[platform/core/uifw/at-spi2-atk.git] / pyatspi / image.py
index 6911692..b2b595a 100644 (file)
 #Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
 import dbus
-import interfaces
-from base import BaseProxy
+from interfaces import *
+from accessible import Accessible
 from factory import accessible_factory
 from accessible import BoundingBox
 
+from dbus.types import UInt32
+
 __all__ = [
            "Image",
           ]
 
 #------------------------------------------------------------------------------
 
-class Image(BaseProxy):
+class Image(Accessible):
         """
         An interface implemented by objects which render image data or
         pictorial information to the screen. When onscreen components
@@ -48,10 +50,10 @@ class Image(BaseProxy):
                 to the containing window. 
                 @return a BoundingBox enclosing the image's onscreen representation.
                 """
-                func = self.get_dbus_method("getImageExtents")
-                return BoundingBox(*func(dbus.Int16(coordType)))
+                func = self.get_dbus_method("getImageExtents", dbus_interface=ATSPI_IMAGE)
+                return BoundingBox(*func(UInt32(coordType)))
 
-        def getImagePosition(self, *args, **kwargs):
+        def getImagePosition(self, coord_type):
                 """
                 Get the coordinates of the current image position on screen.
                 @param : x
@@ -65,10 +67,10 @@ class Image(BaseProxy):
                 to the screen; if 1, they are returned relative to the containing
                 window.
                 """
-                func = self.get_dbus_method("getImagePosition")
-                return func(*args, **kwargs)
+                func = self.get_dbus_method("getImagePosition", dbus_interface=ATSPI_IMAGE)
+                return func(UInt32(coord_type))
 
-        def getImageSize(self, *args, **kwargs):
+        def getImageSize(self):
                 """
                 Obtain the width and height of the current onscreen view of the
                 image. The extents returned do not account for any viewport clipping
@@ -81,32 +83,28 @@ class Image(BaseProxy):
                 Back-filled with the y extents of the onscreen image (i.e. the
                 image height in pixels)
                 """
-                func = self.get_dbus_method("getImageSize")
-                return func(*args, **kwargs)
+                func = self.get_dbus_method("getImageSize", dbus_interface=ATSPI_IMAGE)
+                return func()
 
         def get_imageDescription(self):
-                return self._pgetter(self._dbus_interface, "imageDescription")
-        def set_imageDescription(self, value):
-                self._psetter(self._dbus_interface, "imageDescription", value)
+                return dbus.String(self._pgetter(self._dbus_interface, "imageDescription"))
         _imageDescriptionDoc = \
                 """
                 A UTF-8 string providing a textual description of what is visually
                 depicted in the image.
                 """
-        imageDescription = property(fget=get_imageDescription, fset=set_imageDescription, doc=_imageDescriptionDoc)
+        imageDescription = property(fget=get_imageDescription, doc=_imageDescriptionDoc)
 
         def get_imageLocale(self):
-                return self._pgetter(self._dbus_interface, "imageLocale")
-        def set_imageLocale(self, value):
-                self._psetter(self._dbus_interface, "imageLocale", value)
+                return dbus.String(self._pgetter(self._dbus_interface, "imageLocale"))
         _imageLocaleDoc = \
                 """
                 A string corresponding to the POSIX LC_MESSAGES locale used by
                 the imageDescription.
                 """
-        imageLocale = property(fget=get_imageLocale, fset=set_imageLocale, doc=_imageLocaleDoc)
+        imageLocale = property(fget=get_imageLocale, doc=_imageLocaleDoc)
 
 # Register the accessible class with the factory.
-accessible_factory.register_accessible_class(interfaces.ATSPI_IMAGE, Image)
+accessible_factory.register_accessible_class(ATSPI_IMAGE, Image)
 
 #END----------------------------------------------------------------------------