[orca] A few more tweaks to improve Orca's generic label inference code



commit a11f9ae47cfe311887d0024357beb255f23848c5
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Sun Jan 6 14:42:47 2013 -0500

    A few more tweaks to improve Orca's generic label inference code

 src/orca/label_inference.py |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/src/orca/label_inference.py b/src/orca/label_inference.py
index 9d5fd9e..ebded45 100644
--- a/src/orca/label_inference.py
+++ b/src/orca/label_inference.py
@@ -302,8 +302,9 @@ class LabelInference:
         for i in range(len(onLeft) - 1, -1, -1):
             if self._isWidget(onLeft[i][0]):
                 onLeft = onLeft[(i+1):]
+                break
 
-        if not onLeft:
+        if not (onLeft and onLeft[0]):
             return None
 
         lObj, start, end, string = onLeft[-1]
@@ -340,8 +341,11 @@ class LabelInference:
             index = len(contents)
 
         onRight = contents[min(len(contents), index+1):]
-        onRight = [o for o in onRight if o[0] and not self._isWidget(o[0])]
-        if not onRight:
+        for item in onRight:
+            if self._isWidget(item[0]):
+                return None
+
+        if not (onRight and onRight[0]):
             return None
 
         rObj, start, end, string = onRight[0]
@@ -405,7 +409,7 @@ class LabelInference:
             if prevObj.getRole() == pyatspi.ROLE_TABLE_CELL \
                and not prevObj in [obj.parent, obj.parent.parent]:
                 return None
-            if distance < 1:
+            if distance < 0:
                 continue
             if x + 150 < objX:
                 continue



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]