[orca] Add a _getAll() method to structural_navigation.py
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Add a _getAll() method to structural_navigation.py
- Date: Fri, 7 Dec 2012 05:53:57 +0000 (UTC)
commit 741c55fceae7f4b2bd2c026d1a7f42b6a9f8271b
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Fri Dec 7 06:39:28 2012 +0100
Add a _getAll() method to structural_navigation.py
Note: This does not magically give you lists; it is, however, the
method you need to generate those lists, which I'll work on next.
src/orca/structural_navigation.py | 24 ++++++++++++++++++++++++
1 files changed, 24 insertions(+), 0 deletions(-)
---
diff --git a/src/orca/structural_navigation.py b/src/orca/structural_navigation.py
index cb4baba..b1f1dc5 100644
--- a/src/orca/structural_navigation.py
+++ b/src/orca/structural_navigation.py
@@ -759,6 +759,30 @@ class StructuralNavigation:
arg = [rowDiff, colDiff, oldRowHeaders, oldColHeaders]
structuralNavigationObject.present(cell, arg)
+ def _getAll(self, structuralNavigationObject, arg=None):
+ """Returns all the instances of structuralNavigationObject."""
+ if not structuralNavigationObject.criteria:
+ return []
+
+ document = self._getDocument()
+ col = document.queryCollection()
+ criteria = structuralNavigationObject.criteria(col, arg)
+ rule = col.createMatchRule(criteria.states.raw(),
+ criteria.matchStates,
+ criteria.objAttrs,
+ criteria.matchObjAttrs,
+ criteria.roles,
+ criteria.matchRoles,
+ criteria.interfaces,
+ criteria.matchInterfaces,
+ criteria.invert)
+ rv = col.getMatches(rule, col.SORT_ORDER_CANONICAL, 0, True)
+ col.freeMatchRule(rule)
+ if criteria.applyPredicate:
+ rv = list(filter(structuralNavigationObject.predicate, rv))
+
+ return rv
+
def goObject(self, structuralNavigationObject, isNext, obj=None, arg=None):
"""The method used for navigation among StructuralNavigationObjects
which are not table cells.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]