[pyatspi2] Return extents as a BoundingBox
- From: Mike Gorse <mgorse src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pyatspi2] Return extents as a BoundingBox
- Date: Fri, 6 Jul 2012 21:40:42 +0000 (UTC)
commit bdfe787c71accff84ae4b9c9ddcdcd8ec4cacd21
Author: Mike Gorse <mgorse suse com>
Date: Fri Jul 6 16:44:27 2012 -0500
Return extents as a BoundingBox
pyatspi/Accessibility.py | 6 ------
pyatspi/component.py | 2 +-
pyatspi/image.py | 2 +-
pyatspi/utils.py | 6 +++++-
4 files changed, 7 insertions(+), 9 deletions(-)
---
diff --git a/pyatspi/Accessibility.py b/pyatspi/Accessibility.py
index 92992d7..b45152c 100644
--- a/pyatspi/Accessibility.py
+++ b/pyatspi/Accessibility.py
@@ -58,9 +58,6 @@ def Accessible_str(self):
def pointToList(point):
return (point.x, point.y)
-def rectToList(rect):
- return (rect.x, rect.y, rect.width, rect.height)
-
# TODO: Figure out how to override Atspi.Rect constructor and remove this class
class BoundingBox(list):
def __new__(cls, x, y, width, height):
@@ -92,9 +89,6 @@ class BoundingBox(list):
self[3] = val
height = property(fget=_get_height, fset=_set_height)
-def getBoundingBox(rect):
- return BoundingBox (rect.x, rect.y, rect.width, rect.height)
-
def getInterface(func, obj):
ret = func(obj)
if ret:
diff --git a/pyatspi/component.py b/pyatspi/component.py
index 7657f70..343b5c3 100644
--- a/pyatspi/component.py
+++ b/pyatspi/component.py
@@ -117,7 +117,7 @@ class Component(interface):
@return a BoundingBox which entirely contains the object's onscreen
visual representation.
"""
- return Atspi.Component.get_extents(self.obj, coord_type)
+ return getBoundingBox(Atspi.Component.get_extents(self.obj, coord_type))
def getLayer(self):
"""
diff --git a/pyatspi/image.py b/pyatspi/image.py
index 908cd2f..31c02ff 100644
--- a/pyatspi/image.py
+++ b/pyatspi/image.py
@@ -50,7 +50,7 @@ class Image:
to the containing window.
@return a BoundingBox enclosing the image's onscreen representation.
"""
- return rectToList(Atspi.Image.get_image_extents(self.obj, coordType))
+ return getBoundingBox(Atspi.Image.get_image_extents(self.obj, coordType))
def getImagePosition(self, coord_type):
"""
diff --git a/pyatspi/utils.py b/pyatspi/utils.py
index 7e8e73d..bd243c6 100644
--- a/pyatspi/utils.py
+++ b/pyatspi/utils.py
@@ -45,7 +45,8 @@ __all__ = [
"pointToList",
"rectToList",
"attributeListToHash",
- "hashToAttributeList"
+ "hashToAttributeList",
+ "getBoundingBox"
]
def setCacheLevel(level):
@@ -343,3 +344,6 @@ def attributeListToHash(list):
def hashToAttributeList(h):
return [x + ":" + h[x] for x in h.keys()]
+
+def getBoundingBox(rect):
+ return BoundingBox (rect.x, rect.y, rect.width, rect.height)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]