orca.J2SE-access-bridge (version 1543, $Date: 2007-03-12 16:23:35 -0400 (Mon, 12 Mar 2007) $)
index
/usr/lib/python2.5/site-packages/orca/J2SE-access-bridge.py

# Orca
#
# Copyright 2006 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., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.

 
Modules
       
Accessibility
orca.atspi
orca.debug
orca.default
orca.keybindings
orca.orca
orca.orca_state
orca.rolenames
orca.settings
orca.speech
orca.speechgenerator
orca.util

 
Classes
       
orca.default.Script(orca.script.Script)
Script
orca.speechgenerator.SpeechGenerator
SpeechGenerator

 
class Script(orca.default.Script)
    
Method resolution order:
Script
orca.default.Script
orca.script.Script

Methods defined here:
__init__(self, app)
Creates a new script for Java applications.
 
Arguments:
- app: the application to create a script for.
consumesKeyboardEvent(self, keyboardEvent)
Called when a key is pressed on the keyboard.
 
Arguments:
- keyboardEvent: an instance of input_event.KeyboardEvent
 
Returns True if the event is of interest.
getSpeechGenerator(self)
Returns the speech generator for this script.
onFocus(self, event)
Called whenever an object gets focus.
 
Arguments:
- event: the Event
onSelectionChanged(self, event)
Called when an object's selection changes.
 
Arguments:
- event: the Event
onStateChanged(self, event)
Called whenever an object's state changes.  Currently, the
state changes for non-focused objects are ignored.
 
Arguments:
- event: the Event
onValueChanged(self, event)
Called whenever an object's value changes.  Currently, the
value changes for non-focused objects are ignored.
 
Arguments:
- event: the Event
visualAppearanceChanged(self, event, obj)
Called when the visual appearance of an object changes.  This
method should not be called for objects whose visual appearance
changes solely because of focus -- setLocusOfFocus is used for that.
Instead, it is intended mostly for objects whose notional 'value' has
changed, such as a checkbox changing state, a progress bar advancing,
a slider moving, text inserted, caret moved, etc.
 
Arguments:
- event: if not None, the Event that caused this to happen
- obj: the Accessible whose visual appearance changed.

Methods inherited from orca.default.Script:
echoPreviousWord(self, obj)
Speaks the word prior to the caret, as long as there is
a word prior to the caret and there is no intervening word
delimiter between the caret and the end of the word.
 
The entry condition for this method is that the character
prior to the current caret position is a word delimiter,
and it's what caused this method to be called in the first
place.
 
Arguments:
- obj: an Accessible object that implements the AccessibleText
       interface.
enterLearnMode(self, inputEvent=None)
Turns learn mode on.  The user must press the escape key to exit
learn mode.
 
Returns True to indicate the input event has been consumed.
exitLearnMode(self, inputEvent=None)
Turns learn mode off.
 
Returns True to indicate the input event has been consumed.
find(self, query=None)
Searches for the specified query.  If no query is specified,
it searches for the query specified in the Orca Find dialog.
 
Arguments:
- query: The search query to find.
findCommonAncestor(self, a, b)
Finds the common ancestor between Accessible a and Accessible b.
 
Arguments:
- a: Accessible
- b: Accessible
findNext(self, inputEvent)
Searches forward for the next instance of the string
searched for via the Orca Find dialog.  Other than direction
and the starting point, the search options initially specified
(case sensitivity, window wrap, and full/partial match) are
preserved.
findPrevious(self, inputEvent)
Searches backwards for the next instance of the string
searched for via the Orca Find dialog.  Other than direction
and the starting point, the search options initially specified
(case sensitivity, window wrap, and full/partial match) are
preserved.
getBrailleBindings(self)
Defines the braille bindings for this script.
 
Returns a dictionary where the keys are BrlTTY commands and the
values are InputEventHandler instances.
getFlatReviewContext(self)
Returns the flat review context, creating one if necessary.
getInputEventHandlerKey(self, inputEventHandler)
Returns the name of the key that contains an inputEventHadler
passed as argument
getKeyBindings(self)
Defines the key bindings for this script.
 
