orca r4206 - branches/phase2/src/orca
- From: wwalker svn gnome org
- To: svn-commits-list gnome org
- Subject: orca r4206 - branches/phase2/src/orca
- Date: Sat, 13 Sep 2008 17:59:28 +0000 (UTC)
Author: wwalker
Date: Sat Sep 13 17:59:28 2008
New Revision: 4206
URL: http://svn.gnome.org/viewvc/orca?rev=4206&view=rev
Log:
Get input events working. Still need to set up the Orca modifier support, though.
Added:
branches/phase2/src/orca/default_bindings.py (contents, props changed)
Modified:
branches/phase2/src/orca/Makefile.am
branches/phase2/src/orca/braille.py
branches/phase2/src/orca/default.py
branches/phase2/src/orca/input_bindings.py
branches/phase2/src/orca/input_event.py
branches/phase2/src/orca/script.py
Modified: branches/phase2/src/orca/Makefile.am
==============================================================================
--- branches/phase2/src/orca/Makefile.am (original)
+++ branches/phase2/src/orca/Makefile.am Sat Sep 13 17:59:28 2008
@@ -10,6 +10,7 @@
braille_monitor.py \
braille.py \
default.py \
+ default_bindings.py \
input_bindings.py \
input_event.py \
orca_i18n.py \
Modified: branches/phase2/src/orca/braille.py
==============================================================================
--- branches/phase2/src/orca/braille.py (original)
+++ branches/phase2/src/orca/braille.py Sat Sep 13 17:59:28 2008
@@ -206,12 +206,9 @@
#
_brlAPI.ignoreKeys(brlapi.rangeType_all, [0])
- # Next, enable cursor routing keys.
- #
- keySet = [brlapi.KEY_TYPE_CMD | brlapi.KEY_CMD_ROUTE]
-
# Finally, enable the commands we care about.
#
+ keySet = []
for key in keys:
keySet.append(brlapi.KEY_TYPE_CMD | key)
_brlAPI.acceptKeys(brlapi.rangeType_command, keySet)
@@ -314,6 +311,8 @@
import gtk
init(_myCallback)
- setupKeyRanges([brlapi.KEY_CMD_FWINLT, brlapi.KEY_CMD_FWINRT])
+ setupKeyRanges([brlapi.KEY_CMD_ROUTE,
+ brlapi.KEY_CMD_FWINLT,
+ brlapi.KEY_CMD_FWINRT])
print "Press keys on the braille display. Press Ctrl+C to quit."
gtk.main()
Modified: branches/phase2/src/orca/default.py
==============================================================================
--- branches/phase2/src/orca/default.py (original)
+++ branches/phase2/src/orca/default.py Sat Sep 13 17:59:28 2008
@@ -27,8 +27,12 @@
import logging
log = logging.getLogger('orca.default')
+import default_bindings
+import input_bindings
import script
+from orca_i18n import _ # for gettext support
+
class Script(script.Script):
"""The default Script from which all other scripts should be
derived.
@@ -41,3 +45,1230 @@
- application: the application to create a script for.
"""
script.Script.__init__(self, application)
+
+ def _createObjectEventListeners(self):
+ """Sets up the AT-SPI event listeners for this script.
+ """
+ listeners = script.Script._createObjectEventListeners(self)
+ listeners.update({
+ "focus:": self._onFocus,
+ "object:active-descendant-changed": self._onActiveDescendantChanged,
+ #"keyboard:modifiers": self._noOp,
+ "mouse:button": self._onMouseButton,
+ "object:property-change:accessible-name": self._onNameChanged,
+ "object:text-caret-moved": self._onCaretMoved,
+ "object:text-changed:delete": self._onTextDeleted,
+ "object:text-changed:insert": self._onTextInserted,
+ "object:text-selection-changed": self._onTextSelectionChanged,
+ "object:selection-changed": self._onSelectionChanged,
+ "object:link-selected": self._onLinkSelected,
+ "object:state-changed:active": self._onStateChanged,
+ "object:state-changed:focused": self._onStateChanged,
+ "object:state-changed:showing": self._onStateChanged,
+ "object:state-changed:checked": self._onStateChanged,
+ "object:state-changed:indeterminate": self._onStateChanged,
+ "object:state-changed:expanded": self._onStateChanged,
+ "object:state-changed:selected": self._onStateChanged,
+ "object:property-change:accessible-value": self._onValueChanged,
+ "object:value-changed": self._onValueChanged,
+ "window:activate": self._onWindowActivated,
+ "window:deactivate": self._onWindowDeactivated,
+ })
+ return listeners
+
+ def _createInputEventHandlers(self):
+ """Defines InputEventHandler fields for this script that can be
+ called by the key and braille bindings.
+ """
+ handlers = script.Script._createInputEventHandlers(self)
+ handlers.update({
+ "leftClickReviewItemHandler" : input_bindings.Handler(
+ Script._leftClickReviewItem,
+ # Translators: the 'flat review' feature of Orca
+ # allows the blind user to explore the text in a
+ # window in a 2D fashion. That is, Orca treats all
+ # the text from all objects in a window (e.g.,
+ # buttons, labels, etc.) as a sequence of words in a
+ # sequence of lines. The flat review feature allows
+ # the user to explore this text by the {previous,next}
+ # {line,word,character}. A left click means to generate
+ # a left mouse button click on the current item.
+ #
+ _("Performs left click on current flat review item.")),
+
+ "rightClickReviewItemHandler" : input_bindings.Handler(
+ Script._rightClickReviewItem,
+ # Translators: the 'flat review' feature of Orca
+ # allows the blind user to explore the text in a
+ # window in a 2D fashion. That is, Orca treats all
+ # the text from all objects in a window (e.g.,
+ # buttons, labels, etc.) as a sequence of words in a
+ # sequence of lines. The flat review feature allows
+ # the user to explore this text by the {previous,next}
+ # {line,word,character}. A right click means to generate
+ # a right mouse button click on the current item.
+ #
+ _("Performs right click on current flat review item.")),
+
+ "sayAllHandler" : input_bindings.Handler(
+ Script._sayAll,
+ # Translators: the Orca "SayAll" command allows the
+ # user to press a key and have the entire document in
+ # a window be automatically spoken to the user. If
+ # the user presses any key during a SayAll operation,
+ # the speech will be interrupted and the cursor will
+ # be positioned at the point where the speech was
+ # interrupted.
+ #
+ _("Speaks entire document.")),
+
+ "whereAmIBasicHandler" : input_bindings.Handler(
+ Script._whereAmIBasic,
+ # Translators: the "Where am I" feature of Orca allows
+ # a user to press a key and then have information
+ # about their current context spoken and brailled to
+ # them. For example, the information may include the
+ # name of the current pushbutton with focus as well as
+ # its mnemonic.
+ #
+ _("Performs the basic where am I operation.")),
+
+ "whereAmIDetailedHandler" : input_bindings.Handler(
+ Script._whereAmIDetailed,
+ # Translators: the "Where am I" feature of Orca allows
+ # a user to press a key and then have information
+ # about their current context spoken and brailled to
+ # them. For example, the information may include the
+ # name of the current pushbutton with focus as well as
+ # its mnemonic.
+ #
+ _("Performs the detailed where am I operation.")),
+
+ "getTitleHandler" : input_bindings.Handler(
+ Script._getTitle,
+ # Translators: This command will cause the window's
+ # title to be spoken.
+ #
+ _("Speaks the title bar.")),
+
+ "getStatusBarHandler" : input_bindings.Handler(
+ Script._getStatusBar,
+ # Translators: This command will cause the window's
+ # status bar contents to be spoken.
+ #
+ _("Speaks the status bar.")),
+
+ "findHandler" : input_bindings.Handler(
+ Script._showFindGUI,
+ # Translators: the Orca "Find" dialog allows a user to
+ # search for text in a window and then move focus to
+ # that text. For example, they may want to find the
+ # "OK" button.
+ #
+ _("Opens the Orca Find dialog.")),
+
+ "findNextHandler" : input_bindings.Handler(
+ Script._findNext,
+ # Translators: the Orca "Find" dialog allows a user to
+ # search for text in a window and then move focus to
+ # that text. For example, they may want to find the
+ # "OK" button. This string is used for finding the
+ # next occurence of a string.
+ #
+ _("Searches for the next instance of a string.")),
+
+ "findPreviousHandler" : input_bindings.Handler(
+ Script._findPrevious,
+ # Translators: the Orca "Find" dialog allows a user to
+ # search for text in a window and then move focus to
+ # that text. For example, they may want to find the
+ # "OK" button. This string is used for finding the
+ # previous occurence of a string.
+ #
+ _("Searches for the previous instance of a string.")),
+
+ "showZonesHandler" : input_bindings.Handler(
+ Script._showZones,
+ # Translators: this is a debug message that Orca users
+ # will not normally see. It describes a debug routine that
+ # paints rectangles around the interesting (e.g., text)
+ # zones in the active window for the application that
+ # currently has focus.
+ #
+ _("Paints and prints the visible zones in the active window.")),
+
+ "toggleFlatReviewModeHandler" : input_bindings.Handler(
+ Script._toggleFlatReviewMode,
+ # Translators: the 'flat review' feature of Orca
+ # allows the blind user to explore the text in a
+ # window in a 2D fashion. That is, Orca treats all
+ # the text from all objects in a window (e.g.,
+ # buttons, labels, etc.) as a sequence of words in a
+ # sequence of lines. The flat review feature allows
+ # the user to explore this text by the {previous,next}
+ # {line,word,character}.
+ #
+ _("Enters and exits flat review mode.")),
+
+ "reviewPreviousLineHandler" : input_bindings.Handler(
+ Script._reviewPreviousLine,
+ # Translators: the 'flat review' feature of Orca
+ # allows the blind user to explore the text in a
+ # window in a 2D fashion. That is, Orca treats all
+ # the text from all objects in a window (e.g.,
+ # buttons, labels, etc.) as a sequence of words in a
+ # sequence of lines. The flat review feature allows
+ # the user to explore this text by the {previous,next}
+ # {line,word,character}.
+ #
+ _("Moves flat review to the beginning of the previous line.")),
+
+ "reviewHomeHandler" : input_bindings.Handler(
+ Script._reviewHome,
+ # Translators: the 'flat review' feature of Orca
+ # allows the blind user to explore the text in a
+ # window in a 2D fashion. That is, Orca treats all
+ # the text from all objects in a window (e.g.,
+ # buttons, labels, etc.) as a sequence of words in a
+ # sequence of lines. The flat review feature allows
+ # the user to explore this text by the {previous,next}
+ # {line,word,character}. The home position is the
+ # beginning of the content in the window.
+ #
+ _("Moves flat review to the home position.")),
+
+ "reviewCurrentLineHandler" : input_bindings.Handler(
+ Script._reviewCurrentLine,
+ # Translators: the 'flat review' feature of Orca
+ # allows the blind user to explore the text in a
+ # window in a 2D fashion. That is, Orca treats all
+ # the text from all objects in a window (e.g.,
+ # buttons, labels, etc.) as a sequence of words in a
+ # sequence of lines. The flat review feature allows
+ # the user to explore this text by the {previous,next}
+ # {line,word,character}. This particular command will
+ # cause Orca to speak the current line.
+ #
+ _("Speaks the current flat review line.")),
+
+ "reviewSpellCurrentLineHandler" : input_bindings.Handler(
+ Script._reviewSpellCurrentLine,
+ # Translators: the 'flat review' feature of Orca
+ # allows the blind user to explore the text in a
+ # window in a 2D fashion. That is, Orca treats all
+ # the text from all objects in a window (e.g.,
+ # buttons, labels, etc.) as a sequence of words in a
+ # sequence of lines. The flat review feature allows
+ # the user to explore this text by the {previous,next}
+ # {line,word,character}. This particular command will
+ # cause Orca to spell the current line.
+ #
+ _("Spells the current flat review line.")),
+
+ "reviewPhoneticCurrentLineHandler" : input_bindings.Handler(
+ Script._reviewPhoneticCurrentLine,
+ # Translators: the 'flat review' feature of Orca
+ # allows the blind user to explore the text in a
+ # window in a 2D fashion. That is, Orca treats all
+ # the text from all objects in a window (e.g.,
+ # buttons, labels, etc.) as a sequence of words in a
+ # sequence of lines. The flat review feature allows
+ # the user to explore this text by the {previous,next}
+ # {line,word,character}. This particular command will
+ # cause Orca to "phonetically spell" the current line,
+ # saying "Alpha" for "a", "Bravo" for "b" and so on.
+ #
+ _("Phonetically spells the current flat review line.")),
+
+ "reviewNextLineHandler" : input_bindings.Handler(
+ Script._reviewNextLine,
+ # Translators: the 'flat review' feature of Orca
+ # allows the blind user to explore the text in a
+ # window in a 2D fashion. That is, Orca treats all
+ # the text from all objects in a window (e.g.,
+ # buttons, labels, etc.) as a sequence of words in a
+ # sequence of lines. The flat review feature allows
+ # the user to explore this text by the {previous,next}
+ # {line,word,character}.
+ #
+ _("Moves flat review to the beginning of the next line.")),
+
+ "reviewEndHandler" : input_bindings.Handler(
+ Script._reviewEnd,
+ # Translators: the 'flat review' feature of Orca
+ # allows the blind user to explore the text in a
+ # window in a 2D fashion. That is, Orca treats all
+ # the text from all objects in a window (e.g.,
+ # buttons, labels, etc.) as a sequence of words in a
+ # sequence of lines. The flat review feature allows
+ # the user to explore this text by the {previous,next}
+ # {line,word,character}. The end position is the last
+ # bit of information in the window.
+ #
+ _("Moves flat review to the end position.")),
+
+ "reviewPreviousItemHandler" : input_bindings.Handler(
+ Script._reviewPreviousItem,
+ # Translators: the 'flat review' feature of Orca
+ # allows the blind user to explore the text in a
+ # window in a 2D fashion. That is, Orca treats all
+ # the text from all objects in a window (e.g.,
+ # buttons, labels, etc.) as a sequence of words in a
+ # sequence of lines. The flat review feature allows
+ # the user to explore this text by the {previous,next}
+ # {line,word,character}. Previous will go backwards
+ # in the window until you reach the top (i.e., it will
+ # wrap across lines if necessary).
+ #
+ _("Moves flat review to the previous item or word.")),
+
+ "reviewAboveHandler" : input_bindings.Handler(
+ Script._reviewAbove,
+ # Translators: the 'flat review' feature of Orca
+ # allows the blind user to explore the text in a
+ # window in a 2D fashion. That is, Orca treats all
+ # the text from all objects in a window (e.g.,
+ # buttons, labels, etc.) as a sequence of words in a
+ # sequence of lines. The flat review feature allows
+ # the user to explore this text by the {previous,next}
+ # {line,word,character}. Above in this case means
+ # geographically above, as if you drew a vertical line
+ # in the window.
+ #
+ _("Moves flat review to the word above the current word.")),
+
+ "reviewCurrentItemHandler" : input_bindings.Handler(
+ Script._reviewCurrentItem,
+ # Translators: the 'flat review' feature of Orca
+ # allows the blind user to explore the text in a
+ # window in a 2D fashion. That is, Orca treats all
+ # the text from all objects in a window (e.g.,
+ # buttons, labels, etc.) as a sequence of words in a
+ # sequence of lines. The flat review feature allows
+ # the user to explore this text by the {previous,next}
+ # {line,word,character}. This command will speak the
+ # current word or item.
+ #
+ _("Speaks the current flat review item or word.")),
+
+ "reviewSpellCurrentItemHandler" : input_bindings.Handler(
+ Script._reviewSpellCurrentItem,
+ # Translators: the 'flat review' feature of Orca
+ # allows the blind user to explore the text in a
+ # window in a 2D fashion. That is, Orca treats all
+ # the text from all objects in a window (e.g.,
+ # buttons, labels, etc.) as a sequence of words in a
+ # sequence of lines. The flat review feature allows
+ # the user to explore this text by the {previous,next}
+ # {line,word,character}. This command will spell out
+ # the current word or item letter by letter.
+ #
+ _("Spells the current flat review item or word.")),
+
+ "reviewPhoneticCurrentItemHandler" : input_bindings.Handler(
+ Script._reviewPhoneticCurrentItem,
+ # Translators: the 'flat review' feature of Orca
+ # allows the blind user to explore the text in a
+ # window in a 2D fashion. That is, Orca treats all
+ # the text from all objects in a window (e.g.,
+ # buttons, labels, etc.) as a sequence of words in a
+ # sequence of lines. The flat review feature allows
+ # the user to explore this text by the {previous,next}
+ # {line,word,character}. This command will spell out
+ # the current word or item phonetically, saying "Alpha"
+ # for "a", "Bravo" for "b" and so on.
+ #
+ _("Phonetically spells the current flat review item or " \
+ "word.")),
+
+ "reviewCurrentAccessibleHandler" : input_bindings.Handler(
+ Script._reviewCurrentAccessible,
+ # Translators: the 'flat review' feature of Orca
+ # allows the blind user to explore the text in a
+ # window in a 2D fashion. That is, Orca treats all
+ # the text from all objects in a window (e.g.,
+ # buttons, labels, etc.) as a sequence of words in a
+ # sequence of lines. The flat review feature allows
+ # the user to explore this text by the {previous,next}
+ # {line,word,character}. The flat review object is
+ # typically something like a pushbutton, a label, or
+ # some other GUI widget. The 'speaks' means it will
+ # speak the text associated with the object.
+ #
+ _("Speaks the current flat review object.")),
+
+ "reviewNextItemHandler" : input_bindings.Handler(
+ Script._reviewNextItem,
+ # Translators: the 'flat review' feature of Orca
+ # allows the blind user to explore the text in a
+ # window in a 2D fashion. That is, Orca treats all
+ # the text from all objects in a window (e.g.,
+ # buttons, labels, etc.) as a sequence of words in a
+ # sequence of lines. The flat review feature allows
+ # the user to explore this text by the {previous,next}
+ # {line,word,character}. Next will go forwards
+ # in the window until you reach the end (i.e., it will
+ # wrap across lines if necessary).
+ #
+ _("Moves flat review to the next item or word.")),
+
+ "reviewBelowHandler" : input_bindings.Handler(
+ Script._reviewBelow,
+ # Translators: the 'flat review' feature of Orca
+ # allows the blind user to explore the text in a
+ # window in a 2D fashion. That is, Orca treats all
+ # the text from all objects in a window (e.g.,
+ # buttons, labels, etc.) as a sequence of words in a
+ # sequence of lines. The flat review feature allows
+ # the user to explore this text by the {previous,next}
+ # {line,word,character}. Below in this case means
+ # geographically below, as if you drew a vertical line
+ # downward on the screen.
+ #
+ _("Moves flat review to the word below the current word.")),
+
+ "reviewPreviousCharacterHandler" : input_bindings.Handler(
+ Script._reviewPreviousCharacter,
+ # Translators: the 'flat review' feature of Orca
+ # allows the blind user to explore the text in a
+ # window in a 2D fashion. That is, Orca treats all
+ # the text from all objects in a window (e.g.,
+ # buttons, labels, etc.) as a sequence of words in a
+ # sequence of lines. The flat review feature allows
+ # the user to explore this text by the {previous,next}
+ # {line,word,character}. Previous will go backwards
+ # in the window until you reach the top (i.e., it will
+ # wrap across lines if necessary).
+ #
+ _("Moves flat review to the previous character.")),
+
+ "reviewEndOfLineHandler" : input_bindings.Handler(
+ Script._reviewEndOfLine,
+ # Translators: the 'flat review' feature of Orca
+ # allows the blind user to explore the text in a
+ # window in a 2D fashion. That is, Orca treats all
+ # the text from all objects in a window (e.g.,
+ # buttons, labels, etc.) as a sequence of words in a
+ # sequence of lines. The flat review feature allows
+ # the user to explore this text by the {previous,next}
+ # {line,word,character}.
+ #
+ _("Moves flat review to the end of the line.")),
+
+ "reviewCurrentCharacterHandler" : input_bindings.Handler(
+ Script._reviewCurrentCharacter,
+ # Translators: the 'flat review' feature of Orca
+ # allows the blind user to explore the text in a
+ # window in a 2D fashion. That is, Orca treats all
+ # the text from all objects in a window (e.g.,
+ # buttons, labels, etc.) as a sequence of words in a
+ # sequence of lines. The flat review feature allows
+ # the user to explore this text by the {previous,next}
+ # {line,word,character}. Previous will go backwards
+ # in the window until you reach the top (i.e., it will
+ # wrap across lines if necessary). The 'speaks' in
+ # this case will be the spoken language form of the
+ # character currently being reviewed.
+ #
+ _("Speaks the current flat review character.")),
+
+ "reviewSpellCurrentCharacterHandler" : input_bindings.Handler(
+ Script._reviewSpellCurrentCharacter,
+ # Translators: the 'flat review' feature of Orca
+ # allows the blind user to explore the text in a
+ # window in a 2D fashion. That is, Orca treats all
+ # the text from all objects in a window (e.g.,
+ # buttons, labels, etc.) as a sequence of words in a
+ # sequence of lines. The flat review feature allows
+ # the user to explore this text by the {previous,next}
+ # {line,word,character}. Previous will go backwards
+ # in the window until you reach the top (i.e., it will
+ # wrap across lines if necessary). This command will
+ # cause Orca to speak a phonetic representation of the
+ # character currently being reviewed, saying "Alpha"
+ # for "a", "Bravo" for "b" and so on.
+ #
+ _("Phonetically speaks the current flat review character.")),
+
+ "reviewNextCharacterHandler" : input_bindings.Handler(
+ Script._reviewNextCharacter,
+ # Translators: the 'flat review' feature of Orca
+ # allows the blind user to explore the text in a
+ # window in a 2D fashion. That is, Orca treats all
+ # the text from all objects in a window (e.g.,
+ # buttons, labels, etc.) as a sequence of words in a
+ # sequence of lines. The flat review feature allows
+ # the user to explore this text by the {previous,next}
+ # {line,word,character}. Next will go forwards
+ # in the window until you reach the end (i.e., it will
+ # wrap across lines if necessary).
+ #
+ _("Moves flat review to the next character.")),
+
+ "toggleTableCellReadModeHandler" : input_bindings.Handler(
+ Script._toggleTableCellReadMode,
+ # Translators: when users are navigating a table, they
+ # sometimes want the entire row of a table read, or
+ # they just want the current cell to be presented to them.
+ #
+ _("Toggles whether to read just the current table cell " \
+ "or the whole row.")),
+
+ "readCharAttributesHandler" : input_bindings.Handler(
+ Script._readCharAttributes,
+ # Translators: the attributes being presented are the
+ # text attributes, such as bold, italic, font name,
+ # font size, etc.
+ #
+ _("Reads the attributes associated with the current text " \
+ "character.")),
+
+ "reportScriptInfoHandler" : input_bindings.Handler(
+ Script._reportScriptInfo,
+ # Translators: this is a debug message that Orca users
+ # will not normally see. It describes a debug routine
+ # that outputs useful information on the current script
+ # via speech and braille. This information will be
+ # helpful to script writers.
+ #
+ _("Reports information on current script.")),
+
+ "panBrailleLeftHandler" : input_bindings.Handler(
+ Script._panBrailleLeft,
+ # Translators: a refreshable braille display is an
+ # external hardware device that presents braille
+ # character to the user. There are a limited number
+ # of cells on the display (typically 40 cells). Orca
+ # provides the feature to build up a longer logical
+ # line and allow the user to press buttons on the
+ # braille display so they can pan left and right over
+ # this line.
+ #
+ _("Pans the braille display to the left."),
+ False), # Do not enable learn mode for this action
+
+ "panBrailleRightHandler" : input_bindings.Handler(
+ Script._panBrailleRight,
+ # Translators: a refreshable braille display is an
+ # external hardware device that presents braille
+ # character to the user. There are a limited number
+ # of cells on the display (typically 40 cells). Orca
+ # provides the feature to build up a longer logical
+ # line and allow the user to press buttons on the
+ # braille display so they can pan left and right over
+ # this line.
+ #
+ _("Pans the braille display to the right."),
+ False), # Do not enable learn mode for this action
+
+ "reviewBottomLeftHandler" : input_bindings.Handler(
+ Script._reviewBottomLeft,
+ # Translators: the 'flat review' feature of Orca
+ # allows the blind user to explore the text in a
+ # window in a 2D fashion. That is, Orca treats all
+ # the text from all objects in a window (e.g.,
+ # buttons, labels, etc.) as a sequence of words in a
+ # sequence of lines. The flat review feature allows
+ # the user to explore this text by the {previous,next}
+ # {line,word,character}. The bottom left is the bottom
+ # left of the window currently being reviewed.
+ #
+ _("Moves flat review to the bottom left.")),
+
+ "goBrailleHomeHandler" : input_bindings.Handler(
+ Script._goBrailleHome,
+ # Translators: the 'flat review' feature of Orca
+ # allows the blind user to explore the text in a
+ # window in a 2D fashion. That is, Orca treats all
+ # the text from all objects in a window (e.g.,
+ # buttons, labels, etc.) as a sequence of words in a
+ # sequence of lines. The flat review feature allows
+ # the user to explore this text by the {previous,next}
+ # {line,word,character}. Flat review is modal, and
+ # the user can be exploring the window without changing
+ # which object in the window which has focus. The
+ # feature used here will return the flat review to the
+ # object with focus.
+ #
+ _("Returns to object with keyboard focus.")),
+
+ "enterLearnModeHandler" : input_bindings.Handler(
+ Script._enterLearnMode,
+ # Translators: Orca has a "Learn Mode" that will allow
+ # the user to type any key on the keyboard and hear what
+ # the effects of that key would be. The effects might
+ # be what Orca would do if it had a handler for the
+ # particular key combination, or they might just be to
+ # echo the name of the key if Orca doesn't have a handler.
+ #
+ _("Enters learn mode. Press escape to exit learn mode.")),
+
+ "decreaseSpeechRateHandler" : input_bindings.Handler(
+ Script._decreaseSpeechRate,
+ # Translators: the speech rate is how fast the speech
+ # synthesis engine will generate speech.
+ #
+ _("Decreases the speech rate.")),
+
+ "increaseSpeechRateHandler" : input_bindings.Handler(
+ Script._increaseSpeechRate,
+ # Translators: the speech rate is how fast the speech
+ # synthesis engine will generate speech.
+ #
+ _("Increases the speech rate.")),
+
+ "decreaseSpeechPitchHandler" : input_bindings.Handler(
+ Script._decreaseSpeechPitch,
+ # Translators: the speech pitch is how high or low in
+ # pitch/frequency the speech synthesis engine will
+ # generate speech.
+ #
+ _("Decreases the speech pitch.")),
+
+ "increaseSpeechPitchHandler" : input_bindings.Handler(
+ Script._increaseSpeechPitch,
+ # Translators: the speech pitch is how high or low in
+ # pitch/frequency the speech synthesis engine will
+ # generate speech.
+ #
+ _("Increases the speech pitch.")),
+
+ "quitOrcaHandler" : input_bindings.Handler(
+ Script._quitOrca,
+ _("Quits Orca")),
+
+ "preferencesSettingsHandler" : input_bindings.Handler(
+ Script._showPreferencesGUI,
+ # Translators: the preferences configuration dialog is
+ # the dialog that allows users to set their preferences
+ # for Orca.
+ #
+ _("Displays the preferences configuration dialog.")),
+
+ "appPreferencesSettingsHandler" : input_bindings.Handler(
+ Script._showAppPreferencesGUI,
+ # Translators: the application preferences configuration
+ # dialog is the dialog that allows users to set their
+ # preferences for a specific application within Orca.
+ #
+ _("Displays the application preferences configuration " \
+ "dialog.")),
+
+ "toggleSilenceSpeechHandler" : input_bindings.Handler(
+ Script._toggleSilenceSpeech,
+ # Translators: Orca allows the user to turn speech synthesis
+ # on or off. We call it 'silencing'.
+ #
+ _("Toggles the silencing of speech.")),
+
+ "listAppsHandler" : input_bindings.Handler(
+ Script._printAppsHandler,
+ # Translators: this is a debug message that Orca users
+ # will not normally see. It describes a debug routine
+ # that prints a list of all known applications currently
+ # running on the desktop, to stdout.
+ #
+ _("Prints a debug listing of all known applications to the " \
+ "console where Orca is running.")),
+
+ "printActiveAppHandler" : input_bindings.Handler(
+ Script._printActiveAppHandler,
+ # Translators: this is a debug message that Orca users
+ # will not normally see. It describes a debug routine
+ # that prints useful debugging information to the console,
+ # for the application that is currently running (has focus).
+ #
+ _("Prints debug information about the currently active " \
+ "application to the console where Orca is running.")),
+
+ "printAncestryHandler" : input_bindings.Handler(
+ Script._printAncestryHandler,
+ # Translators: this is a debug message that Orca users
+ # will not normally see. It describes a debug routine
+ # that will take the component in the currently running
+ # application that has focus, and print debug information
+ # to the console giving its component ancestry (i.e. all
+ # the components that are its descendants in the component
+ # tree).
+ #
+ _("Prints debug information about the ancestry of the " \
+ "object with focus.")),
+
+ "printHierarchyHandler" : input_bindings.Handler(
+ Script._printHierarchyHandler,
+ # Translators: this is a debug message that Orca users
+ # will not normally see. It describes a debug routine
+ # that will take the currently running application, and
+ # print debug information to the console giving its
+ # component hierarchy (i.e. all the components and all
+ # their descendants in the component tree).
+ #
+ _("Prints debug information about the application with " \
+ "focus.")),
+
+ "printMemoryUsageHandler" : input_bindings.Handler(
+ Script._printMemoryUsageHandler,
+ # Translators: this is a debug message that Orca users
+ # will not normally see. It describes a debug routine
+ # that will print Orca memory usage information.
+ #
+ _("Prints memory usage information.")),
+
+ "bookmarkCurrentWhereAmI" : input_bindings.Handler(
+ Script._bookmarkCurrentWhereAmI,
+ # Translators: this command announces information regarding
+ # the relationship of the given bookmark to the current
+ # position
+ #
+ _("Bookmark where am I with respect to current position.")),
+
+ "goToBookmark" : input_bindings.Handler(
+ Script._goToBookmark,
+ # Translators: this command moves the current position to the
+ # location stored at the bookmark.
+ #
+ _("Go to bookmark.")),
+
+ "addBookmark" : input_bindings.Handler(
+ Script._addBookmark,
+ # Translators: this event handler binds an in-page accessible
+ # object location to the given input key command.
+ #
+ _("Add bookmark.")),
+
+ "saveBookmarks" : input_bindings.Handler(
+ Script._saveBookmarks,
+ # Translators: this event handler saves all bookmarks for the
+ # current application to disk.
+ #
+ _("Save bookmarks.")),
+
+ "goToNextBookmark" : input_bindings.Handler(
+ Script._goToNextBookmark,
+ # Translators: this event handler cycles through the registered
+ # bookmarks and takes the user to the next bookmark location.
+ #
+ _("Go to next bookmark location.")),
+
+ "goToPrevBookmark" : input_bindings.Handler(
+ Script._goToPrevBookmark,
+ # Translators: this event handler cycles through the
+ # registered bookmarks and takes the user to the previous
+ # bookmark location.
+ #
+ _("Go to previous bookmark location.")),
+
+ "toggleColorEnhancementsHandler" : input_bindings.Handler(
+ Script._toggleColorEnhancements,
+ # Translators: "color enhancements" are changes users can
+ # make to the appearance of the screen to make things easier
+ # to see, such as inverting the colors or applying a tint.
+ # This command toggles these enhancements on/off.
+ #
+ _("Toggles color enhancements.")),
+
+ "toggleMouseEnhancementsHandler" : input_bindings.Handler(
+ Script._toggleMouseEnhancements,
+ # Translators: "mouse enhancements" are changes users can
+ # make to the appearance of the mouse pointer to make it
+ # easier to see, such as increasing its size, changing its
+ # color, and surrounding it with crosshairs. This command
+ # toggles these enhancements on/off.
+ #
+ _("Toggles mouse enhancements.")),
+
+ "increaseMagnificationHandler" : input_bindings.Handler(
+ Script._increaseMagnification,
+ # Translators: this command increases the magnification
+ # level.
+ #
+ _("Increases the magnification level.")),
+
+ "decreaseMagnificationHandler" : input_bindings.Handler(
+ Script._decreaseMagnification,
+ # Translators: this command decreases the magnification
+ # level.
+ #
+ _("Decreases the magnification level.")),
+
+ "toggleMagnifierHandler" : input_bindings.Handler(
+ Script._toggleMagnifier,
+ # Translators: Orca allows the user to turn the magnifier
+ # on or off. This command not only toggles magnification,
+ # but also all of the color and pointer customizations
+ # made through the magnifier.
+ #
+ _("Toggles the magnifier.")),
+
+ "cycleZoomerTypeHandler" : input_bindings.Handler(
+ Script._cycleZoomerType,
+ # Translators: the user can choose between several different
+ # types of magnification, including full screen and split
+ # screen. The "position" here refers to location of the
+ # magnifier.
+ #
+ _("Cycles to the next magnifier position.")),
+
+ # TODO: Add mouse review back in.
+ #"toggleMouseReviewHandler" : input_bindings.Handler(
+ # mouse_review.toggle,
+ # # Translators: Orca allows the item under the pointer to
+ # # be spoken. This toggles the feature.
+ # #
+ # _("Toggle mouse review mode.")),
+
+ "bypassNextCommandHandler" : input_bindings.Handler(
+ Script._bypassNextCommand,
+ # Translators: Orca normally intercepts all keyboard
+ # commands and only passes them along to the current
+ # application when they are not Orca commands. This
+ # command causes the next command issued to be passed
+ # along to the current application, bypassing Orca's
+ # interception of it.
+ #
+ _("Passes the next command on to the current application.")),
+ })
+ return handlers
+
+ def _createKeyBindings(self, handlers):
+ """Defines the key bindings for this script.
+
+ Returns an instance of input_bindings.KeyBindings.
+ """
+ bindings = script.Script._createKeyBindings(self, handlers)
+ # TODO: make this a decision between desktop and laptop layout
+ if True:
+ bindings.extend(default_bindings.desktopKeys)
+ else:
+ bindings.extend(default_bindings.laptopKeys)
+ return bindings
+
+ def _createBrailleBindings(self, handlers):
+ """Defines the braille bindings for this script.
+
+ Returns an instance of input_bindings.BrailleBindings.
+ """
+ bindings = script.Script._createBrailleBindings(self, handlers)
+ bindings.extend(default_bindings.brailleKeys)
+ return bindings
+
+ ####################################################################
+ # #
+ # AT-SPI Event Handlers #
+ # #
+ ####################################################################
+
+ def _onFocus(self, event):
+ """Called on AT-SPI focus events.
+ """
+ log.debug("_onFocus: %s" % event)
+
+ def _onActiveDescendantChanged(self, event):
+ """Called on AT-SPI object:active-descendant-changed events.
+ """
+ log.debug("_onActiveDescendantChanged: %s" % event)
+
+ def _onMouseButton(self, event):
+ """Called on AT-SPI mouse:button events.
+ """
+ log.debug("_onMouseButton: %s" % event)
+
+ def _onNameChanged(self, event):
+ """Called on AT-SPI object:property-change:accessible-name events.
+ """
+ log.debug("_onNameChanged: %s" % event)
+
+ def _onCaretMoved(self, event):
+ """Called on AT-SPI object:text-caret-moved events.
+ """
+ log.debug("_onCaretMoved: %s" % event)
+
+ def _onTextDeleted(self, event):
+ """Called on AT-SPI object:text-changed:delete events.
+ """
+ log.debug("_onTextDeleted: %s" % event)
+
+ def _onTextInserted(self, event):
+ """Called on AT-SPI object:text-changed:insert events.
+ """
+ log.debug("_onTextInserted: %s" % event)
+
+ def _onTextSelectionChanged(self, event):
+ """Called on AT-SPI object:text-selection-changed events.
+ """
+ log.debug("_onTextSelectionChanged: %s" % event)
+
+ def _onSelectionChanged(self, event):
+ """Called on AT-SPI object:selection-changed events.
+ """
+ log.debug("_onSelectionChanged: %s" % event)
+
+ def _onLinkSelected(self, event):
+ """Called on AT-SPI object:link-selected events.
+ """
+ log.debug("_onLinkSelected: %s" % event)
+
+ def _onStateChanged(self, event):
+ """Called on AT-SPI object:state-changed events.
+ """
+ log.debug("_onStateChanged: %s" % event)
+
+ def _onValueChanged(self, event):
+ """Called on AT-SPI object:value-changed and
+ object:property-change:accessible-value events.
+ """
+ log.debug("_onValueChanged: %s" % event)
+
+ def _onWindowActivated(self, event):
+ """Called on AT-SPI window:activate events.
+ """
+ log.debug("_onWindowActivated: %s" % event)
+
+ def _onWindowDeactivated(self, event):
+ """Called on AT-SPI window:deactivate events.
+ """
+ log.debug("_onWindowDeactivated: %s" % event)
+
+ def _noOp(self, event):
+ """Just here to capture events.
+ """
+ log.debug("_noOp: %s" % event)
+
+ ####################################################################
+ # #
+ # INPUT EVENT HANDLERS #
+ # #
+ ####################################################################
+
+ def _leftClickReviewItem(self, inputEvent=None, modifiers=None):
+ """The leftClickReviewItem handler.
+ """
+ log.debug("_leftClickReviewItem: %s" % inputEvent)
+
+ def _rightClickReviewItem(self, inputEvent=None, modifiers=None):
+ """The rightClickReviewItem handler.
+ """
+ log.debug("_rightClickReviewItem: %s" % inputEvent)
+
+ def _sayAll(self, inputEvent=None, modifiers=None):
+ """The sayAll handler.
+ """
+ log.debug("_sayAll: %s" % inputEvent)
+
+ def _whereAmIBasic(self, inputEvent=None, modifiers=None):
+ """The whereAmIBasic handler.
+ """
+ log.debug("_whereAmIBasic: %s" % inputEvent)
+
+ def _whereAmIDetailed(self, inputEvent=None, modifiers=None):
+ """The whereAmIDetailed handler.
+ """
+ log.debug("_whereAmIDetailed: %s" % inputEvent)
+
+ def _getTitle(self, inputEvent=None, modifiers=None):
+ """The getTitle handler.
+ """
+ log.debug("_getTitle: %s" % inputEvent)
+
+ def _getStatusBar(self, inputEvent=None, modifiers=None):
+ """The getStatusBar handler.
+ """
+ log.debug("_getStatusBar: %s" % inputEvent)
+
+ def _showFindGUI(self, inputEvent=None, modifiers=None):
+ """The showFindGUI handler.
+ """
+ log.debug("_showFindGUI: %s" % inputEvent)
+
+ def _findNext(self, inputEvent=None, modifiers=None):
+ """The findNext handler.
+ """
+ log.debug("_findNext: %s" % inputEvent)
+
+ def _findPrevious(self, inputEvent=None, modifiers=None):
+ """The findPrevious handler.
+ """
+ log.debug("_findPrevious: %s" % inputEvent)
+
+ def _showZones(self, inputEvent=None, modifiers=None):
+ """The showZones handler.
+ """
+ log.debug("_showZones: %s" % inputEvent)
+
+ def _toggleFlatReviewMode(self, inputEvent=None, modifiers=None):
+ """The toggleFlatReviewMode handler.
+ """
+ log.debug("_toggleFlatReviewMode: %s" % inputEvent)
+
+ def _reviewPreviousLine(self, inputEvent=None, modifiers=None):
+ """The reviewPreviousLine handler.
+ """
+ log.debug("_reviewPreviousLine: %s" % inputEvent)
+
+ def _reviewHome(self, inputEvent=None, modifiers=None):
+ """The reviewHome handler.
+ """
+ log.debug("_reviewHome: %s" % inputEvent)
+
+ def _reviewCurrentLine(self, inputEvent=None, modifiers=None):
+ """The reviewCurrentLine handler.
+ """
+ log.debug("_reviewCurrentLine: %s" % inputEvent)
+
+ def _reviewSpellCurrentLine(self, inputEvent=None, modifiers=None):
+ """The reviewSpellCurrentLine handler.
+ """
+ log.debug("_reviewSpellCurrentLine: %s" % inputEvent)
+
+ def _reviewPhoneticCurrentLine(self, inputEvent=None, modifiers=None):
+ """The reviewPhoneticCurrentLine handler.
+ """
+ log.debug("_reviewPhoneticCurrentLine: %s" % inputEvent)
+
+ def _reviewNextLine(self, inputEvent=None, modifiers=None):
+ """The reviewNextLine handler.
+ """
+ log.debug("_reviewNextLine: %s" % inputEvent)
+
+ def _reviewEnd(self, inputEvent=None, modifiers=None):
+ """The reviewEnd handler.
+ """
+ log.debug("_reviewEnd: %s" % inputEvent)
+
+ def _reviewPreviousItem(self, inputEvent=None, modifiers=None):
+ """The reviewPreviousItem handler.
+ """
+ log.debug("_reviewPreviousItem: %s" % inputEvent)
+
+ def _reviewAbove(self, inputEvent=None, modifiers=None):
+ """The reviewAbove handler.
+ """
+ log.debug("_reviewAbove: %s" % inputEvent)
+
+ def _reviewCurrentItem(self, inputEvent=None, modifiers=None):
+ """The reviewCurrentItem handler.
+ """
+ log.debug("_reviewCurrentItem: %s" % inputEvent)
+
+ def _reviewSpellCurrentItem(self, inputEvent=None, modifiers=None):
+ """The reviewSpellCurrentItem handler.
+ """
+ log.debug("_reviewSpellCurrentItem: %s" % inputEvent)
+
+ def _reviewPhoneticCurrentItem(self, inputEvent=None, modifiers=None):
+ """The reviewPhoneticCurrentItem handler.
+ """
+ log.debug("_reviewPhoneticCurrentItem: %s" % inputEvent)
+
+ def _reviewCurrentAccessible(self, inputEvent=None, modifiers=None):
+ """The reviewCurrentAccessible handler.
+ """
+ log.debug("_reviewCurrentAccessible: %s" % inputEvent)
+
+ def _reviewNextItem(self, inputEvent=None, modifiers=None):
+ """The reviewNextItem handler.
+ """
+ log.debug("_reviewNextItem: %s" % inputEvent)
+
+ def _reviewBelow(self, inputEvent=None, modifiers=None):
+ """The reviewBelow handler.
+ """
+ log.debug("_reviewBelow: %s" % inputEvent)
+
+ def _reviewPreviousCharacter(self, inputEvent=None, modifiers=None):
+ """The reviewPreviousCharacter handler.
+ """
+ log.debug("_reviewPreviousCharacter: %s" % inputEvent)
+
+ def _reviewEndOfLine(self, inputEvent=None, modifiers=None):
+ """The reviewEndOfLine handler.
+ """
+ log.debug("_reviewEndOfLine: %s" % inputEvent)
+
+ def _reviewCurrentCharacter(self, inputEvent=None, modifiers=None):
+ """The reviewCurrentCharacter handler.
+ """
+ log.debug("_reviewCurrentCharacter: %s" % inputEvent)
+
+ def _reviewSpellCurrentCharacter(self, inputEvent=None, modifiers=None):
+ """The reviewSpellCurrentCharacter handler.
+ """
+ log.debug("_reviewSpellCurrentCharacter: %s" % inputEvent)
+
+ def _reviewNextCharacter(self, inputEvent=None, modifiers=None):
+ """The reviewNextCharacter handler.
+ """
+ log.debug("_reviewNextCharacter: %s" % inputEvent)
+
+ def _toggleTableCellReadMode(self, inputEvent=None, modifiers=None):
+ """The toggleTableCellReadMode handler.
+ """
+ log.debug("_toggleTableCellReadMode: %s" % inputEvent)
+
+ def _readCharAttributes(self, inputEvent=None, modifiers=None):
+ """The readCharAttributes handler.
+ """
+ log.debug("_readCharAttributes: %s" % inputEvent)
+
+ def _reportScriptInfo(self, inputEvent=None, modifiers=None):
+ """The reportScriptInfo handler.
+ """
+ log.debug("_reportScriptInfo: %s" % inputEvent)
+
+ def _panBrailleLeft(self, inputEvent=None, modifiers=None):
+ """The panBrailleLeft handler.
+ """
+ log.debug("_panBrailleLeft: %s" % inputEvent)
+
+ def _panBrailleRight(self, inputEvent=None, modifiers=None):
+ """The panBrailleRight handler.
+ """
+ log.debug("_panBrailleRight: %s" % inputEvent)
+
+ def _reviewBottomLeft(self, inputEvent=None, modifiers=None):
+ """The reviewBottomLeft handler.
+ """
+ log.debug("_reviewBottomLeft: %s" % inputEvent)
+
+ def _goBrailleHome(self, inputEvent=None, modifiers=None):
+ """The goBrailleHome handler.
+ """
+ log.debug("_goBrailleHome: %s" % inputEvent)
+
+ def _enterLearnMode(self, inputEvent=None, modifiers=None):
+ """The enterLearnMode handler.
+ """
+ log.debug("_enterLearnMode: %s" % inputEvent)
+
+ def _decreaseSpeechRate(self, inputEvent=None, modifiers=None):
+ """The decreaseSpeechRate handler.
+ """
+ log.debug("_decreaseSpeechRate: %s" % inputEvent)
+
+ def _increaseSpeechRate(self, inputEvent=None, modifiers=None):
+ """The increaseSpeechRate handler.
+ """
+ log.debug("_increaseSpeechRate: %s" % inputEvent)
+
+ def _decreaseSpeechPitch(self, inputEvent=None, modifiers=None):
+ """The decreaseSpeechPitch handler.
+ """
+ log.debug("_decreaseSpeechPitch: %s" % inputEvent)
+
+ def _increaseSpeechPitch(self, inputEvent=None, modifiers=None):
+ """The increaseSpeechPitch handler.
+ """
+ log.debug("_increaseSpeechPitch: %s" % inputEvent)
+
+ def _quitOrca(self, inputEvent=None, modifiers=None):
+ """The quitOrca handler.
+ """
+ log.debug("_quitOrca: %s" % inputEvent)
+
+ def _showPreferencesGUI(self, inputEvent=None, modifiers=None):
+ """The showPreferencesGUI handler.
+ """
+ log.debug("_showPreferencesGUI: %s" % inputEvent)
+
+ def _showAppPreferencesGUI(self, inputEvent=None, modifiers=None):
+ """The showAppPreferencesGUI handler.
+ """
+ log.debug("_showAppPreferencesGUI: %s" % inputEvent)
+
+ def _toggleSilenceSpeech(self, inputEvent=None, modifiers=None):
+ """The toggleSilenceSpeech handler.
+ """
+ log.debug("_toggleSilenceSpeech: %s" % inputEvent)
+
+ def _printAppsHandler(self, inputEvent=None, modifiers=None):
+ """The printAppsHandler handler.
+ """
+ log.debug("_printAppsHandler: %s" % inputEvent)
+
+ def _printActiveAppHandler(self, inputEvent=None, modifiers=None):
+ """The printActiveAppHandler handler.
+ """
+ log.debug("_printActiveAppHandler: %s" % inputEvent)
+
+ def _printAncestryHandler(self, inputEvent=None, modifiers=None):
+ """The printAncestryHandler handler.
+ """
+ log.debug("_printAncestryHandler: %s" % inputEvent)
+
+ def _printHierarchyHandler(self, inputEvent=None, modifiers=None):
+ """The printHierarchyHandler handler.
+ """
+ log.debug("_printHierarchyHandler: %s" % inputEvent)
+
+ def _printMemoryUsageHandler(self, inputEvent=None, modifiers=None):
+ """The printMemoryUsageHandler handler.
+ """
+ log.debug("_printMemoryUsageHandler: %s" % inputEvent)
+
+ def _bookmarkCurrentWhereAmI(self, inputEvent=None, modifiers=None):
+ """The bookmarkCurrentWhereAmI handler.
+ """
+ log.debug("_bookmarkCurrentWhereAmI: %s" % inputEvent)
+
+ def _goToBookmark(self, inputEvent=None, modifiers=None):
+ """The goToBookmark handler.
+ """
+ log.debug("_goToBookmark: %s" % inputEvent)
+
+ def _addBookmark(self, inputEvent=None, modifiers=None):
+ """The addBookmark handler.
+ """
+ log.debug("_addBookmark: %s" % inputEvent)
+
+ def _saveBookmarks(self, inputEvent=None, modifiers=None):
+ """The saveBookmarks handler.
+ """
+ log.debug("_saveBookmarks: %s" % inputEvent)
+
+ def _goToNextBookmark(self, inputEvent=None, modifiers=None):
+ """The goToNextBookmark handler.
+ """
+ log.debug("_goToNextBookmark: %s" % inputEvent)
+
+ def _goToPrevBookmark(self, inputEvent=None, modifiers=None):
+ """The goToPrevBookmark handler.
+ """
+ log.debug("_goToPrevBookmark: %s" % inputEvent)
+
+ def _toggleColorEnhancements(self, inputEvent=None, modifiers=None):
+ """The toggleColorEnhancements handler.
+ """
+ log.debug("_toggleColorEnhancements: %s" % inputEvent)
+
+ def _toggleMouseEnhancements(self, inputEvent=None, modifiers=None):
+ """The toggleMouseEnhancements handler.
+ """
+ log.debug("_toggleMouseEnhancements: %s" % inputEvent)
+
+ def _increaseMagnification(self, inputEvent=None, modifiers=None):
+ """The increaseMagnification handler.
+ """
+ log.debug("_increaseMagnification: %s" % inputEvent)
+
+ def _decreaseMagnification(self, inputEvent=None, modifiers=None):
+ """The decreaseMagnification handler.
+ """
+ log.debug("_decreaseMagnification: %s" % inputEvent)
+
+ def _toggleMagnifier(self, inputEvent=None, modifiers=None):
+ """The toggleMagnifier handler.
+ """
+ log.debug("_toggleMagnifier: %s" % inputEvent)
+
+ def _cycleZoomerType(self, inputEvent=None, modifiers=None):
+ """The cycleZoomerType handler.
+ """
+ log.debug("_cycleZoomerType: %s" % inputEvent)
+
+ def _bypassNextCommand(self, inputEvent=None, modifiers=None):
+ """The bypassNextCommand handler.
+ """
+ log.debug("_bypassNextCommand: %s" % inputEvent)
+
+if __name__ == "__main__":
+ print Script(None)
Added: branches/phase2/src/orca/default_bindings.py
==============================================================================
--- (empty file)
+++ branches/phase2/src/orca/default_bindings.py Sat Sep 13 17:59:28 2008
@@ -0,0 +1,828 @@
+# Copyright 2004-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.
+
+"""Default keyboard and braille bindings."""
+
+__id__ = "$Id$"
+__copyright__ = "Copyright (c) 2005-2008 Sun Microsystems Inc."
+__license__ = "LGPL"
+
+import input_bindings
+import input_event
+
+# General function keys common to laptop and desktop
+#
+generalKeys = [
+ input_bindings.KeyBinding(
+ "F11",
+ input_event.defaultModifierMask,
+ input_event.ORCA_MODIFIER_MASK,
+ "toggleTableCellReadModeHandler"),
+
+ input_bindings.KeyBinding(
+ "SunF36",
+ input_event.defaultModifierMask,
+ input_event.ORCA_MODIFIER_MASK,
+ "toggleTableCellReadModeHandler"),
+
+ input_bindings.KeyBinding(
+ "f",
+ input_event.defaultModifierMask,
+ input_event.ORCA_MODIFIER_MASK,
+ "readCharAttributesHandler"),
+
+ input_bindings.KeyBinding(
+ "h",
+ input_event.defaultModifierMask,
+ input_event.ORCA_MODIFIER_MASK,
+ "enterLearnModeHandler"),
+
+ input_bindings.KeyBinding(
+ "q",
+ input_event.defaultModifierMask,
+ input_event.ORCA_MODIFIER_MASK,
+ "quitOrcaHandler"),
+
+ input_bindings.KeyBinding(
+ "space",
+ input_event.defaultModifierMask,
+ input_event.ORCA_MODIFIER_MASK,
+ "preferencesSettingsHandler"),
+
+ input_bindings.KeyBinding(
+ "space",
+ input_event.defaultModifierMask,
+ input_event.ORCA_CTRL_MODIFIER_MASK,
+ "appPreferencesSettingsHandler"),
+
+ input_bindings.KeyBinding(
+ "s",
+ input_event.defaultModifierMask,
+ input_event.ORCA_MODIFIER_MASK,
+ "toggleSilenceSpeechHandler"),
+
+ input_bindings.KeyBinding(
+ "BackSpace",
+ input_event.defaultModifierMask,
+ input_event.ORCA_MODIFIER_MASK,
+ "bypassNextCommandHandler"),
+]
+
+# Bookmarking keys
+#
+bookmarkKeys = [
+ input_bindings.KeyBinding(
+ "b",
+ input_event.defaultModifierMask,
+ input_event.ORCA_ALT_MODIFIER_MASK,
+ "saveBookmarks"),
+
+ input_bindings.KeyBinding(
+ "b",
+ input_event.defaultModifierMask,
+ input_event.ORCA_SHIFT_MODIFIER_MASK,
+ "goToPrevBookmark"),
+
+ input_bindings.KeyBinding(
+ "b",
+ input_event.defaultModifierMask,
+ input_event.ORCA_MODIFIER_MASK,
+ "goToNextBookmark"),
+]
+for key in xrange(1, 7):
+ bookmarkKeys.append(
+ input_bindings.KeyBinding(
+ str(key),
+ input_event.defaultModifierMask,
+ input_event.ORCA_ALT_MODIFIER_MASK,
+ "addBookmark"))
+ bookmarkKeys.append(
+ input_bindings.KeyBinding(
+ str(key),
+ input_event.defaultModifierMask,
+ input_event.ORCA_MODIFIER_MASK,
+ "goToBookmark"))
+ bookmarkKeys.append(
+ input_bindings.KeyBinding(
+ str(key),
+ input_event.defaultModifierMask,
+ input_event.SHIFT_ALT_MODIFIER_MASK,
+ "bookmarkCurrentWhereAmI"))
+
+# Debugging keys
+#
+debugKeys = [
+ input_bindings.KeyBinding(
+ "End",
+ input_event.defaultModifierMask,
+ input_event.ORCA_CTRL_ALT_MODIFIER_MASK,
+ "listAppsHandler"),
+
+ input_bindings.KeyBinding(
+ "Home",
+ input_event.defaultModifierMask,
+ input_event.ORCA_CTRL_ALT_MODIFIER_MASK,
+ "reportScriptInfoHandler"),
+
+ input_bindings.KeyBinding(
+ "Page_Up",
+ input_event.defaultModifierMask,
+ input_event.ORCA_CTRL_ALT_MODIFIER_MASK,
+ "printAncestryHandler"),
+
+ input_bindings.KeyBinding(
+ "Page_Down",
+ input_event.defaultModifierMask,
+ input_event.ORCA_CTRL_ALT_MODIFIER_MASK,
+ "printHierarchyHandler"),
+
+ input_bindings.KeyBinding(
+ "Num_Lock",
+ input_event.defaultModifierMask,
+ input_event.ORCA_MODIFIER_MASK,
+ "showZonesHandler"),
+]
+
+# Unbound keys
+#
+unboundKeys = [
+ input_bindings.KeyBinding(
+ "",
+ input_event.defaultModifierMask,
+ input_event.NO_MODIFIER_MASK,
+ "reportScriptInfoHandler"),
+
+ input_bindings.KeyBinding(
+ "",
+ input_event.defaultModifierMask,
+ input_event.NO_MODIFIER_MASK,
+ "cycleDebugLevelHandler"),
+
+ input_bindings.KeyBinding(
+ "",
+ input_event.defaultModifierMask,
+ input_event.NO_MODIFIER_MASK,
+ "decreaseSpeechRateHandler"),
+
+ input_bindings.KeyBinding(
+ "",
+ input_event.defaultModifierMask,
+ input_event.NO_MODIFIER_MASK,
+ "increaseSpeechRateHandler"),
+
+ input_bindings.KeyBinding(
+ "",
+ input_event.defaultModifierMask,
+ input_event.NO_MODIFIER_MASK,
+ "decreaseSpeechPitchHandler"),
+
+ input_bindings.KeyBinding(
+ "",
+ input_event.defaultModifierMask,
+ input_event.NO_MODIFIER_MASK,
+ "increaseSpeechPitchHandler"),
+
+ input_bindings.KeyBinding(
+ "",
+ input_event.defaultModifierMask,
+ input_event.NO_MODIFIER_MASK,
+ "toggleColorEnhancementsHandler"),
+
+ input_bindings.KeyBinding(
+ "",
+ input_event.defaultModifierMask,
+ input_event.NO_MODIFIER_MASK,
+ "toggleMouseEnhancementsHandler"),
+
+ input_bindings.KeyBinding(
+ "",
+ input_event.defaultModifierMask,
+ input_event.NO_MODIFIER_MASK,
+ "increaseMagnificationHandler"),
+
+ input_bindings.KeyBinding(
+ "",
+ input_event.defaultModifierMask,
+ input_event.NO_MODIFIER_MASK,
+ "decreaseMagnificationHandler"),
+
+ input_bindings.KeyBinding(
+ "",
+ input_event.defaultModifierMask,
+ input_event.NO_MODIFIER_MASK,
+ "toggleMagnifierHandler"),
+
+ input_bindings.KeyBinding(
+ "",
+ input_event.defaultModifierMask,
+ input_event.NO_MODIFIER_MASK,
+ "cycleZoomerTypeHandler"),
+
+ input_bindings.KeyBinding(
+ "",
+ input_event.defaultModifierMask,
+ input_event.NO_MODIFIER_MASK,
+ "panBrailleLeftHandler"),
+
+ input_bindings.KeyBinding(
+ "",
+ input_event.defaultModifierMask,
+ input_event.NO_MODIFIER_MASK,
+ "panBrailleRightHandler"),
+
+ input_bindings.KeyBinding(
+ "",
+ input_event.defaultModifierMask,
+ input_event.NO_MODIFIER_MASK,
+ "toggleMouseReviewHandler"),
+]
+
+# Desktop flat review keys
+#
+desktopFlatReviewKeys = [
+ input_bindings.KeyBinding(
+ "KP_Divide",
+ input_event.NO_MODIFIER_MASK,
+ input_event.NO_MODIFIER_MASK,
+ "leftClickReviewItemHandler"),
+
+ input_bindings.KeyBinding(
+ "KP_Multiply",
+ input_event.NO_MODIFIER_MASK,
+ input_event.NO_MODIFIER_MASK,
+ "rightClickReviewItemHandler"),
+
+ input_bindings.KeyBinding(
+ "KP_Subtract",
+ input_event.defaultModifierMask,
+ input_event.NO_MODIFIER_MASK,
+ "toggleFlatReviewModeHandler"),
+
+ input_bindings.KeyBinding(
+ "KP_7",
+ input_event.defaultModifierMask,
+ input_event.NO_MODIFIER_MASK,
+ "reviewPreviousLineHandler"),
+
+ input_bindings.KeyBinding(
+ "KP_Home",
+ input_event.defaultModifierMask,
+ input_event.NO_MODIFIER_MASK,
+ "reviewPreviousLineHandler"),
+
+ input_bindings.KeyBinding(
+ "KP_7",
+ input_event.defaultModifierMask,
+ input_event.ORCA_MODIFIER_MASK,
+ "reviewHomeHandler"),
+
+ input_bindings.KeyBinding(
+ "KP_Home",
+ input_event.defaultModifierMask,
+ input_event.ORCA_MODIFIER_MASK,
+ "reviewHomeHandler"),
+
+ input_bindings.KeyBinding(
+ "KP_8",
+ input_event.defaultModifierMask,
+ input_event.NO_MODIFIER_MASK,
+ "reviewCurrentLineHandler", 1),
+
+ input_bindings.KeyBinding(
+ "KP_8",
+ input_event.defaultModifierMask,
+ input_event.NO_MODIFIER_MASK,
+ "reviewSpellCurrentLineHandler", 2),
+
+ input_bindings.KeyBinding(
+ "KP_8",
+ input_event.defaultModifierMask,
+ input_event.NO_MODIFIER_MASK,
+ "reviewPhoneticCurrentLineHandler", 3),
+
+ input_bindings.KeyBinding(
+ "KP_Up",
+ input_event.defaultModifierMask,
+ input_event.NO_MODIFIER_MASK,
+ "reviewCurrentLineHandler", 1),
+
+ input_bindings.KeyBinding(
+ "KP_Up",
+ input_event.defaultModifierMask,
+ input_event.NO_MODIFIER_MASK,
+ "reviewSpellCurrentLineHandler", 2),
+
+ input_bindings.KeyBinding(
+ "KP_Up",
+ input_event.defaultModifierMask,
+ input_event.NO_MODIFIER_MASK,
+ "reviewPhoneticCurrentLineHandler", 3),
+
+ input_bindings.KeyBinding(
+ "KP_9",
+ input_event.defaultModifierMask,
+ input_event.NO_MODIFIER_MASK,
+ "reviewNextLineHandler"),
+
+ input_bindings.KeyBinding(
+ "KP_Page_Up",
+ input_event.defaultModifierMask,
+ input_event.NO_MODIFIER_MASK,
+ "reviewNextLineHandler"),
+
+ input_bindings.KeyBinding(
+ "KP_9",
+ input_event.defaultModifierMask,
+ input_event.ORCA_MODIFIER_MASK,
+ "reviewEndHandler"),
+
+ input_bindings.KeyBinding(
+ "KP_Page_Up",
+ input_event.defaultModifierMask,
+ input_event.ORCA_MODIFIER_MASK,
+ "reviewEndHandler"),
+
+ input_bindings.KeyBinding(
+ "KP_4",
+ input_event.defaultModifierMask,
+ input_event.NO_MODIFIER_MASK,
+ "reviewPreviousItemHandler"),
+
+ input_bindings.KeyBinding(
+ "KP_Left",
+ input_event.defaultModifierMask,
+ input_event.NO_MODIFIER_MASK,
+ "reviewPreviousItemHandler"),
+
+ input_bindings.KeyBinding(
+ "KP_4",
+ input_event.defaultModifierMask,
+ input_event.ORCA_MODIFIER_MASK,
+ "reviewAboveHandler"),
+
+ input_bindings.KeyBinding(
+ "KP_Left",
+ input_event.defaultModifierMask,
+ input_event.ORCA_MODIFIER_MASK,
+ "reviewAboveHandler"),
+
+ input_bindings.KeyBinding(
+ "KP_5",
+ input_event.defaultModifierMask,
+ input_event.NO_MODIFIER_MASK,
+ "reviewCurrentItemHandler", 1),
+
+ input_bindings.KeyBinding(
+ "KP_5",
+ input_event.defaultModifierMask,
+ input_event.NO_MODIFIER_MASK,
+ "reviewSpellCurrentItemHandler", 2),
+
+ input_bindings.KeyBinding(
+ "KP_5",
+ input_event.defaultModifierMask,
+ input_event.NO_MODIFIER_MASK,
+ "reviewPhoneticCurrentItemHandler", 3),
+
+ input_bindings.KeyBinding(
+ "KP_Begin",
+ input_event.defaultModifierMask,
+ input_event.NO_MODIFIER_MASK,
+ "reviewCurrentItemHandler", 1),
+
+ input_bindings.KeyBinding(
+ "KP_Begin",
+ input_event.defaultModifierMask,
+ input_event.NO_MODIFIER_MASK,
+ "reviewSpellCurrentItemHandler", 2),
+
+ input_bindings.KeyBinding(
+ "KP_Begin",
+ input_event.defaultModifierMask,
+ input_event.NO_MODIFIER_MASK,
+ "reviewPhoneticCurrentItemHandler", 3),
+
+ input_bindings.KeyBinding(
+ "KP_5",
+ input_event.defaultModifierMask,
+ input_event.ORCA_MODIFIER_MASK,
+ "reviewCurrentAccessibleHandler"),
+
+ input_bindings.KeyBinding(
+ "KP_Begin",
+ input_event.defaultModifierMask,
+ input_event.ORCA_MODIFIER_MASK,
+ "reviewCurrentAccessibleHandler"),
+
+ input_bindings.KeyBinding(
+ "KP_6",
+ input_event.defaultModifierMask,
+ input_event.NO_MODIFIER_MASK,
+ "reviewNextItemHandler"),
+
+ input_bindings.KeyBinding(
+ "KP_Right",
+ input_event.defaultModifierMask,
+ input_event.NO_MODIFIER_MASK,
+ "reviewNextItemHandler"),
+
+ input_bindings.KeyBinding(
+ "KP_6",
+ input_event.defaultModifierMask,
+ input_event.ORCA_MODIFIER_MASK,
+ "reviewBelowHandler"),
+
+ input_bindings.KeyBinding(
+ "KP_Right",
+ input_event.defaultModifierMask,
+ input_event.ORCA_MODIFIER_MASK,
+ "reviewBelowHandler"),
+
+ input_bindings.KeyBinding(
+ "KP_1",
+ input_event.defaultModifierMask,
+ input_event.NO_MODIFIER_MASK,
+ "reviewPreviousCharacterHandler"),
+
+ input_bindings.KeyBinding(
+ "KP_End",
+ input_event.defaultModifierMask,
+ input_event.NO_MODIFIER_MASK,
+ "reviewPreviousCharacterHandler"),
+
+ input_bindings.KeyBinding(
+ "KP_1",
+ input_event.defaultModifierMask,
+ input_event.ORCA_MODIFIER_MASK,
+ "reviewEndOfLineHandler"),
+
+ input_bindings.KeyBinding(
+ "KP_End",
+ input_event.defaultModifierMask,
+ input_event.ORCA_MODIFIER_MASK,
+ "reviewEndOfLineHandler"),
+
+ input_bindings.KeyBinding(
+ "KP_2",
+ input_event.defaultModifierMask,
+ input_event.NO_MODIFIER_MASK,
+ "reviewCurrentCharacterHandler", 1),
+
+ input_bindings.KeyBinding(
+ "KP_2",
+ input_event.defaultModifierMask,
+ input_event.NO_MODIFIER_MASK,
+ "reviewSpellCurrentCharacterHandler", 2),
+
+ input_bindings.KeyBinding(
+ "KP_Down",
+ input_event.defaultModifierMask,
+ input_event.NO_MODIFIER_MASK,
+ "reviewCurrentCharacterHandler", 1),
+
+ input_bindings.KeyBinding(
+ "KP_Down",
+ input_event.defaultModifierMask,
+ input_event.NO_MODIFIER_MASK,
+ "reviewSpellCurrentCharacterHandler", 2),
+
+ input_bindings.KeyBinding(
+ "KP_3",
+ input_event.defaultModifierMask,
+ input_event.NO_MODIFIER_MASK,
+ "reviewNextCharacterHandler"),
+
+ input_bindings.KeyBinding(
+ "KP_Page_Down",
+ input_event.defaultModifierMask,
+ input_event.NO_MODIFIER_MASK,
+ "reviewNextCharacterHandler"),
+
+ input_bindings.KeyBinding(
+ "KP_Delete",
+ input_event.defaultModifierMask,
+ input_event.NO_MODIFIER_MASK,
+ "findHandler"),
+
+ input_bindings.KeyBinding(
+ "KP_Delete",
+ input_event.defaultModifierMask,
+ input_event.ORCA_MODIFIER_MASK,
+ "findNextHandler"),
+
+ input_bindings.KeyBinding(
+ "KP_Delete",
+ input_event.defaultModifierMask,
+ input_event.ORCA_SHIFT_MODIFIER_MASK,
+ "findPreviousHandler"),
+]
+
+# Desktop where am I keys (and SayAll)
+#
+desktopWhereAmIKeys = [
+ input_bindings.KeyBinding(
+ "KP_Enter",
+ input_event.defaultModifierMask,
+ input_event.NO_MODIFIER_MASK,
+ "whereAmIBasicHandler", 1),
+
+ input_bindings.KeyBinding(
+ "KP_Enter",
+ input_event.defaultModifierMask,
+ input_event.NO_MODIFIER_MASK,
+ "whereAmIDetailedHandler", 2),
+
+ input_bindings.KeyBinding(
+ "KP_Enter",
+ input_event.defaultModifierMask,
+ input_event.ORCA_MODIFIER_MASK,
+ "getTitleHandler", 1),
+
+ input_bindings.KeyBinding(
+ "KP_Enter",
+ input_event.defaultModifierMask,
+ input_event.ORCA_MODIFIER_MASK,
+ "getStatusBarHandler", 2),
+
+ input_bindings.KeyBinding(
+ "KP_Add",
+ input_event.defaultModifierMask,
+ input_event.NO_MODIFIER_MASK,
+ "sayAllHandler"),
+]
+
+# Laptop flat review keys
+#
+laptopFlatReviewKeys = [
+ input_bindings.KeyBinding(
+ "7",
+ input_event.ORCA_MODIFIER_MASK,
+ input_event.ORCA_MODIFIER_MASK,
+ "leftClickReviewItemHandler"),
+
+ input_bindings.KeyBinding(
+ "8",
+ input_event.ORCA_MODIFIER_MASK,
+ input_event.ORCA_MODIFIER_MASK,
+ "rightClickReviewItemHandler"),
+
+ input_bindings.KeyBinding(
+ "p",
+ input_event.defaultModifierMask,
+ input_event.ORCA_MODIFIER_MASK,
+ "toggleFlatReviewModeHandler"),
+
+ input_bindings.KeyBinding(
+ "u",
+ input_event.defaultModifierMask,
+ input_event.ORCA_MODIFIER_MASK,
+ "reviewPreviousLineHandler"),
+
+ input_bindings.KeyBinding(
+ "u",
+ input_event.defaultModifierMask,
+ input_event.ORCA_CTRL_MODIFIER_MASK,
+ "reviewHomeHandler"),
+
+ input_bindings.KeyBinding(
+ "i",
+ input_event.defaultModifierMask,
+ input_event.ORCA_MODIFIER_MASK,
+ "reviewCurrentLineHandler", 1),
+
+ input_bindings.KeyBinding(
+ "i",
+ input_event.defaultModifierMask,
+ input_event.ORCA_MODIFIER_MASK,
+ "reviewSpellCurrentLineHandler", 2),
+
+ input_bindings.KeyBinding(
+ "i",
+ input_event.defaultModifierMask,
+ input_event.ORCA_MODIFIER_MASK,
+ "reviewPhoneticCurrentLineHandler", 3),
+
+ input_bindings.KeyBinding(
+ "o",
+ input_event.defaultModifierMask,
+ input_event.ORCA_MODIFIER_MASK,
+ "reviewNextLineHandler"),
+
+ input_bindings.KeyBinding(
+ "o",
+ input_event.defaultModifierMask,
+ input_event.ORCA_CTRL_MODIFIER_MASK,
+ "reviewEndHandler"),
+
+ input_bindings.KeyBinding(
+ "j",
+ input_event.defaultModifierMask,
+ input_event.ORCA_MODIFIER_MASK,
+ "reviewPreviousItemHandler"),
+
+ input_bindings.KeyBinding(
+ "j",
+ input_event.defaultModifierMask,
+ input_event.ORCA_CTRL_MODIFIER_MASK,
+ "reviewAboveHandler"),
+
+ input_bindings.KeyBinding(
+ "k",
+ input_event.defaultModifierMask,
+ input_event.ORCA_MODIFIER_MASK,
+ "reviewCurrentItemHandler", 1),
+
+ input_bindings.KeyBinding(
+ "k",
+ input_event.defaultModifierMask,
+ input_event.ORCA_MODIFIER_MASK,
+ "reviewSpellCurrentItemHandler", 2),
+
+ input_bindings.KeyBinding(
+ "k",
+ input_event.defaultModifierMask,
+ input_event.ORCA_MODIFIER_MASK,
+ "reviewPhoneticCurrentItemHandler", 3),
+
+ input_bindings.KeyBinding(
+ "k",
+ input_event.defaultModifierMask,
+ input_event.ORCA_CTRL_MODIFIER_MASK,
+ "reviewCurrentAccessibleHandler"),
+
+ input_bindings.KeyBinding(
+ "l",
+ input_event.defaultModifierMask,
+ input_event.ORCA_MODIFIER_MASK,
+ "reviewNextItemHandler"),
+
+ input_bindings.KeyBinding(
+ "l",
+ input_event.defaultModifierMask,
+ input_event.ORCA_CTRL_MODIFIER_MASK,
+ "reviewBelowHandler"),
+
+ input_bindings.KeyBinding(
+ "m",
+ input_event.defaultModifierMask,
+ input_event.ORCA_MODIFIER_MASK,
+ "reviewPreviousCharacterHandler"),
+
+ input_bindings.KeyBinding(
+ "m",
+ input_event.defaultModifierMask,
+ input_event.ORCA_CTRL_MODIFIER_MASK,
+ "reviewEndOfLineHandler"),
+
+ input_bindings.KeyBinding(
+ "comma",
+ input_event.defaultModifierMask,
+ input_event.ORCA_MODIFIER_MASK,
+ "reviewCurrentCharacterHandler", 1),
+
+ input_bindings.KeyBinding(
+ "comma",
+ input_event.defaultModifierMask,
+ input_event.ORCA_MODIFIER_MASK,
+ "reviewSpellCurrentCharacterHandler", 2),
+
+ input_bindings.KeyBinding(
+ "period",
+ input_event.defaultModifierMask,
+ input_event.ORCA_MODIFIER_MASK,
+ "reviewNextCharacterHandler"),
+
+ input_bindings.KeyBinding(
+ "bracketleft",
+ input_event.defaultModifierMask,
+ input_event.ORCA_MODIFIER_MASK,
+ "findHandler"),
+
+ input_bindings.KeyBinding(
+ "bracketright",
+ input_event.defaultModifierMask,
+ input_event.ORCA_MODIFIER_MASK,
+ "findNextHandler"),
+
+ input_bindings.KeyBinding(
+ "bracketright",
+ input_event.defaultModifierMask,
+ input_event.ORCA_CTRL_MODIFIER_MASK,
+ "findPreviousHandler"),
+]
+
+# Laptop where am I keys (and SayAll)
+#
+laptopWhereAmIKeys = [
+ input_bindings.KeyBinding(
+ "Return",
+ input_event.defaultModifierMask,
+ input_event.ORCA_MODIFIER_MASK,
+ "whereAmIBasicHandler", 1),
+
+ input_bindings.KeyBinding(
+ "Return",
+ input_event.defaultModifierMask,
+ input_event.ORCA_MODIFIER_MASK,
+ "whereAmIDetailedHandler", 2),
+
+ input_bindings.KeyBinding(
+ "slash",
+ input_event.defaultModifierMask,
+ input_event.ORCA_MODIFIER_MASK,
+ "getTitleHandler", 1),
+
+ input_bindings.KeyBinding(
+ "slash",
+ input_event.defaultModifierMask,
+ input_event.ORCA_MODIFIER_MASK,
+ "getStatusBarHandler", 2),
+
+ input_bindings.KeyBinding(
+ "semicolon",
+ input_event.defaultModifierMask,
+ input_event.ORCA_MODIFIER_MASK,
+ "sayAllHandler"),
+]
+
+commonKeys = generalKeys + bookmarkKeys + debugKeys + unboundKeys
+desktopKeys = commonKeys + desktopFlatReviewKeys + desktopWhereAmIKeys
+laptopKeys = commonKeys + laptopFlatReviewKeys + laptopWhereAmIKeys
+
+import brlapi
+brailleKeys = [
+ input_bindings.BrailleBinding(
+ brlapi.KEY_CMD_ROUTE,
+ input_event.NO_MODIFIER_MASK,
+ input_event.NO_MODIFIER_MASK,
+ "brailleCursorKeyHandler"),
+
+ input_bindings.BrailleBinding(
+ brlapi.KEY_CMD_FWINLT,
+ input_event.NO_MODIFIER_MASK,
+ input_event.NO_MODIFIER_MASK,
+ "panBrailleLeftHandler"),
+
+ input_bindings.BrailleBinding(
+ brlapi.KEY_CMD_FWINRT,
+ input_event.NO_MODIFIER_MASK,
+ input_event.NO_MODIFIER_MASK,
+ "panBrailleRightHandler"),
+
+ input_bindings.BrailleBinding(
+ brlapi.KEY_CMD_LNUP,
+ input_event.NO_MODIFIER_MASK,
+ input_event.NO_MODIFIER_MASK,
+ "reviewAboveHandler"),
+
+ input_bindings.BrailleBinding(
+ brlapi.KEY_CMD_LNDN,
+ input_event.NO_MODIFIER_MASK,
+ input_event.NO_MODIFIER_MASK,
+ "reviewBelowHandler"),
+
+ input_bindings.BrailleBinding(
+ brlapi.KEY_CMD_TOP_LEFT,
+ input_event.NO_MODIFIER_MASK,
+ input_event.NO_MODIFIER_MASK,
+ "reviewHomeHandler"),
+
+ input_bindings.BrailleBinding(
+ brlapi.KEY_CMD_BOT_LEFT,
+ input_event.NO_MODIFIER_MASK,
+ input_event.NO_MODIFIER_MASK,
+ "reviewBottomLeftHandler"),
+
+ input_bindings.BrailleBinding(
+ brlapi.KEY_CMD_HOME,
+ input_event.NO_MODIFIER_MASK,
+ input_event.NO_MODIFIER_MASK,
+ "goBrailleHomeHandler"),
+]
+
+if __name__ == "__main__":
+ print "DESKTOP KEYS:"
+ for key in desktopKeys:
+ print key
+
+ print "LAPTOP KEYS:"
+ for key in laptopKeys:
+ print key
+
+ print "BRAILLE KEYS:"
+ for key in brailleKeys:
+ print key
Modified: branches/phase2/src/orca/input_bindings.py
==============================================================================
--- branches/phase2/src/orca/input_bindings.py (original)
+++ branches/phase2/src/orca/input_bindings.py Sat Sep 13 17:59:28 2008
@@ -207,7 +207,7 @@
command,
modifierMask,
modifiers,
- handler,
+ handlerName,
clickCount = 1):
"""Creates a new input binding.
@@ -224,23 +224,23 @@
- modifiers: the state the modifiers we care about must be in for
this key binding to match an input event (see also
pyatspi.MODIFIER_*)
- - handler: the Handler for this key binding
+ - handlerName: the name the handler for this key binding
- clickCount: how many times the command should be pressed in a row
"""
self.command = command
self.modifierMask = modifierMask
self.modifiers = modifiers
- self.handler = handler
+ self.handlerName = handlerName
self.clickCount = clickCount
self._commandCode = None
def __str__(self):
- return "[%x %x %s %d %s]" % \
- (self.modifierMask,
+ return "[cmd=%s modMask=%x mods=%x handler='%s' clickCount=%d]" % \
+ (self.command,
+ self.modifierMask,
self.modifiers,
- self.command,
- self.clickCount,
- self.handler.description)
+ self.handlerName,
+ self.clickCount)
def _getCommandCode(self):
"""Converts the command into a command code. For example,
@@ -262,10 +262,11 @@
return False
class Bindings(list):
- """Structure that maintains a set of Binding instances.
+ """Structure that maintains a list of Binding instances.
"""
- def __init__(self):
+ def __init__(self, handlers):
list.__init__(self)
+ self._handlers = handlers
def __str__(self):
result = "[\n"
@@ -279,7 +280,7 @@
"""
i = len(self)
while i > 0:
- if self[i - 1].handler == handler:
+ if self._handlers[self[i - 1].handlerName] == handler:
del self[i - 1]
i = i - 1
@@ -289,7 +290,7 @@
The typeOfSearch can be:
"strict": matches description, modifiers, key, and
click count
- "description": matches only description.
+ "name" : matches only name.
"command": matches the modifiers, command, and modifier mask,
and click count
"commandNoMask": matches the modifiers, command, and click count
@@ -298,8 +299,8 @@
for myBinding in self:
if typeOfSearch == "strict":
- if (binding.handler.description \
- == myBinding.handler.description) \
+ if (binding.handlerName \
+ == myBinding.handlerName) \
and (binding.command \
== myBinding.command) \
and (binding.modifierMask \
@@ -309,9 +310,9 @@
and (binding.clickCount \
== myBinding.clickCount):
hasIt = True
- elif typeOfSearch == "description":
- if binding.handler.description \
- == myBinding.handler.description:
+ elif typeOfSearch == "name":
+ if binding.handlerName \
+ == myBinding.handlerName:
hasIt = True
elif typeOfSearch == "command":
if (binding.command \
@@ -343,7 +344,7 @@
if binding.matches(commandCode, modifiers):
if binding.modifierMask == modifiers \
and binding.clickCount == clickCount:
- return binding.handler
+ return self._handlers[binding.handlerName]
candidates.append(binding)
# If we're still here, we don't have an exact match. Prefer
@@ -354,7 +355,7 @@
reverse=True)
for candidate in candidates:
if candidate.clickCount <= clickCount:
- return candidate.handler
+ return self._handlers[candidate.handlerName]
return None
@@ -420,10 +421,10 @@
return self._commandCode
class KeyBindings(Bindings):
- """Structure that maintains a set of KeyBinding instances.
+ """Structure that maintains a list of KeyBinding instances.
"""
- def __init__(self):
- Bindings.__init__(self)
+ def __init__(self, handlers):
+ Bindings.__init__(self, handlers)
def processInputEvent(self, script, keyboardEvent, modifiers):
"""Processes the given input event. Returns True if a handler
@@ -472,10 +473,10 @@
clickCount)
class BrailleBindings(Bindings):
- """Structure that maintains a set of BrailleBinding instances.
+ """Structure that maintains a list of BrailleBinding instances.
"""
- def __init__(self):
- Bindings.__init__(self)
+ def __init__(self, handlers):
+ Bindings.__init__(self, handlers)
def processInputEvent(self, script, brailleEvent, modifiers):
"""Processes the given input event. Returns True if a handler
@@ -497,13 +498,17 @@
print getKeycode("Insert")
print "Keyboard tests:\n"
- bindings = KeyBindings()
+ myhandlers = {}
+ bindings = KeyBindings(myhandlers)
handler1 = Handler(None, "Does something")
+ myhandlers["handler1"] = handler1
print handler1
- binding1 = KeyBinding("Insert", 0x1ff, 0, handler1, 2)
+ binding1 = KeyBinding("Insert", 0x1ff, 0, "handler1", 2)
bindings.append(binding1)
+
handler2 = Handler(None, "Does something else")
- binding2 = KeyBinding("Return", 0x1ff, 0, handler2, 2)
+ myhandlers["handler2"] = handler2
+ binding2 = KeyBinding("Return", 0x1ff, 0, "handler2", 2)
bindings.append(binding2)
print "All bindings:"
print bindings
@@ -523,13 +528,10 @@
print "\n\nBraille tests:\n"
import brlapi
- bindings = BrailleBindings()
- handler1 = Handler(None, "Does something")
- print handler1
- binding1 = BrailleBinding(brlapi.KEY_CMD_ROUTE, 0x1ff, 0, handler1, 2)
+ bindings = BrailleBindings(myhandlers)
+ binding1 = BrailleBinding(brlapi.KEY_CMD_ROUTE, 0x1ff, 0, "handler1", 2)
bindings.append(binding1)
- handler2 = Handler(None, "Does something else")
- binding2 = BrailleBinding(brlapi.KEY_CMD_FWINRT, 0x1ff, 0, handler2, 2)
+ binding2 = BrailleBinding(brlapi.KEY_CMD_FWINRT, 0x1ff, 0, "handler2", 2)
bindings.append(binding2)
print "All bindings:"
print bindings
Modified: branches/phase2/src/orca/input_event.py
==============================================================================
--- branches/phase2/src/orca/input_event.py (original)
+++ branches/phase2/src/orca/input_event.py Sat Sep 13 17:59:28 2008
@@ -80,7 +80,7 @@
# conflicts with other commands, such as Orca's command for moving
# among headings (H) and the Help menu (Alt+H).
#
-DEFAULT_MODIFIER_MASK = NON_LOCKING_MODIFIER_MASK
+defaultModifierMask = NON_LOCKING_MODIFIER_MASK
def getModifierNames(mods):
"""Gets the modifier names of a numeric modifier mask as a human
Modified: branches/phase2/src/orca/script.py
==============================================================================
--- branches/phase2/src/orca/script.py (original)
+++ branches/phase2/src/orca/script.py Sat Sep 13 17:59:28 2008
@@ -23,7 +23,6 @@
# TODO: Add tutorial support
# TODO: Add structural navigation support
# TODO: Add flat review support
-# TODO: Add click count
# TODO: Add hook to override key bindings
# TODO: Add hook to override braille bindings
# TODO: Add hook to override pronunciations
@@ -59,18 +58,18 @@
class Script:
"""The specific focus tracking scripts for applications.
"""
- def __init__(self, app):
+ def __init__(self, application):
"""Creates a script for the given application, if necessary.
This method should not be called by anyone except the
focus_tracking_presenter.
Arguments:
- - app: the Python Accessible application to create a script for
+ - application: the Python Accessible application to create a script for
"""
- self._app = app
+ self._application = application
- if app:
- self._name = self._app.name
+ if application:
+ self._name = self._application.name
else:
self._name = "default"
@@ -81,12 +80,14 @@
self._objectEventListeners = self._createObjectEventListeners()
self._inputEventHandlers = self._createInputEventHandlers()
- self._keyBindings = self._createKeyBindings()
- self._brailleBindings = self._createBrailleBindings()
+ self._keyBindings = \
+ self._createKeyBindings(self._inputEventHandlers)
+ self._brailleBindings = \
+ self._createBrailleBindings(self._inputEventHandlers)
self._focus = None
self._pointOfReference = {}
-
+
log.debug("NEW SCRIPT: %s" % self)
def __str__(self):
@@ -111,19 +112,28 @@
"""
return {}
- def _createKeyBindings(self):
+ def getInputEventHandlerKey(self, inputEventHandler):
+ """Returns the name of the key that contains an inputEventHadler
+ passed as argument
+ """
+ for keyName, handler in self._inputEventHandlers.iteritems():
+ if handler == inputEventHandler:
+ return keyName
+ return None
+
+ def _createKeyBindings(self, handlers):
"""Defines the key bindings for this script.
Returns an instance of input_bindings.KeyBindings.
"""
- return input_bindings.KeyBindings()
+ return input_bindings.KeyBindings(handlers)
- def _createBrailleBindings(self):
+ def _createBrailleBindings(self, handlers):
"""Defines the braille bindings for this script.
Returns an instance of input_bindings.BrailleBindings
"""
- return input_bindings.BrailleBindings()
+ return input_bindings.BrailleBindings(handlers)
def _getPronunciations(self):
"""Defines the application specific pronunciations for this script.
@@ -133,6 +143,11 @@
"""
return {}
+ def getClickCount(self):
+ """Returns the click count of the last input event."""
+ # TODO: implement click count
+ return 1
+
def consumesKeyboardEvent(self, keyboardEvent):
"""Called when a key is pressed on the keyboard. If we care
about it, our processKeyboardEvent method will get called a
@@ -143,30 +158,53 @@
Returns True if the event is of interest.
"""
- # TODO: implement consumesKeyboardEvent
# TODO: add support for user-settings.py keyBindingsMap
- return False
+ # TODO: add in structural navigation model
+ consumes = False
+ if not consumes:
+ handler = self._keyBindings.getHandler(
+ keyboardEvent.hw_code,
+ keyboardEvent.modifiers,
+ self.getClickCount())
+ consumes = handler != None
+ return consumes
def processKeyboardEvent(self, keyboardEvent):
- """Called whenever a key is pressed on the Braille display
+ """Called whenever a key is pressed on the keyboard
and we have an interest in it.
"""
- # TODO: implement processKeyboardEvent
+ # TODO: add support for user-settings.py keyBindingsMap
log.debug("processKeyboardEvent %s" % keyboardEvent)
+ # We'll annotate the event with a reference to this script.
+ # This will allow external scripts to muck with the script
+ # instance if they wish.
+ #
+ keyboardEvent.script = self
+ self._keyBindings.processInputEvent(
+ self,
+ keyboardEvent,
+ keyboardEvent.modifiers)
+
def consumesBrailleEvent(self, brailleEvent):
"""Called when a key is pressed on the braille display. If we
care about it, our processBrailleEvent method will get called a
bit later.
Arguments:
- - brailleEvent: an instance of input_event.KeyboardEvent
+ - brailleEvent: an instance of input_event.BrailleEvent
Returns True if the event is of interest.
"""
- # TODO: implement consumesBrailleEvent
- # TODO: add support for user-settings.py keyBindingsMap
- return False
+ # TODO: add support for user-settings.py brailleBindingsMap
+ consumes = False
+ if not consumes:
+ handler = self._brailleBindings.getHandler(
+ brailleEvent["command"],
+ None, # TODO: add current keyboard modifiers
+ self.getClickCount())
+ consumes = handler != None
+ return consumes
def processBrailleEvent(self, brailleEvent):
"""Called whenever a key is pressed on the Braille display
@@ -175,9 +213,19 @@
Arguments:
- brailleEvent: an instance of input_event.BrailleEvent
"""
- # TODO: implement processBrailleEvent
+ # TODO: add support for user-settings.py brailleBindingsMap
log.debug("processBrailleEvent %s" % brailleEvent)
+ # We'll annotate the event with a reference to this script.
+ # This will allow external scripts to muck with the script
+ # instance if they wish.
+ #
+ brailleEvent.script = self
+ self._brailleBindings.processInputEvent(
+ self,
+ brailleEvent,
+ None) # TODO: add current keyboard modifiers
+
def processObjectEvent(self, event):
"""Processes all AT-SPI object events of interest to this
script.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]