[orca] Move whereAmI support into the default script
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Move whereAmI support into the default script
- Date: Tue, 21 Nov 2017 20:44:23 +0000 (UTC)
commit cb54ca9edac9444606bc2a1342e724984a36d471
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Tue Nov 21 15:42:27 2017 -0500
Move whereAmI support into the default script
src/orca/Makefile.am | 3 +-
src/orca/script.py | 7 ---
src/orca/script_utilities.py | 15 +++++++
src/orca/scripts/default.py | 17 +++++++-
src/orca/where_am_I.py | 90 ------------------------------------------
5 files changed, 32 insertions(+), 100 deletions(-)
---
diff --git a/src/orca/Makefile.am b/src/orca/Makefile.am
index e6f0cfb..7041dc3 100644
--- a/src/orca/Makefile.am
+++ b/src/orca/Makefile.am
@@ -68,8 +68,7 @@ orca_python_PYTHON = \
speechserver.py \
structural_navigation.py \
text_attribute_names.py \
- tutorialgenerator.py \
- where_am_I.py
+ tutorialgenerator.py
orca_pythondir=$(pkgpythondir)
diff --git a/src/orca/script.py b/src/orca/script.py
index b1feb19..6045470 100644
--- a/src/orca/script.py
+++ b/src/orca/script.py
@@ -55,7 +55,6 @@ from . import settings_manager
from . import sound_generator
from . import speech_generator
from . import structural_navigation
-from . import where_am_I
from . import bookmarks
from . import tutorialgenerator
@@ -115,7 +114,6 @@ class Script:
self.speechGenerator = self.getSpeechGenerator()
self.generatorCache = {}
self.eventCache = {}
- self.whereAmI = self.getWhereAmI()
self.spellcheck = self.getSpellCheck()
self.tutorialGenerator = self.getTutorialGenerator()
@@ -233,11 +231,6 @@ class Script:
"""
return self.structuralNavigation.enabled
- def getWhereAmI(self):
- """Returns the "where am I" class for this script.
- """
- return where_am_I.WhereAmI(self)
-
def getBookmarks(self):
"""Returns the "bookmarks" class for this script.
"""
diff --git a/src/orca/script_utilities.py b/src/orca/script_utilities.py
index b9d5918..8155ad5 100644
--- a/src/orca/script_utilities.py
+++ b/src/orca/script_utilities.py
@@ -1916,6 +1916,21 @@ class Utilities:
return False
+ def realActiveAncestor(self, obj):
+ if obj.getState().contains(pyatspi.STATE_FOCUSED):
+ return obj
+
+ roles = [pyatspi.ROLE_TABLE_CELL,
+ pyatspi.ROLE_COLUMN_HEADER,
+ pyatspi.ROLE_ROW_HEADER,
+ pyatspi.ROLE_LIST_ITEM]
+
+ ancestor = pyatspi.findAncestor(obj, lambda x: x and x.getRole() in roles)
+ if ancestor and not self._script.utilities.isLayoutOnly(ancestor.parent):
+ obj = ancestor
+
+ return obj
+
def realActiveDescendant(self, obj):
"""Given an object that should be a child of an object that
manages its descendants, return the child that is the real
diff --git a/src/orca/scripts/default.py b/src/orca/scripts/default.py
index 606f267..c94bdaf 100644
--- a/src/orca/scripts/default.py
+++ b/src/orca/scripts/default.py
@@ -1999,9 +1999,24 @@ class Script(script.Script):
self.spellcheck.presentErrorDetails(not basicOnly)
obj = orca_state.locusOfFocus
+ if not obj:
+ return False
+
self.updateBraille(obj)
- return self.whereAmI.whereAmI(obj, basicOnly)
+ if basicOnly:
+ formatType = 'basicWhereAmI'
+ else:
+ formatType = 'detailedWhereAmI'
+ speech.speak(self.speechGenerator.generateSpeech(
+ self.utilities.realActiveAncestor(obj),
+ alreadyFocused=True,
+ formatType=formatType,
+ forceMnemonic=True,
+ forceList=True,
+ forceTutorial=True))
+
+ return True
def whereAmIBasic(self, inputEvent):
"""Speaks basic information about the current object of interest.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]