[orca] Present the position and contents when switching pages in gnome-documents
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Present the position and contents when switching pages in gnome-documents
- Date: Mon, 30 Sep 2013 14:56:28 +0000 (UTC)
commit 365535215f318fd4fc1d131c5fc8fcd6ca9d566f
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Mon Sep 30 10:51:50 2013 -0400
Present the position and contents when switching pages in gnome-documents
src/orca/scripts/apps/gnome-documents/Makefile.am | 1 +
src/orca/scripts/apps/gnome-documents/__init__.py | 1 +
src/orca/scripts/apps/gnome-documents/script.py | 34 ++++++++++++++
.../apps/gnome-documents/script_utilities.py | 47 ++++++++++++++++++++
4 files changed, 83 insertions(+), 0 deletions(-)
---
diff --git a/src/orca/scripts/apps/gnome-documents/Makefile.am
b/src/orca/scripts/apps/gnome-documents/Makefile.am
index b5e788d..7ee0367 100644
--- a/src/orca/scripts/apps/gnome-documents/Makefile.am
+++ b/src/orca/scripts/apps/gnome-documents/Makefile.am
@@ -1,6 +1,7 @@
orca_python_PYTHON = \
__init__.py \
script.py \
+ script_utilities.py \
speech_generator.py
orca_pythondir=$(pkgpythondir)/scripts/apps/gnome-documents
diff --git a/src/orca/scripts/apps/gnome-documents/__init__.py
b/src/orca/scripts/apps/gnome-documents/__init__.py
index 9ec22d1..cd53af2 100644
--- a/src/orca/scripts/apps/gnome-documents/__init__.py
+++ b/src/orca/scripts/apps/gnome-documents/__init__.py
@@ -20,4 +20,5 @@
"""Custom script for gnome-documents."""
from .script import Script
+from .script_utilities import Utilities
diff --git a/src/orca/scripts/apps/gnome-documents/script.py b/src/orca/scripts/apps/gnome-documents/script.py
index cfdc6df..89c65d5 100644
--- a/src/orca/scripts/apps/gnome-documents/script.py
+++ b/src/orca/scripts/apps/gnome-documents/script.py
@@ -25,8 +25,12 @@ __date__ = "$Date$"
__copyright__ = "Copyright (c) 2013 The Orca Team"
__license__ = "LGPL"
+import pyatspi
+
import orca.scripts.default as default
+import orca.orca_state as orca_state
from .speech_generator import SpeechGenerator
+from .script_utilities import Utilities
class Script(default.Script):
@@ -44,3 +48,33 @@ class Script(default.Script):
return SpeechGenerator(self)
+ def getUtilities(self):
+ """Returns the utilites for this script."""
+
+ return Utilities(self)
+
+ def onNameChanged(self, event):
+ """Callback for accessible name change events."""
+
+ try:
+ eventRole = event.source.getRole()
+ focusRole = orca_state.locusOfFocus.getRole()
+ except:
+ return
+
+ # Present page changes in the previewer.
+ if eventRole == pyatspi.ROLE_LABEL \
+ and focusRole == pyatspi.ROLE_DOCUMENT_FRAME:
+ self.presentMessage(event.any_data)
+
+ # HACK: Reposition the caret offset from the last character to the
+ # first so that SayAll will say all.
+ try:
+ text = orca_state.locusOfFocus.queryText()
+ except NotImplementedError:
+ pass
+ else:
+ text.setCaretOffset(0)
+ return self.sayAll(None)
+
+ default.Script.onNameChanged(self, event)
diff --git a/src/orca/scripts/apps/gnome-documents/script_utilities.py
b/src/orca/scripts/apps/gnome-documents/script_utilities.py
new file mode 100644
index 0000000..d97c41c
--- /dev/null
+++ b/src/orca/scripts/apps/gnome-documents/script_utilities.py
@@ -0,0 +1,47 @@
+# Orca
+#
+# Copyright (C) 2013 The Orca Team.
+#
+# Author: Joanmarie Diggs <jdiggs igalia com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the
+# Free Software Foundation, Inc., Franklin Street, Fifth Floor,
+# Boston MA 02110-1301 USA.
+
+__id__ = "$Id$"
+__version__ = "$Revision$"
+__date__ = "$Date$"
+__copyright__ = "Copyright (c) 2013 The Orca Team."
+__license__ = "LGPL"
+
+import pyatspi
+
+import orca.script_utilities as script_utilities
+
+class Utilities(script_utilities.Utilities):
+
+ def __init__(self, script):
+ script_utilities.Utilities.__init__(self, script)
+
+ def isReadOnlyTextArea(self, obj):
+ if obj.getRole() == pyatspi.ROLE_DOCUMENT_FRAME:
+ return False
+
+ return script_utilities.Utilities.isReadOnlyTextArea(self, obj)
+
+ def isTextArea(self, obj):
+ if obj.getRole() == pyatspi.ROLE_DOCUMENT_FRAME:
+ return True
+
+ return script_utilities.Utilities.isTextArea(self, obj)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]