[orca] Add ability to override object role when generating tutorial messages
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Add ability to override object role when generating tutorial messages
- Date: Wed, 2 Sep 2015 14:21:47 +0000 (UTC)
commit 39b4aacdc630845646b5fb28c6299843818d9cb2
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Wed Sep 2 10:18:13 2015 -0400
Add ability to override object role when generating tutorial messages
src/orca/speech_generator.py | 4 +++-
src/orca/tutorialgenerator.py | 5 +++--
2 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/src/orca/speech_generator.py b/src/orca/speech_generator.py
index e6e33ba..b74b032 100644
--- a/src/orca/speech_generator.py
+++ b/src/orca/speech_generator.py
@@ -1858,10 +1858,12 @@ class SpeechGenerator(generator.Generator):
acss = self.voice(SYSTEM)
alreadyFocused = args.get('alreadyFocused', False)
forceTutorial = args.get('forceTutorial', False)
+ role = args.get('role', obj.getRole())
result.extend(self._script.tutorialGenerator.getTutorial(
obj,
alreadyFocused,
- forceTutorial))
+ forceTutorial,
+ role))
if args.get('role', obj.getRole()) == pyatspi.ROLE_ICON \
and args.get('formatType', 'unfocused') == 'basicWhereAmI':
frame, dialog = self._script.utilities.frameAndDialog(obj)
diff --git a/src/orca/tutorialgenerator.py b/src/orca/tutorialgenerator.py
index 09bc87c..5c17ab7 100644
--- a/src/orca/tutorialgenerator.py
+++ b/src/orca/tutorialgenerator.py
@@ -755,7 +755,7 @@ class TutorialGenerator:
def _getModeTutorial(self, obj, alreadyFocused, forceTutorial):
return []
- def getTutorial(self, obj, alreadyFocused, forceTutorial=False):
+ def getTutorial(self, obj, alreadyFocused, forceTutorial=False, role=None):
"""Get the tutorial for an Accessible object. This will look
first to the specific tutorial generators and if this
does not exist then return the empty tutorial.
@@ -766,6 +766,7 @@ class TutorialGenerator:
- obj: the object
- alreadyFocused: False if object just received focus
- forceTutorial: used for when whereAmI really needs the tutorial string
+ - role: Alternative role to use
Returns a list of utterances to be spoken.
"""
@@ -777,7 +778,7 @@ class TutorialGenerator:
return []
utterances = []
- role = obj.getRole()
+ role = role or obj.getRole()
msg = self._getModeTutorial(obj, alreadyFocused, forceTutorial)
if not msg:
if role in self.tutorialGenerators:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]