[orca] Make the minimum number of words in unrelated labels an optional argument
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Make the minimum number of words in unrelated labels an optional argument
- Date: Sun, 29 Apr 2018 20:16:52 +0000 (UTC)
commit e9a900acce696701f1a3f36e142b2d368170b00b
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Sun Apr 29 16:15:46 2018 -0400
Make the minimum number of words in unrelated labels an optional argument
src/orca/script_utilities.py | 6 +++---
src/orca/scripts/default.py | 2 +-
src/orca/scripts/web/script_utilities.py | 4 ++--
3 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/src/orca/script_utilities.py b/src/orca/script_utilities.py
index 2d2772a..65782ec 100644
--- a/src/orca/script_utilities.py
+++ b/src/orca/script_utilities.py
@@ -512,7 +512,7 @@ class Utilities:
if not displayedText and role in [pyatspi.ROLE_PUSH_BUTTON, pyatspi.ROLE_LIST_ITEM]:
labels = self.unrelatedLabels(obj)
if not labels:
- labels = self.unrelatedLabels(obj, onlyShowing=False)
+ labels = self.unrelatedLabels(obj, onlyShowing=False, minimumWords=1)
displayedText = " ".join(map(self.displayedText, labels))
if self.DISPLAYED_TEXT not in self._script.generatorCache:
@@ -2240,7 +2240,7 @@ class Utilities:
return False
- def unrelatedLabels(self, root, onlyShowing=True):
+ def unrelatedLabels(self, root, onlyShowing=True, minimumWords=3):
"""Returns a list containing all the unrelated (i.e., have no
relations to anything and are not a fundamental element of a
more atomic component like a combo box) labels under the given
@@ -2279,7 +2279,7 @@ class Utilities:
name = label.name
if name and name in [rootName, label.parent.name]:
continue
- if len(name.split()) < 3:
+ if len(name.split()) < minimumWords:
continue
d[name] = label
labels = list(d.values())
diff --git a/src/orca/scripts/default.py b/src/orca/scripts/default.py
index c4d0871..e6f949a 100644
--- a/src/orca/scripts/default.py
+++ b/src/orca/scripts/default.py
@@ -2509,7 +2509,7 @@ class Script(script.Script):
if role == pyatspi.ROLE_NOTIFICATION:
speech.speak(self.speechGenerator.generateSpeech(obj))
visibleOnly = not self.utilities.isStatusBarNotification(obj)
- labels = self.utilities.unrelatedLabels(obj, visibleOnly)
+ labels = self.utilities.unrelatedLabels(obj, visibleOnly, 1)
msg = ''.join(map(self.utilities.displayedText, labels))
self.displayBrailleMessage(msg, flashTime=settings.brailleFlashTime)
notification_messages.saveMessage(msg)
diff --git a/src/orca/scripts/web/script_utilities.py b/src/orca/scripts/web/script_utilities.py
index 1a61a88..4b59d9b 100644
--- a/src/orca/scripts/web/script_utilities.py
+++ b/src/orca/scripts/web/script_utilities.py
@@ -1656,9 +1656,9 @@ class Utilities(script_utilities.Utilities):
keys = map(lambda x: x.replace(" ", "+"), map(self.labelFromKeySequence, keys))
return ["", " ".join(keys), ""]
- def unrelatedLabels(self, root, onlyShowing=True):
+ def unrelatedLabels(self, root, onlyShowing=True, minimumWords=3):
if not (root and self.inDocumentContent(root)):
- return super().unrelatedLabels(root, onlyShowing)
+ return super().unrelatedLabels(root, onlyShowing, minimumWords)
return []
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]