#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, Enum
-from factory import create_accessible, add_accessible_class
-from accessible import BoundingBox
+from interfaces import *
+from base import Enum
+from factory import accessible_factory
+from accessible import BoundingBox, Accessible
-from dbus.types import Int16
+from dbus.types import UInt32
__all__ = [
"CoordType",
#------------------------------------------------------------------------------
-class Component(BaseProxy):
+class Component(Accessible):
"""
The Component interface is implemented by objects which occupy
on-screen space, e.g. objects which have onscreen visual representations.
purposes of this interface.
"""
- def contains(self, *args, **kwargs):
+ def contains(self, x, y, coord_type):
"""
@return True if the specified point lies within the Component's
bounding box, False otherwise.
"""
- func = self.get_dbus_method("contains")
- return func(*args, **kwargs)
+ func = self.get_dbus_method("contains", dbus_interface=ATSPI_COMPONENT)
+ return func(x, y, coord_type)
- def deregisterFocusHandler(self, *args, **kwargs):
- """
- Request that an EventListener registered via registerFocusHandler
- no longer be notified when this object receives keyboard focus.
- """
- func = self.get_dbus_method("deregisterFocusHandler")
- return func(*args, **kwargs)
-
- def getAccessibleAtPoint(self, *args, **kwargs):
+ def getAccessibleAtPoint(self, x, y, coord_type):
"""
@return the Accessible child whose bounding box contains the
specified point.
"""
- func = self.get_dbus_method("getAccessibleAtPoint")
- return func(*args, **kwargs)
+ func = self.get_dbus_method("getAccessibleAtPoint", dbus_interface=ATSPI_COMPONENT)
+ return self._cache.create_accessible(self._app_name,
+ func(x, y, coord_type),
+ interfaces.ATSPI_COMPONENT)
- def getAlpha(self, *args, **kwargs):
+ def getAlpha(self):
"""
Obtain the alpha value of the component. An alpha value of 1.0
or greater indicates that the object is fully opaque, and an
alpha value of 0.0 indicates that the object is fully transparent.
Negative alpha values have no defined meaning at this time.
"""
- func = self.get_dbus_method("getAlpha")
- return func(*args, **kwargs)
+ func = self.get_dbus_method("getAlpha", dbus_interface=ATSPI_COMPONENT)
+ return func()
def getExtents(self, coord_type):
"""
@return a BoundingBox which entirely contains the object's onscreen
visual representation.
"""
- func = self.get_dbus_method("getExtents")
- extents = func(Int16(coord_type))
+ func = self.get_dbus_method("getExtents", dbus_interface=ATSPI_COMPONENT)
+ extents = func(UInt32(coord_type))
return BoundingBox(*extents)
- def getLayer(self, *args, **kwargs):
+ def getLayer(self):
"""
@return the ComponentLayer in which this object resides.
"""
- func = self.get_dbus_method("getLayer")
- return ComponentLayer(func(*args, **kwargs))
+ func = self.get_dbus_method("getLayer", dbus_interface=ATSPI_COMPONENT)
+ return ComponentLayer(func())
def getMDIZOrder(self):
"""
@return an integer indicating the object's place in the stacking
order.
"""
- func = self.get_dbus_method("getMDIZOrder")
+ func = self.get_dbus_method("getMDIZOrder", dbus_interface=ATSPI_COMPONENT)
return func()
def getPosition(self, coord_type):
an out parameter which will be back-filled with the returned
y coordinate.
"""
- func = self.get_dbus_method("getPosition")
- return func(Int16(coord_type))
+ func = self.get_dbus_method("getPosition", dbus_interface=ATSPI_COMPONENT)
+ return func(UInt32(coord_type))
- def getSize(self, *args, **kwargs):
+ def getSize(self):
"""
Obtain the size, in the coordinate system specified by coord_type,
of the rectangular area which fully contains the object's visual
@param : height
the object's vertical extents in the specified coordinate system.
"""
- func = self.get_dbus_method("getSize")
- return func(*args, **kwargs)
+ func = self.get_dbus_method("getSize", dbus_interface=ATSPI_COMPONENT)
+ return func()
- def grabFocus(self, *args, **kwargs):
+ def grabFocus(self):
"""
Request that the object obtain keyboard focus.
@return True if keyboard focus was successfully transferred to
the Component.
"""
- func = self.get_dbus_method("grabFocus")
- return func(*args, **kwargs)
-
- def registerFocusHandler(self, *args, **kwargs):
- """
- Register an EventListener for notification when this object receives
- keyboard focus.
- """
- func = self.get_dbus_method("registerFocusHandler")
- return func(*args, **kwargs)
+ func = self.get_dbus_method("grabFocus", dbus_interface=ATSPI_COMPONENT)
+ return func()
-# Register the Accessible class with the accessible factory.
-add_accessible_class(interfaces.ATSPI_COMPONENT, Component)
+# Register the accessible class with the factory.
+accessible_factory.register_accessible_class(ATSPI_COMPONENT, Component)
#END----------------------------------------------------------------------------