[orca] Do explicit checks for window-like roles when getting the top-level object
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Do explicit checks for window-like roles when getting the top-level object
- Date: Wed, 18 Jun 2014 12:36:53 +0000 (UTC)
commit 47ce10c1662933468986419dee5de57d9a116231
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Wed Jun 18 08:34:23 2014 -0400
Do explicit checks for window-like roles when getting the top-level object
We cannot count on the window-like object being an immediate child
of the accessible application.
src/orca/flat_review.py | 7 +------
src/orca/script_utilities.py | 19 +++++++++++--------
2 files changed, 12 insertions(+), 14 deletions(-)
---
diff --git a/src/orca/flat_review.py b/src/orca/flat_review.py
index b405363..a8e3cd3 100644
--- a/src/orca/flat_review.py
+++ b/src/orca/flat_review.py
@@ -594,12 +594,7 @@ class Context:
else:
# We want to stop at the window or frame or equivalent level.
#
- obj = orca_state.locusOfFocus
- while obj \
- and obj.parent \
- and (obj.parent.getRole() != pyatspi.ROLE_APPLICATION) \
- and (obj != obj.parent):
- obj = obj.parent
+ obj = script.utilities.topLevelObject(orca_state.locusOfFocus)
if obj:
self.lines = self.clusterZonesByLine(self.getShowingZones(obj))
else:
diff --git a/src/orca/script_utilities.py b/src/orca/script_utilities.py
index 69a8c30..1b2d2eb 100644
--- a/src/orca/script_utilities.py
+++ b/src/orca/script_utilities.py
@@ -1398,15 +1398,18 @@ class Utilities:
- obj: the Accessible object
"""
- while obj and obj.parent and (obj != obj.parent) \
- and (obj.parent.getRole() != pyatspi.ROLE_APPLICATION):
- obj = obj.parent
+ if not obj:
+ return None
- if obj and obj.parent and \
- (obj.parent.getRole() == pyatspi.ROLE_APPLICATION):
- pass
- else:
- obj = None
+ stopAtRoles = [pyatspi.ROLE_ALERT,
+ pyatspi.ROLE_DIALOG,
+ pyatspi.ROLE_FRAME,
+ pyatspi.ROLE_WINDOW]
+
+ while obj and obj.parent \
+ and not obj.getRole() in stopAtRoles \
+ and not obj.parent.getRole() == pyatspi.ROLE_APPLICATION:
+ obj = obj.parent
return obj
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]