X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=pyatspi%2Fimage.py;h=6911692e166239b974c81b6fc2cc19d581361895;hb=bd2d4199d0ae0762930021ee637db9237bb4e928;hp=0190bb35c212afca7d3fe673fb7c26c726096970;hpb=fbd6557599ce5a51401d08b027f39536d36774a5;p=platform%2Fcore%2Fuifw%2Fat-spi2-atk.git diff --git a/pyatspi/image.py b/pyatspi/image.py index 0190bb3..6911692 100644 --- a/pyatspi/image.py +++ b/pyatspi/image.py @@ -12,99 +12,101 @@ #along with this program; if not, write to the Free Software #Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +import dbus import interfaces from base import BaseProxy -from factory import add_accessible_class +from factory import accessible_factory +from accessible import BoundingBox __all__ = [ - "Image", - ] + "Image", + ] #------------------------------------------------------------------------------ class Image(BaseProxy): - """ - An interface implemented by objects which render image data or - pictorial information to the screen. When onscreen components - include graphical information that is not purely intended to - enhance "3d effect" or visual layout, but which conveys some - semantic or informational content to the sighted user, they should - implement Image, and that semantic content should be conveyed - textually to the extent possible via the image description, as - well as the Accessible::name and Accessible::description properties. - """ - - def getImageExtents(self, *args, **kwargs): """ - Obtain a bounding box which entirely contains the image contents, - as displayed on screen. The bounds returned do not account for - any viewport clipping or the fact that the image may be partially - or wholly obscured by other onscreen content. - @param : coordType - If 0, the returned bounding box position is returned relative - to the screen; if 1, the bounding box position is returned relative - to the containing window. - @return a BoundingBox enclosing the image's onscreen representation. + An interface implemented by objects which render image data or + pictorial information to the screen. When onscreen components + include graphical information that is not purely intended to + enhance "3d effect" or visual layout, but which conveys some + semantic or informational content to the sighted user, they should + implement Image, and that semantic content should be conveyed + textually to the extent possible via the image description, as + well as the Accessible::name and Accessible::description properties. """ - func = self.get_dbus_method("getImageExtents") - return func(*args, **kwargs) - - def getImagePosition(self, *args, **kwargs): - """ - Get the coordinates of the current image position on screen. - @param : x - Back-filled with the x coordinate of the onscreen image (i.e. - the minimum x coordinate) - @param : y - Back-filled with the y coordinate of the onscreen image (i.e. - the minimum y coordinate) - @param : coordType - If 0, the returned x and y coordinates are returned relative - to the screen; if 1, they are returned relative to the containing - window. - """ - func = self.get_dbus_method("getImagePosition") - return func(*args, **kwargs) - - def getImageSize(self, *args, **kwargs): - """ - Obtain the width and height of the current onscreen view of the - image. The extents returned do not account for any viewport clipping - or the fact that the image may be partially or wholly obscured - by other onscreen content. - @param : width - Back-filled with the x extents of the onscreen image (i.e. the - image width in pixels) - @param : height - 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) - def get_imageDescription(self): - self._pgetter(self._dbus_interface, "imageDescription") - def set_imageDescription(self, value): - self._psetter(self._dbus_interface, "imageDescription", value) - _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) - - def get_imageLocale(self): - self._pgetter(self._dbus_interface, "imageLocale") - def set_imageLocale(self, value): - self._psetter(self._dbus_interface, "imageLocale", value) - _imageLocaleDoc = \ - """ - A string corresponding to the POSIX LC_MESSAGES locale used by - the imageDescription. - """ - imageLocale = property(fget=get_imageLocale, fset=set_imageLocale, doc=_imageLocaleDoc) + def getImageExtents(self, coordType): + """ + Obtain a bounding box which entirely contains the image contents, + as displayed on screen. The bounds returned do not account for + any viewport clipping or the fact that the image may be partially + or wholly obscured by other onscreen content. + @param : coordType + If 0, the returned bounding box position is returned relative + to the screen; if 1, the bounding box position is returned relative + 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))) + + def getImagePosition(self, *args, **kwargs): + """ + Get the coordinates of the current image position on screen. + @param : x + Back-filled with the x coordinate of the onscreen image (i.e. + the minimum x coordinate) + @param : y + Back-filled with the y coordinate of the onscreen image (i.e. + the minimum y coordinate) + @param : coordType + If 0, the returned x and y coordinates are returned relative + to the screen; if 1, they are returned relative to the containing + window. + """ + func = self.get_dbus_method("getImagePosition") + return func(*args, **kwargs) + + def getImageSize(self, *args, **kwargs): + """ + Obtain the width and height of the current onscreen view of the + image. The extents returned do not account for any viewport clipping + or the fact that the image may be partially or wholly obscured + by other onscreen content. + @param : width + Back-filled with the x extents of the onscreen image (i.e. the + image width in pixels) + @param : height + 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) + + def get_imageDescription(self): + return self._pgetter(self._dbus_interface, "imageDescription") + def set_imageDescription(self, value): + self._psetter(self._dbus_interface, "imageDescription", value) + _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) + + def get_imageLocale(self): + return self._pgetter(self._dbus_interface, "imageLocale") + def set_imageLocale(self, value): + self._psetter(self._dbus_interface, "imageLocale", value) + _imageLocaleDoc = \ + """ + A string corresponding to the POSIX LC_MESSAGES locale used by + the imageDescription. + """ + imageLocale = property(fget=get_imageLocale, fset=set_imageLocale, doc=_imageLocaleDoc) -# ATTENTION - Register the Application class with the accessible factory. -add_accessible_class(interfaces.ATSPI_IMAGE, Image) +# Register the accessible class with the factory. +accessible_factory.register_accessible_class(interfaces.ATSPI_IMAGE, Image) #END----------------------------------------------------------------------------