[orca] Move getCaretContext() to script utilities
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Move getCaretContext() to script utilities
- Date: Mon, 1 Jun 2015 18:36:25 +0000 (UTC)
commit 8d99871756e8b6294028fbdbade7c10f3c321218
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Mon Jun 1 14:35:24 2015 -0400
Move getCaretContext() to script utilities
src/orca/script_utilities.py | 11 +++++++++++
src/orca/scripts/default.py | 11 -----------
src/orca/structural_navigation.py | 4 ++--
3 files changed, 13 insertions(+), 13 deletions(-)
---
diff --git a/src/orca/script_utilities.py b/src/orca/script_utilities.py
index ec15ea5..dd49016 100644
--- a/src/orca/script_utilities.py
+++ b/src/orca/script_utilities.py
@@ -1724,6 +1724,17 @@ class Utilities:
return [textContents, startOffset, endOffset]
+ def getCaretContext(self):
+ obj = orca_state.locusOfFocus
+ try:
+ offset = obj.queryText().caretOffset
+ except NotImplementedError:
+ offset = 0
+ except:
+ offset = -1
+
+ return obj, offset
+
def setCaretOffset(self, obj, offset):
"""Set the caret offset on a given accessible. Similar to
Accessible.setCaretOffset()
diff --git a/src/orca/scripts/default.py b/src/orca/scripts/default.py
index c141281..ce4cd89 100644
--- a/src/orca/scripts/default.py
+++ b/src/orca/scripts/default.py
@@ -719,17 +719,6 @@ class Script(script.Script):
return script.Script.processKeyboardEvent(self, keyboardEvent)
- def getCaretContext(self):
- obj = orca_state.locusOfFocus
- try:
- offset = obj.queryText().caretOffset
- except NotImplementedError:
- offset = 0
- except:
- offset = -1
-
- return obj, offset
-
def _saveFocusedObjectInfo(self, obj):
"""Saves some basic information about obj. Note that this method is
intended to be called primarily (if not only) by locusOfFocusChanged().
diff --git a/src/orca/structural_navigation.py b/src/orca/structural_navigation.py
index 7dbe1e9..ee9a1cd 100644
--- a/src/orca/structural_navigation.py
+++ b/src/orca/structural_navigation.py
@@ -964,7 +964,7 @@ class StructuralNavigation:
whether wrapping took place.
"""
- [currentObj, offset] = self._script.getCaretContext()
+ [currentObj, offset] = self._script.utilities.getCaretContext()
document = self._getDocument()
# If the current object is the document itself, find an actual
@@ -1085,7 +1085,7 @@ class StructuralNavigation:
"""
ancestors = []
- [currentObj, offset] = self._script.getCaretContext()
+ [currentObj, offset] = self._script.utilities.getCaretContext()
obj = currentObj.parent
while obj:
ancestors.append(obj)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]