[orca] Refine the heuristic used to identify layout tables



commit 7224cb174a052e86e112aa67ce82b7544d8f8aa2
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Sat Mar 14 15:43:39 2015 -0400

    Refine the heuristic used to identify layout tables

 src/orca/generator.py        |    6 ++++++
 src/orca/script_utilities.py |   20 +++++++++++---------
 2 files changed, 17 insertions(+), 9 deletions(-)
---
diff --git a/src/orca/generator.py b/src/orca/generator.py
index bc89d29..24ee381 100644
--- a/src/orca/generator.py
+++ b/src/orca/generator.py
@@ -623,6 +623,9 @@ class Generator:
             return result
 
         text = self._script.utilities.displayedText(header)
+        if not text:
+            return result
+
         roleString =  self.getLocalizedRoleName(obj, pyatspi.ROLE_ROW_HEADER)
         if args.get('mode') == 'speech':
             if settings.speechVerbosityLevel == settings.VERBOSITY_LEVEL_VERBOSE \
@@ -646,6 +649,9 @@ class Generator:
             return result
 
         text = self._script.utilities.displayedText(header)
+        if not text:
+            return result
+
         roleString =  self.getLocalizedRoleName(obj, pyatspi.ROLE_COLUMN_HEADER)
         if args.get('mode') == 'speech':
             if settings.speechVerbosityLevel == settings.VERBOSITY_LEVEL_VERBOSE \
diff --git a/src/orca/script_utilities.py b/src/orca/script_utilities.py
index ba552a1..0f60aaa 100644
--- a/src/orca/script_utilities.py
+++ b/src/orca/script_utilities.py
@@ -710,15 +710,17 @@ class Utilities:
                              pyatspi.ROLE_LIST_ITEM,
                              pyatspi.ROLE_TREE_ITEM]
 
-        if role == pyatspi.ROLE_TABLE:
-            layoutOnly = attrs.get('layout-guess') == 'true'
-            if not layoutOnly:
-                try:
-                    table = obj.queryTable()
-                except:
-                    layoutOnly = True
-                else:
-                    layoutOnly = table.nRows <= 1 or table.nColumns <= 1
+        if role == pyatspi.ROLE_TABLE and attrs.get('layout-guess') != 'true':
+            try:
+                table = obj.queryTable()
+            except:
+                layoutOnly = True
+            else:
+                if not (obj.name or self.displayedLabel(obj)):
+                    if not (table.nRows and table.nColumns):
+                        layoutOnly = True
+                    else:
+                        layoutOnly = not (table.getColumnHeader(0) or table.getRowHeader(0))
         elif role == pyatspi.ROLE_TABLE_CELL and obj.childCount:
             if obj[0].getRole() == pyatspi.ROLE_TABLE_CELL:
                 layoutOnly = True


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