Returns an instance of keybindings.KeyBindings.
getListeners(self)
Sets up the AT-SPI event listeners for this script.
getText(self, obj, startOffset, endOffset)
Returns the substring of the given object's text specialization.
 
Arguments:
- obj: an accessible supporting the accessible text specialization
- startOffset: the starting character position
- endOffset: the ending character position
goBrailleHome(self, inputEvent=None)
Returns to the component with focus.
isLayoutOnly(self, obj)
Returns True if the given object is a table and is for layout
purposes only.
isTextArea(self, obj)
Returns True if obj is a GUI component that is for entering text.
 
Arguments:
- obj: an accessible
leftClickReviewItem(self, inputEvent=None)
Performs a left mouse button click on the current item.
locusOfFocusChanged(self, event, oldLocusOfFocus, newLocusOfFocus)
Called when the visual object with focus changes.
 
Arguments:
- event: if not None, the Event that caused the change
- oldLocusOfFocus: Accessible that is the old locus of focus
- newLocusOfFocus: Accessible that is the new locus of focus
noOp(self, event)
Just here to capture events.
 
Arguments:
- event: the Event
onActiveDescendantChanged(self, event)
Called when an object who manages its own descendants detects a
change in one of its children.
 
Arguments:
- event: the Event
onCaretMoved(self, event)
Called whenever the caret moves.
 
Arguments:
- event: the Event
onLinkSelected(self, event)
Called when a hyperlink is selected in a text area.
 
Arguments:
- event: the Event
onNameChanged(self, event)
Called whenever a property on an object changes.
 
Arguments:
- event: the Event
onTextDeleted(self, event)
Called whenever text is deleted from an object.
 
Arguments:
- event: the Event
onTextInserted(self, event)
Called whenever text is inserted into an object.
 
Arguments:
- event: the Event
onWindowActivated(self, event)
Called whenever a toplevel window is activated.
 
Arguments:
- event: the Event
onWindowDeactivated(self, event)
Called whenever a toplevel window is deactivated.
 
Arguments:
- event: the Event
outputCharAttributes(self, keys, attributes)
Speak each of the text attributes given dictionary.
 
Arguments:
- attributes: a dictionary of text attributes to speak.
panBrailleLeft(self, inputEvent=None, panAmount=0)
Pans the braille display to the left.  If panAmount is non-zero,
the display is panned by that many cells.  If it is 0, the display
is panned one full display width.  In flat review mode, panning
beyond the beginning will take you to the end of the previous line.
 
In focus tracking mode, the cursor stays at its logical position.
In flat review mode, the review cursor moves to character
associated with cell 0.
panBrailleLeftOneChar(self, inputEvent=None)
Nudges the braille display one character to the left.
 
In focus tracking mode, the cursor stays at its logical position.
In flat review mode, the review cursor moves to character
associated with cell 0.
panBrailleRight(self, inputEvent=None, panAmount=0)
Pans the braille display to the right.  If panAmount is non-zero,
the display is panned by that many cells.  If it is 0, the display
is panned one full display width.  In flat review mode, panning
beyond the end will take you to the begininng of the next line.
 
In focus tracking mode, the cursor stays at its logical position.
In flat review mode, the review cursor moves to character
associated with cell 0.
panBrailleRightOneChar(self, inputEvent=None)
Nudges the braille display one character to the right.
 
In focus tracking mode, the cursor stays at its logical position.
In flat review mode, the review cursor moves to character
associated with cell 0.
processKeyboardEvent(self, keyboardEvent)
Processes the given keyboard event. It uses the super
class equivalent to do most of the work. The only thing done here
is to detect when the user is trying to get out of learn mode.
 
