[orca/gnome-3-14] Prevent repeating of labels and tutorial messages in entries
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca/gnome-3-14] Prevent repeating of labels and tutorial messages in entries
- Date: Tue, 23 Sep 2014 12:24:16 +0000 (UTC)
commit 15a23f002b433dae0dc29c0de40caff7378b9b02
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Sat Sep 20 18:29:41 2014 -0400
Prevent repeating of labels and tutorial messages in entries
src/orca/scripts/toolkits/Gecko/script.py | 6 +++++-
.../scripts/toolkits/Gecko/script_utilities.py | 13 +++++++++++++
.../scripts/toolkits/Gecko/speech_generator.py | 20 +++++++++++++++-----
3 files changed, 33 insertions(+), 6 deletions(-)
---
diff --git a/src/orca/scripts/toolkits/Gecko/script.py b/src/orca/scripts/toolkits/Gecko/script.py
index 323721f..ec5d535 100644
--- a/src/orca/scripts/toolkits/Gecko/script.py
+++ b/src/orca/scripts/toolkits/Gecko/script.py
@@ -2489,8 +2489,12 @@ class Script(default.Script):
lastObj = None
for content in contents:
[obj, startOffset, endOffset, string] = content
+ if not self.utilities.justEnteredObject(obj, startOffset, endOffset):
+ formatType = 'focused'
+ else:
+ formatType = 'unfocused'
utterance = self.speechGenerator.generateSpeech(
- obj, startOffset=startOffset, endOffset=endOffset)
+ obj, startOffset=startOffset, endOffset=endOffset, formatType=formatType)
if eliminatePauses:
utterance = list(filter(lambda x: not isinstance(x, Pause), utterance))
if utterance and utterance[0]:
diff --git a/src/orca/scripts/toolkits/Gecko/script_utilities.py
b/src/orca/scripts/toolkits/Gecko/script_utilities.py
index f87b74e..30a6efb 100644
--- a/src/orca/scripts/toolkits/Gecko/script_utilities.py
+++ b/src/orca/scripts/toolkits/Gecko/script_utilities.py
@@ -792,6 +792,19 @@ class Utilities(script_utilities.Utilities):
return objects
+ def justEnteredObject(self, obj, startOffset, endOffset):
+ lastKey, mods = self.lastKeyAndModifiers()
+ if lastKey == "Down" and not mods:
+ return startOffset == 0
+
+ if lastKey == "Up" and not mods:
+ text = self.queryNonEmptyText(obj)
+ if not text:
+ return True
+ return endOffset == text.characterCount
+
+ return True
+
def isTextBlockElement(self, obj):
if not self._script.inDocumentContent(obj):
return False
diff --git a/src/orca/scripts/toolkits/Gecko/speech_generator.py
b/src/orca/scripts/toolkits/Gecko/speech_generator.py
index c1d8dbd..7ddad9a 100644
--- a/src/orca/scripts/toolkits/Gecko/speech_generator.py
+++ b/src/orca/scripts/toolkits/Gecko/speech_generator.py
@@ -148,16 +148,18 @@ class SpeechGenerator(speech_generator.SpeechGenerator):
self, obj, **args)
def _generateLabel(self, obj, **args):
+ start = args.get('startOffset')
+ end = args.get('endOffset')
+ if isinstance(start, int) and isinstance(end, int) \
+ and not self._script.utilities.justEnteredObject(obj, start, end):
+ return []
+
acss = self.voice(speech_generator.DEFAULT)
result = speech_generator.SpeechGenerator._generateLabel(self,
obj,
**args)
if self._script.utilities.shouldInferLabelFor(obj):
- start = args.get('startOffset')
- if isinstance(start, int) and start > 0:
- return []
-
label, objects = self._script.labelInference.infer(obj, False)
if label:
result.append(label)
@@ -180,6 +182,12 @@ class SpeechGenerator(speech_generator.SpeechGenerator):
if self._script.utilities.isTextBlockElement(obj):
return []
+ start = args.get('startOffset')
+ end = args.get('endOffset')
+ if isinstance(start, int) and isinstance(end, int) \
+ and not self._script.utilities.justEnteredObject(obj, start, end):
+ return []
+
result = speech_generator.SpeechGenerator._generateLabelOrName(
self, obj, **args)
@@ -195,7 +203,9 @@ class SpeechGenerator(speech_generator.SpeechGenerator):
role = args.get('role', obj.getRole())
force = args.get('force', False)
start = args.get('startOffset')
- if role == pyatspi.ROLE_ENTRY and isinstance(start, int) and start > 0:
+ end = args.get('endOffset')
+ if isinstance(start, int) and isinstance(end, int) \
+ and not self._script.utilities.justEnteredObject(obj, start, end):
return []
# Saying "menu item" for a combo box can confuse users. Therefore,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]