[orca] Use existing script utilities to generate focused item and selected items
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Use existing script utilities to generate focused item and selected items
- Date: Fri, 16 Oct 2015 23:57:09 +0000 (UTC)
commit 8af85523ffdd16a34323ab5a9090e20bdfd9f179
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Fri Oct 16 19:54:20 2015 -0400
Use existing script utilities to generate focused item and selected items
src/orca/braille_generator.py | 13 ++-----------
src/orca/speech_generator.py | 13 ++-----------
2 files changed, 4 insertions(+), 22 deletions(-)
---
diff --git a/src/orca/braille_generator.py b/src/orca/braille_generator.py
index f4952d6..b9affe6 100644
--- a/src/orca/braille_generator.py
+++ b/src/orca/braille_generator.py
@@ -314,17 +314,8 @@ class BrailleGenerator(generator.Generator):
if role not in [pyatspi.ROLE_LIST, pyatspi.ROLE_LIST_BOX]:
return result
- try:
- s = obj.querySelection()
- except NotImplementedError:
- isFocused = \
- lambda x: x and x.getState().contains(pyatspi.STATE_FOCUSED)
- items = pyatspi.utils.findAllDescendants(obj, isFocused)
- else:
- items = [s.getSelectedChild(i) for i in range(s.nSelectedChildren)]
- if not items and obj.childCount:
- items.append(obj[0])
-
+ items = self._script.utilities.selectedChildren(obj)
+ items = items or [self._script.utilities.focusedChild(obj)]
if not (items and items[0]):
return result
diff --git a/src/orca/speech_generator.py b/src/orca/speech_generator.py
index 3af6fd3..9f346e2 100644
--- a/src/orca/speech_generator.py
+++ b/src/orca/speech_generator.py
@@ -1452,17 +1452,8 @@ class SpeechGenerator(generator.Generator):
if role not in [pyatspi.ROLE_LIST, pyatspi.ROLE_LIST_BOX]:
return result
- try:
- s = obj.querySelection()
- except NotImplementedError:
- isFocused = \
- lambda x: x and x.getState().contains(pyatspi.STATE_FOCUSED)
- items = pyatspi.utils.findAllDescendants(obj, isFocused)
- else:
- items = [s.getSelectedChild(i) for i in range(s.nSelectedChildren)]
- if not items and obj.childCount:
- items.append(obj[0])
-
+ items = self._script.utilities.selectedChildren(obj)
+ items = items or [self._script.utilities.focusedChild(obj)]
if not (items and items[0]):
return result
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]