Arguments:
- keyboardEvent: an instance of input_event.KeyboardEvent
pursueForFlatReview(self, obj)
Determines if we should look any further at the object
for flat review.
readCharAttributes(self, inputEvent=None)
Reads the attributes associated with the current text character.
Calls outCharAttributes to speak a list of attributes. By default,
a certain set of attributes will be spoken. If this is not desired,
then individual application scripts should override this method to
only speak the subset required.
reportScriptInfo(self, inputEvent=None)
Output useful information on the current script via speech
and braille.  This information will be helpful to script writers.
reviewAbove(self, inputEvent)
Moves the flat review context to the character most directly
above the current flat review cursor.  Places the flat review
cursor at character.
reviewBelow(self, inputEvent)
Moves the flat review context to the character most directly
below the current flat review cursor.  Places the flat review
cursor at character.
reviewBottomLeft(self, inputEvent)
Moves the flat review context to the beginning of the
last line in the window.  Places the flat review cursor at
the beginning of the line.
reviewCurrentAccessible(self, inputEvent)
reviewCurrentCharacter(self, inputEvent)
Presents the current flat review character via braille and speech.
reviewCurrentItem(self, inputEvent, targetCursorCell=0)
Speak/Braille the current item to the user. A "double-click"
of this key will cause the word to be spelt. A "triple-click"
will cause the word to be phonetically spelt.
reviewCurrentLine(self, inputEvent)
Presents the current flat review line via braille and speech.
reviewEnd(self, inputEvent)
Moves the flat review context to the end of the
last line in the window.  Places the flat review cursor
at the end of the line.
reviewEndOfLine(self, inputEvent)
Moves the flat review context to the end of the line.  Places
the flat review cursor at the end of the line.
reviewHome(self, inputEvent)
Moves the flat review context to the top left of the current
window.
reviewNextCharacter(self, inputEvent)
Moves the flat review context to the next character.  Places
the flat review cursor at character.
reviewNextItem(self, inputEvent)
Moves the flat review context to the next item.  Places
the flat review cursor at the beginning of the item.
reviewNextLine(self, inputEvent)
Moves the flat review context to the beginning of the
next line.  Places the flat review cursor at the beginning
of the line.
reviewPreviousCharacter(self, inputEvent)
Moves the flat review context to the previous character.  Places
the flat review cursor at character.
reviewPreviousItem(self, inputEvent)
Moves the flat review context to the previous item.  Places
the flat review cursor at the beginning of the item.
reviewPreviousLine(self, inputEvent)
Moves the flat review context to the beginning of the
previous line.
rightClickReviewItem(self, inputEvent=None)
Performs a right mouse button click on the current item.
sayAll(self, inputEvent)
sayCharacter(self, obj)
Speak the character under the caret.  [[[TODO: WDW - isn't the
caret between characters?]]]
 
Arguments:
- obj: an Accessible object that implements the AccessibleText
       interface
sayLine(self, obj)
Speaks the line of an AccessibleText object that contains the
caret, unless the line is empty in which case it's ignored.
 
Arguments:
- obj: an Accessible object that implements the AccessibleText
       interface
sayPhrase(self, obj, startOffset, endOffset)
Speaks the text of an Accessible object between the start and
end offsets, unless the phrase is empty in which case it's ignored.
 
Arguments:
- obj: an Accessible object that implements the AccessibleText
       interface
- startOffset: the start text offset.
- endOffset: the end text offset.
sayWord(self, obj)
Speaks the word at the caret.  [[[TODO: WDW - what if there is no
word at the caret?]]]
 
Arguments:
- obj: an Accessible object that implements the AccessibleText
       interface
setupInputEventHandlers(self)
Defines InputEventHandler fields for this script that can be
called by the key and braille bindings.
showZones(self, inputEvent)
Debug routine to paint rectangles around the discrete
interesting (e.g., text)  zones in the active window for
this application.
speakTextIndentation(self, obj, line)
Speaks a summary of the number of spaces and/or tabs at the
beginning of the given line.
 
Arguments:
- obj: the text object.
- line: the string to check for spaces and tabs.
spellCurrentItem(self, string)
Spell the current flat review word or line.
 
Arguments:
- string: the string to spell.
textAttrsToDictionary(self, str)
Converts a string of text attribute tokens of the form
<key>:<value>; into a dictionary of keys and values.
Text before the colon is the key and text afterwards is the
value. If there is a final semi-colon, then it's ignored.
 
Arguments:
- str: the string of tokens containing <key>:<value>; pairs.
 
