[orca] Filter out redundant described-by targets
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Filter out redundant described-by targets
- Date: Tue, 12 Apr 2022 12:12:11 +0000 (UTC)
commit 326ba042cf6187ba2b8a2ad34f3d0e2c4eb526a0
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Tue Apr 12 14:07:23 2022 +0200
Filter out redundant described-by targets
Gtk 4 is sometimes exposing one or more targets both through the
labelled-by relation and the described-by relation. This causes us to
double-speak the information if the user has enabled the presentation
of descriptions.
This commit returns an empty list of described-by targets when they
are the same as the list of labelled-by targets in order to eliminate
that duplication.
src/orca/script_utilities.py | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
---
diff --git a/src/orca/script_utilities.py b/src/orca/script_utilities.py
index bf0540d16..ca0407153 100644
--- a/src/orca/script_utilities.py
+++ b/src/orca/script_utilities.py
@@ -475,7 +475,20 @@ class Utilities:
describedBy = lambda x: x.getRelationType() == pyatspi.RELATION_DESCRIBED_BY
relation = filter(describedBy, relations)
- return [r.getTarget(i) for r in relation for i in range(r.getNTargets())]
+ descriptions = [r.getTarget(i) for r in relation for i in range(r.getNTargets())]
+ if not descriptions:
+ return []
+
+ labelledBy = lambda x: x.getRelationType() == pyatspi.RELATION_LABELLED_BY
+ relation = filter(labelledBy, relations)
+ labels = [r.getTarget(i) for r in relation for i in range(r.getNTargets())]
+
+ if descriptions == labels:
+ msg = "INFO: %s's described-by targets are the same as labelled-by targets" % obj
+ debug.println(debug.LEVEL_INFO, msg, True)
+ return []
+
+ return descriptions
def detailsContentForObject(self, obj):
details = self.detailsForObject(obj)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]