[orca] Get Orca to handle table rows which lack ROLE_TABLE_ROW
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Get Orca to handle table rows which lack ROLE_TABLE_ROW
- Date: Thu, 14 Feb 2013 23:10:20 +0000 (UTC)
commit 03d35d77a7834ba79cc05e46c570599915a4de82
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Thu Feb 14 18:05:44 2013 -0500
Get Orca to handle table rows which lack ROLE_TABLE_ROW
src/orca/generator.py | 9 +++++++--
src/orca/script_utilities.py | 19 +++++++++++++++++++
2 files changed, 26 insertions(+), 2 deletions(-)
---
diff --git a/src/orca/generator.py b/src/orca/generator.py
index 582f3c6..c67e718 100644
--- a/src/orca/generator.py
+++ b/src/orca/generator.py
@@ -871,8 +871,13 @@ class Generator:
and pointOfReference["lastColumn"] == column))
if presentAll:
args['readingRow'] = True
- for i in range(0, parentTable.nColumns):
- cell = parentTable.getAccessibleAt(row, i)
+ if self._script.utilities.isTableRow(obj):
+ cells = [x for x in obj]
+ else:
+ cells = [parentTable.getAccessibleAt(row, i) \
+ for i in range(parentTable.nColumns)]
+
+ for cell in cells:
if not cell:
continue
state = cell.getState()
diff --git a/src/orca/script_utilities.py b/src/orca/script_utilities.py
index 31f06e5..9d90ac8 100644
--- a/src/orca/script_utilities.py
+++ b/src/orca/script_utilities.py
@@ -1281,6 +1281,25 @@ class Utilities:
else:
return state.contains(pyatspi.STATE_SHOWING)
+ @staticmethod
+ def isTableRow(obj):
+ """Determines if obj is a table row -- real or functionally."""
+ if not (obj and obj.parent and obj.childCount):
+ return False
+
+ if obj.getRole() == pyatspi.ROLE_TABLE_ROW:
+ return True
+
+ if not obj.parent.getRole() == pyatspi.ROLE_TABLE:
+ return False
+
+ isCell = lambda x: x and x.getRole() == pyatspi.ROLE_TABLE_CELL
+ cellChildren = list(filter(isCell, [x for x in obj]))
+ if len(cellChildren) == obj.childCount:
+ return True
+
+ return False
+
def realActiveDescendant(self, obj):
"""Given an object that should be a child of an object that
manages its descendants, return the child that is the real
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]