Returns a list containing two items:
A list of the keys in the order they were extracted from the
text attribute string and a dictionary of key/value items.
toggleFlatReviewMode(self, inputEvent=None)
Toggles between flat review mode and focus tracking mode.
toggleTableCellReadMode(self, inputEvent=None)
Toggles an indicator for whether we should just read the current
table cell or read the whole row.
updateBraille(self, obj, extraRegion=None)
Updates the braille display to show the give object.
 
Arguments:
- obj: the Accessible
- extra: extra Region to add to the end
updateBrailleReview(self, targetCursorCell=0)
Obtains the braille regions for the current flat review line
and displays them on the braille display.  If the targetCursorCell
is non-0, then an attempt will be made to postion the review cursor
at that cell.  Otherwise, we will pan in display-sized increments
to show the review cursor.
whereAmI(self, inputEvent)
Speaks information about the current object of interest.

Methods inherited from orca.script.Script:
consumesBrailleEvent(self, brailleEvent)
Called when a key is pressed on the braille display.
 
Arguments:
- brailleEvent: an instance of input_event.KeyboardEvent
 
Returns True if the event is of interest.
getBrailleCommandsForInputHandler(self, inputEventHandler)
Returns a list of BrlTTY commands (they're in braille.py) that
match the given inputEventHandler passed as argument.
 
Arguments:
- inputEventHandler: an instance of input_event.InputEventHandler
 
Returns a list (possibly empty) of BrlTTY commands (they're in
braille.py) that match the given inputEventHandler passed.
getBrailleGenerator(self)
Returns the braille generator for this script.
getKeyBindingsForInputHandler(self, inputEventHandler)
Returns a KeyBindings object with the list of KeyBindings that
matche the passed inputEventHandler as argument (at least the
inputEventHandler that has the same handler function)
 
Arguments:
- inputEventHandler: an instance of input_event.InputEventHandler
 
Returns an instance of keybindings.KeyBindings populated with
keybindings.KeyBinding instances that match the inputEventHandler.
processBrailleEvent(self, brailleEvent)
Called whenever a key is pressed on the Braille display.
 
This method will primarily use the brailleBindings field of
this script instance see if this script has an interest in the
event.
 
NOTE: there is latent, but unsupported, logic for allowing
the user's user-settings.py file to extend and/or override
the brailleBindings for a script.
 
Arguments:
- brailleEvent: an instance of input_event.BrailleEvent
processObjectEvent(self, event)
Processes all AT-SPI object events of interest to this
script.  The interest in events is specified via the
'listeners' field that was defined during the construction of
this script.
 
In general, the primary purpose of handling object events is to
keep track of changes to the locus of focus and notify the
orca module of these changes via orca.setLocusOfFocus and
orca.visualAppearanceChanged.
 
Note that this script may be passed events it doesn't care
about, so it needs to react accordingly.
 
Arguments:
- event: the Event

 
class SpeechGenerator(orca.speechgenerator.SpeechGenerator)
    Overrides _getSpeechForLabel
 
  Methods defined here:
__init__(self, script)

Methods inherited from orca.speechgenerator.SpeechGenerator:
getSpeech(self, obj, already_focused)
Get the speech for an Accessible object.  This will look
first to the specific speech generators and then to the
default speech generator.  This method is the primary method
that external callers of this class should use.
 
Arguments:
- obj: the object
- already_focused: False if object just received focus
 
Returns a list of utterances to be spoken.
getSpeechContext(self, obj, stopAncestor=None)
Get the speech that describes the names and role of
the container hierarchy of the object, stopping at and
not including the stopAncestor.
 
Arguments:
- obj: the object
- stopAncestor: the anscestor to stop at and not include (None
  means include all ancestors)
 
Returns a list of utterances to be spoken.

 
Data
        __copyright__ = 'Copyright (c) 2005-2006 Sun Microsystems Inc.'
__date__ = '$Date: 2007-03-12 16:23:35 -0400 (Mon, 12 Mar 2007) $'
__id__ = '$Id: orca.J2SE-access-bridge.html 5086 2007-03-12 20:23:35Z wwalker $'
__license__ = 'LGPL'
__version__ = '$Revision: 5086 $'