orca r4237 - in branches/phase2: . src/orca src/orca/plugins src/orca/plugins/structural_navigation
- From: joanied svn gnome org
- To: svn-commits-list gnome org
- Subject: orca r4237 - in branches/phase2: . src/orca src/orca/plugins src/orca/plugins/structural_navigation
- Date: Wed, 17 Sep 2008 12:51:39 +0000 (UTC)
Author: joanied
Date: Wed Sep 17 12:51:39 2008
New Revision: 4237
URL: http://svn.gnome.org/viewvc/orca?rev=4237&view=rev
Log:
Add Structural Navigation in as a Plugin.
Added:
branches/phase2/src/orca/plugins/structural_navigation/ (props changed)
branches/phase2/src/orca/plugins/structural_navigation/Makefile.am (contents, props changed)
branches/phase2/src/orca/plugins/structural_navigation/__init__.py (contents, props changed)
branches/phase2/src/orca/plugins/structural_navigation/braille_bindings.py (contents, props changed)
branches/phase2/src/orca/plugins/structural_navigation/keyboard_bindings.py (contents, props changed)
branches/phase2/src/orca/plugins/structural_navigation/plugin.py (contents, props changed)
Modified:
branches/phase2/configure.in
branches/phase2/src/orca/default.py
branches/phase2/src/orca/plugins/Makefile.am
Modified: branches/phase2/configure.in
==============================================================================
--- branches/phase2/configure.in (original)
+++ branches/phase2/configure.in Wed Sep 17 12:51:39 2008
@@ -164,6 +164,7 @@
src/orca/plugins/debug_actions/Makefile
src/orca/plugins/flat_review/Makefile
src/orca/plugins/speech_parameters/Makefile
+src/orca/plugins/structural_navigation/Makefile
src/orca/plugins/where_am_i/Makefile
src/orca/scripts/Makefile
src/orca/scripts/applications/Makefile
Modified: branches/phase2/src/orca/default.py
==============================================================================
--- branches/phase2/src/orca/default.py (original)
+++ branches/phase2/src/orca/default.py Wed Sep 17 12:51:39 2008
@@ -81,6 +81,20 @@
except:
log.exception("handled exception while importing module:")
+ # TODO/QUESTION: Most scripts are not going to have a need for
+ # structural navigation (I would like to implement it for OOo
+ # Writer for 2.26 'fun stuff' should time permit, however.).
+ # I assume that the enabling of the structural_navigation plugin
+ # will be done on a script-by-script basis in this method(?).
+ # Lacking scripts, I'm putting it here and uncommenting it as I
+ # work. :-)
+ #
+ #try:
+ # import plugins.structural_navigation
+ # pluginClasses.append(plugins.structural_navigation.Plugin)
+ #except:
+ # log.exception("handled exception while importing module:")
+
return script.Script._getPluginClasses(self) + pluginClasses
def _createObjectEventListeners(self):
Modified: branches/phase2/src/orca/plugins/Makefile.am
==============================================================================
--- branches/phase2/src/orca/plugins/Makefile.am (original)
+++ branches/phase2/src/orca/plugins/Makefile.am Wed Sep 17 12:51:39 2008
@@ -9,4 +9,5 @@
debug_actions \
flat_review \
speech_parameters \
+ structural_navigation \
where_am_i
Added: branches/phase2/src/orca/plugins/structural_navigation/Makefile.am
==============================================================================
--- (empty file)
+++ branches/phase2/src/orca/plugins/structural_navigation/Makefile.am Wed Sep 17 12:51:39 2008
@@ -0,0 +1,9 @@
+orca_pathdir=$(pyexecdir)
+
+orca_python_PYTHON = \
+ __init__.py \
+ braille_bindings.py \
+ keyboard_bindings.py \
+ plugin.py
+
+orca_pythondir=$(pyexecdir)/orca/plugins/structural_navigation
Added: branches/phase2/src/orca/plugins/structural_navigation/__init__.py
==============================================================================
--- (empty file)
+++ branches/phase2/src/orca/plugins/structural_navigation/__init__.py Wed Sep 17 12:51:39 2008
@@ -0,0 +1,25 @@
+# Copyright 2008 Sun Microsystems Inc.
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Library General Public
+# License as published by the Free Software Foundation; either
+# version 2 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
+# Library General Public License for more details.
+#
+# You should have received a copy of the GNU Library 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.
+
+"""A Plugin for providing Structural Navigation operations.
+"""
+
+__id__ = "$Id$"
+__copyright__ = "Copyright (c) 2008 Sun Microsystems Inc."
+__license__ = "LGPL"
+
+from plugin import Plugin
Added: branches/phase2/src/orca/plugins/structural_navigation/braille_bindings.py
==============================================================================
--- (empty file)
+++ branches/phase2/src/orca/plugins/structural_navigation/braille_bindings.py Wed Sep 17 12:51:39 2008
@@ -0,0 +1,29 @@
+# Copyright 2008 Sun Microsystems Inc.
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Library General Public
+# License as published by the Free Software Foundation; either
+# version 2 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
+# Library General Public License for more details.
+#
+# You should have received a copy of the GNU Library 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.
+
+"""Braille bindings for Structural Navigation operations.
+"""
+
+__id__ = "$Id$"
+__copyright__ = "Copyright (c) 2008 Sun Microsystems Inc."
+__license__ = "LGPL"
+
+bindings = []
+
+if __name__ == "__main__":
+ for binding in bindings:
+ print binding
Added: branches/phase2/src/orca/plugins/structural_navigation/keyboard_bindings.py
==============================================================================
--- (empty file)
+++ branches/phase2/src/orca/plugins/structural_navigation/keyboard_bindings.py Wed Sep 17 12:51:39 2008
@@ -0,0 +1,157 @@
+# Copyright 2008 Sun Microsystems Inc.
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Library General Public
+# License as published by the Free Software Foundation; either
+# version 2 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
+# Library General Public License for more details.
+#
+# You should have received a copy of the GNU Library 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.
+
+"""Keyboard bindings for Structural Navigation operations.
+"""
+
+__id__ = "$Id$"
+__copyright__ = "Copyright (c) 2008 Sun Microsystems Inc."
+__license__ = "LGPL"
+
+import orca.input_bindings as input_bindings
+import orca.input_event as input_event
+
+# TODO: For the purpose of testing bindings, etc. I have bound
+# everything. I'll unbind later. :-)
+#
+structuralNavigationBindings = {
+ "anchor": {
+ "previous": ["a", input_event.SHIFT_MODIFIER_MASK],
+ "next" : ["a", input_event.NO_MODIFIER_MASK]
+ },
+ "blockquote": {
+ "previous": ["q", input_event.SHIFT_MODIFIER_MASK],
+ "next" : ["q", input_event.NO_MODIFIER_MASK]
+ },
+ "button": {
+ "previous": ["b", input_event.SHIFT_MODIFIER_MASK],
+ "next" : ["b", input_event.NO_MODIFIER_MASK]
+ },
+ "checkBox": {
+ "previous": ["x", input_event.SHIFT_MODIFIER_MASK],
+ "next" : ["x", input_event.NO_MODIFIER_MASK]
+ },
+ "chunk": {
+ "previous": ["o", input_event.SHIFT_MODIFIER_MASK],
+ "next" : ["o", input_event.NO_MODIFIER_MASK]
+ },
+ "comboBox": {
+ "previous": ["c", input_event.SHIFT_MODIFIER_MASK],
+ "next" : ["c", input_event.NO_MODIFIER_MASK]
+ },
+ "entry": {
+ "previous": ["e", input_event.SHIFT_MODIFIER_MASK],
+ "next" : ["e", input_event.NO_MODIFIER_MASK]
+ },
+ "formField": {
+ "previous": ["Tab", input_event.ORCA_SHIFT_MODIFIER_MASK],
+ "next" : ["Tab", input_event.ORCA_MODIFIER_MASK]
+ },
+ "heading": {
+ "previous": ["h", input_event.SHIFT_MODIFIER_MASK],
+ "next" : ["h", input_event.NO_MODIFIER_MASK]
+ },
+ "heading1": {
+ "previous": ["1", input_event.SHIFT_MODIFIER_MASK],
+ "next" : ["1", input_event.NO_MODIFIER_MASK]
+ },
+ "heading2": {
+ "previous": ["2", input_event.SHIFT_MODIFIER_MASK],
+ "next" : ["2", input_event.NO_MODIFIER_MASK]
+ },
+ "heading3": {
+ "previous": ["3", input_event.SHIFT_MODIFIER_MASK],
+ "next" : ["3", input_event.NO_MODIFIER_MASK]
+ },
+ "heading4": {
+ "previous": ["4", input_event.SHIFT_MODIFIER_MASK],
+ "next" : ["4", input_event.NO_MODIFIER_MASK]
+ },
+ "heading5": {
+ "previous": ["5", input_event.SHIFT_MODIFIER_MASK],
+ "next" : ["5", input_event.NO_MODIFIER_MASK]
+ },
+ "heading6": {
+ "previous": ["6", input_event.SHIFT_MODIFIER_MASK],
+ "next" : ["6", input_event.NO_MODIFIER_MASK]
+ },
+ "landmark": {
+ "previous": ["d", input_event.SHIFT_MODIFIER_MASK],
+ "next" : ["d", input_event.NO_MODIFIER_MASK]
+ },
+ "list": {
+ "previous": ["l", input_event.SHIFT_MODIFIER_MASK],
+ "next" : ["l", input_event.NO_MODIFIER_MASK]
+ },
+ "listItem": {
+ "previous": ["i", input_event.SHIFT_MODIFIER_MASK],
+ "next" : ["i", input_event.NO_MODIFIER_MASK]
+ },
+ "liveRegion": {
+ "previous": ["r", input_event.SHIFT_MODIFIER_MASK],
+ "next" : ["r", input_event.NO_MODIFIER_MASK],
+ "last" : ["y", input_event.NO_MODIFIER_MASK]
+ },
+ "paragraph": {
+ "previous": ["p", input_event.SHIFT_MODIFIER_MASK],
+ "next" : ["p", input_event.NO_MODIFIER_MASK]
+ },
+ "radioButton": {
+ "previous": ["r", input_event.ORCA_SHIFT_MODIFIER_MASK],
+ "next" : ["r", input_event.ORCA_MODIFIER_MASK]
+ },
+ "table": {
+ "previous": ["t", input_event.SHIFT_MODIFIER_MASK],
+ "next" : ["t", input_event.NO_MODIFIER_MASK]
+ },
+ "tableCell": {
+ "left" : ["Left", input_event.SHIFT_ALT_MODIFIER_MASK],
+ "right" : ["Right", input_event.SHIFT_ALT_MODIFIER_MASK],
+ "up" : ["Up", input_event.SHIFT_ALT_MODIFIER_MASK],
+ "down" : ["Down", input_event.SHIFT_ALT_MODIFIER_MASK],
+ "first" : ["Home", input_event.SHIFT_ALT_MODIFIER_MASK],
+ "last" : ["End", input_event.SHIFT_ALT_MODIFIER_MASK]
+ },
+ "unvisitedLink": {
+ "previous": ["u", input_event.SHIFT_MODIFIER_MASK],
+ "next" : ["u", input_event.NO_MODIFIER_MASK]
+ },
+ "visitedLink": {
+ "previous": ["v", input_event.SHIFT_MODIFIER_MASK],
+ "next" : ["v", input_event.NO_MODIFIER_MASK]
+ }
+}
+bindings = [
+ input_bindings.KeyboardBinding(
+ "z",
+ input_event.defaultModifierMask,
+ input_event.ORCA_MODIFIER_MASK,
+ "toggleStructuralNavigationHandler"),
+]
+for objectType, keyBindings in structuralNavigationBindings.items():
+ objectType = objectType[0].capitalize() + objectType[1:]
+ for direction, [key, modifierMask] in keyBindings.items():
+ bindings.append(
+ input_bindings.KeyboardBinding(
+ key,
+ input_event.defaultModifierMask,
+ modifierMask,
+ "go%s%sHandler" % (direction.capitalize(), objectType)))
+
+if __name__ == "__main__":
+ for binding in bindings:
+ print binding
Added: branches/phase2/src/orca/plugins/structural_navigation/plugin.py
==============================================================================
--- (empty file)
+++ branches/phase2/src/orca/plugins/structural_navigation/plugin.py Wed Sep 17 12:51:39 2008
@@ -0,0 +1,390 @@
+# Copyright 2008 Sun Microsystems Inc.
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Library General Public
+# License as published by the Free Software Foundation; either
+# version 2 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
+# Library General Public License for more details.
+#
+# You should have received a copy of the GNU Library 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.
+
+"""A Plugin for handling Structural Navigation.
+"""
+
+__id__ = "$Id$"
+__copyright__ = "Copyright (c) 2008 Sun Microsystems Inc."
+__license__ = "LGPL"
+
+import logging
+log = logging.getLogger('orca.plugins.structural_navigation.plugin')
+
+import orca.input_bindings as input_bindings
+import orca.plugin as plugin
+
+from orca.orca_i18n import _ # for gettext support
+
+from keyboard_bindings import bindings as keyboardBindings
+
+try:
+ from braille_bindings import bindings as brailleBindings
+except:
+ log.exception("Not using braille bindings because of this exception:")
+ brailleBindings = []
+
+class Plugin(plugin.Plugin):
+ """A plugin for handling Structural Navigation.
+ """
+ def __init__(self, owner, scriptSettings):
+ """Creates a Plugin for the given script.
+ This method should not be called by anyone except the
+ owner.
+
+ Arguments:
+ - owner: the Script owning this Plugin
+ - scriptSettings: the Settings for the script
+ """
+ self._handlerDescriptions = {
+ "anchor": {
+ # Translators: this is for navigating among anchors in a
+ # document. An anchor is a named spot that one can jump to.
+ #
+ "previous" : _("Goes to previous anchor."),
+ # Translators: this is for navigating among anchors in a
+ # document. An anchor is a named spot that one can jump to.
+ #
+ "next" : _("Goes to next anchor.")
+ },
+ "blockquote": {
+ # Translators: this is for navigating among blockquotes in a
+ # document.
+ #
+ "previous" : _("Goes to previous blockquote."),
+ # Translators: this is for navigating among blockquotes in a
+ # document.
+ #
+ "next" : _("Goes to next blockquote.")
+ },
+ "button": {
+ # Translators: this is for navigating among buttons in a form
+ # within a document.
+ #
+ "previous" : _("Goes to previous button."),
+ # Translators: this is for navigating among buttons in a form
+ # within a document.
+ #
+ "next" : _("Goes to next button.")
+ },
+ "checkBox": {
+ # Translators: this is for navigating among check boxes in a
+ # form within a document.
+ #
+ "previous" : _("Goes to previous check box."),
+ # Translators: this is for navigating among check boxes in a
+ # form within a document.
+ #
+ "next" : _("Goes to next check box.")
+ },
+ "chunk": {
+ # Translators: this is for navigating a document in a
+ # structural manner, where a "large object" is a logical
+ # chunk of text, such as a paragraph, a list, a table, etc.
+ #
+ "previous" : _("Goes to previous large object."),
+ # Translators: this is for navigating a document in a
+ # structural manner, where a "large object" is a logical
+ # chunk of text, such as a paragraph, a list, a table, etc.
+ #
+ "next" : _("Goes to next large object.")
+ },
+ "comboBox": {
+ # Translators: this is for navigating among combo boxes in a
+ # form within a document.
+ #
+ "previous" : _("Goes to previous combo box."),
+ # Translators: this is for navigating among combo boxes in a
+ # form within a document.
+ #
+ "next" : _("Goes to next combo box.")
+ },
+ "entry": {
+ # Translators: this is for navigating among text entries in a
+ # form within a document.
+ #
+ "previous" : _("Goes to previous entry."),
+ # Translators: this is for navigating among text entries in a
+ # form within a document.
+ #
+ "next" : _("Goes to next entry.")
+ },
+ "formField": {
+ # Translators: this is for navigating among fields in a form
+ # within a document.
+ #
+ "previous" : _("Goes to previous form field."),
+ # Translators: this is for navigating among fields in a form
+ # within a document.
+ #
+ "next" : _("Goes to next form field.")
+ },
+ "heading": {
+ # Translators: this is for navigating in a document by
+ # heading. (e.g. <h1>)
+ #
+ "previous" : _("Goes to previous heading."),
+ # Translators: this is for navigating in a document by
+ # heading. (e.g. <h1>)
+ #
+ "next" : _("Goes to next heading.")
+ },
+ "landmark": {
+ # Translators: this is for navigating to the previous ARIA
+ # role landmark. ARIA role landmarks are the W3C defined
+ # HTML tag attribute "role" used to identify important part
+ # of webpage like banners, main context, search etc.
+ #
+ "previous" : _("Goes to previous landmark."),
+ # Translators: this is for navigating to the next ARIA
+ # role landmark. ARIA role landmarks are the W3C defined
+ # HTML tag attribute "role" used to identify important part
+ # of webpage like banners, main context, search etc.
+ #
+ "next" : _("Goes to next landmark.")
+ },
+ "list": {
+ # Translators: this is for navigating among bulleted/numbered
+ # lists in a document.
+ #
+ "previous" : _("Goes to previous list."),
+ # Translators: this is for navigating among bulleted/numbered
+ # lists in a document.
+ #
+ "next" : _("Goes to next list.")
+ },
+ "listItem": {
+ # Translators: this is for navigating among bulleted/numbered
+ # list items in a document.
+ #
+ "previous" : _("Goes to previous list item."),
+ # Translators: this is for navigating among bulleted/numbered
+ # list items in a document.
+ #
+ "next" : _("Goes to next list item.")
+ },
+ "liveRegion": {
+ # Translators: this is for navigating between live regions
+ #
+ "previous" : _("Goes to previous live region."),
+ # Translators: this is for navigating between live regions
+ #
+ "next" : _("Goes to next live region."),
+ # Translators: this is for navigating to the last live region
+ # to make an announcement.
+ #
+ "last" : _("Goes to last live region.")
+ },
+ "paragraph": {
+ # Translators: this is for navigating among paragraphs in a
+ # document.
+ #
+ "previous" : _("Goes to previous paragraph."),
+ # Translators: this is for navigating among paragraphs in a
+ # document.
+ #
+ "next" : _("Goes to next paragraph.")
+ },
+ "radioButton": {
+ # Translators: this is for navigating among radio buttons in
+ # a form within a document.
+ #
+ "previous" : _("Goes to previous radio button."),
+ # Translators: this is for navigating among radio buttons in
+ # a form within a document.
+ #
+ "next" : _("Goes to next radio button.")
+ },
+ "table": {
+ # Translators: this is for navigating among tables in a
+ # document.
+ #
+ "previous" : _("Goes to previous table."),
+ # Translators: this is for navigating among tables in a
+ # document.
+ #
+ "next" : _("Goes to next table.")
+ },
+ "tableCell": {
+ # Translators: this is for navigating among table cells in a
+ # document.
+ #
+ "left" : _("Goes left one cell."),
+ # Translators: this is for navigating among table cells in a
+ # document.
+ #
+ "right" : _("Goes right one cell."),
+ # Translators: this is for navigating among table cells in a
+ # document.
+ #
+ "up" : _("Goes up one cell."),
+ # Translators: this is for navigating among table cells in a
+ # document.
+ #
+ "down" : _("Goes down one cell."),
+ # Translators: this is for navigating among table cells in a
+ # document.
+ #
+ "first" : _("Goes to the first cell in a table."),
+ # Translators: this is for navigating among table cells in a
+ # document.
+ #
+ "last" : _("Goes to the last cell in a table.")
+ },
+ "unvisitedLink": {
+ # Translators: this is for navigating among unvisited links
+ # in a document.
+ #
+ "previous" : _("Goes to previous unvisited link."),
+ # Translators: this is for navigating among unvisited links
+ # in a document.
+ #
+ "next" : _("Goes to next unvisited link.")
+ },
+ "visitedLink": {
+ # Translators: this is for navigating among visited links in
+ # a document.
+ #
+ "previous" : _("Goes to previous visited link."),
+ # Translators: this is for navigating among visited links in
+ # a document.
+ #
+ "next" : _("Goes to next visited link.")
+ }
+ }
+ minLevel, maxLevel = self._headingLevels()
+ for i in range(minLevel, maxLevel + 1):
+ self._handlerDescriptions["heading%d" % i] = {
+ # Translators: this is for navigating in a document by
+ # heading. (e.g. <h1> is a heading at level 1).
+ #
+ "previous" : _("Goes to previous heading at level %d.") % i,
+ # Translators: this is for navigating in a document by heading.
+ # (e.g. <h1> is a heading at level 1).
+ #
+ "next" : _("Goes to next heading at level %d.") % i
+ }
+
+ plugin.Plugin.__init__(self, owner, scriptSettings)
+
+ def _createInputEventHandlers(self):
+ """Defines InputEventHandler fields for this script that can be
+ called by the key and braille bindings.
+ """
+ handlers = plugin.Plugin._createInputEventHandlers(self)
+ handlers.update({
+ "toggleStructuralNavigationHandler" : input_bindings.Handler(
+ Plugin._toggleStructuralNavigation,
+ # Translators: the structural navigation keys are designed
+ # to move the caret around the document content by object
+ # type. Thus H moves you to the next heading, Shift H to
+ # the previous heading, T to the next table, and so on.
+ # This feature needs to be toggle-able so that it does not
+ # interfere with normal writing functions.
+ #
+ _("Toggles structural navigation keys.")),
+ })
+ for objectType, descriptions in self._handlerDescriptions.items():
+ objectType = objectType[0].capitalize() + objectType[1:]
+ for direction, description in descriptions.items():
+ handler = "go%s%sHandler" % \
+ (direction.capitalize(), objectType)
+ function = self._goDirectionFactory(objectType, direction)
+ handlers.update({
+ handler : input_bindings.Handler(
+ function,
+ description)
+ })
+ return handlers
+
+ def _createKeyboardBindings(self, handlers):
+ """Defines the key bindings for this script.
+
+ Returns an instance of input_bindings.KeyboardBindings.
+ """
+ bindings = plugin.Plugin._createKeyboardBindings(self, handlers)
+ bindings.extend(keyboardBindings)
+ return bindings
+
+ def _createBrailleBindings(self, handlers):
+ """Defines the braille bindings for this script.
+
+ Returns an instance of input_bindings.BrailleBindings.
+ """
+ bindings = plugin.Plugin._createBrailleBindings(self, handlers)
+ bindings.extend(brailleBindings)
+ return bindings
+
+ def _toggleStructuralNavigation(self, inputEvent=None, modifiers=None):
+ """Toggles structural navigation keys.
+ """
+ log.debug("_toggleStructuralNavigation: %s" % inputEvent)
+
+ def _headingLevels(self):
+ """Returns the [minimum heading level, maximum heading level]
+ which should be navigable via structural navigation.
+ """
+ return [1, 6]
+
+ def _goDirectionFactory(self, objectType, direction):
+ """Generates a "_go" method for the specified objectType in
+ the specified direction.
+
+ Arguments:
+ - objectType: the name/type of the object (e.g. "blockquote")
+ - direction: a string indicating the direction (e.g. "next" or
+ "first")
+ """
+
+ def _go(self, inputEvent=None, modifiers=None):
+ """Moves to the next instance of an object of a particular type
+ in a particular direction.
+ """
+ self._goObject(objectType, direction, inputEvent, modifiers)
+ return _go
+
+ def _goObject(self, objectType, direction, inputEvent=None,
+ modifiers=None):
+ """Moves to the next (or previous) instance of an object of
+ objectType.
+
+ Arguments:
+ - objectType: the name/type of the object (e.g. "blockquote")
+ - direction: a string indicating the direction (e.g. "next" or
+ "first")
+ """
+ log.debug("_goObject: %s %s %s" % (direction, objectType, inputEvent))
+
+if __name__ == "__main__":
+ logging.basicConfig(format="%(name)s %(message)s")
+ log.setLevel(logging.DEBUG)
+
+ import orca.script
+ scrypt = orca.script.Script(None)
+ plugin = Plugin(scrypt, None)
+ print scrypt
+ print plugin
+
+ plugin.processObjectEvent(None)
+
+ plugin.activate()
+ try:
+ plugin.processObjectEvent(None)
+ except:
+ # Expected since no event was passed in
+ #
+ pass
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]