[orca] Some tweaks to the label inference code
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Some tweaks to the label inference code
- Date: Wed, 15 Jan 2014 19:52:56 +0000 (UTC)
commit d37c9e4b58dc17b76f2f28e61ef72ba5d537235b
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Wed Jan 15 14:51:43 2014 -0500
Some tweaks to the label inference code
src/orca/label_inference.py | 14 +++++++++-----
1 files changed, 9 insertions(+), 5 deletions(-)
---
diff --git a/src/orca/label_inference.py b/src/orca/label_inference.py
index a457f86..778554f 100644
--- a/src/orca/label_inference.py
+++ b/src/orca/label_inference.py
@@ -416,9 +416,13 @@ class LabelInference:
return None
boundary = pyatspi.TEXT_BOUNDARY_LINE_START
- line = text.getTextAtOffset(start - 1, boundary)
- string = line[0].strip()
- if string:
+ prevLine = self._script.utilities.getObjectsFromEOCs(
+ prevObj, start, boundary)
+ if not (prevLine and prevLine[0]):
+ return None
+
+ prevObj, start, end, string = prevLine[0]
+ if string.strip():
x, y, width, height = self._getExtents(prevObj, start, end)
distance = objY - (y + height)
if distance <= proximity:
@@ -473,7 +477,7 @@ class LabelInference:
boundary = pyatspi.TEXT_BOUNDARY_LINE_START
nextLine = self._script.utilities.getObjectsFromEOCs(
- lastObj, end + 1, boundary)
+ lastObj, end, boundary)
if not (nextLine and nextLine[0]):
return None
@@ -481,7 +485,7 @@ class LabelInference:
if string.strip():
x, y, width, height = self._getExtents(nextObj, start, end)
distance = y - (objY + objHeight)
- if 0 <= distance <= proximity:
+ if distance <= proximity:
return string
return None
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]