orca.script (version 1996, $Date$)
index
/usr/lib/python2.5/site-packages/orca/script.py

Each script maintains a set of key bindings, braille bindings, and
AT-SPI event listeners.  The key bindings are an instance of
KeyBindings.  The braille bindings are also a dictionary where the
keys are BrlTTY command integers and the values are instances of
InputEventHandler.  The listeners field is a dictionary where the keys
are AT-SPI event names and the values are function pointers.
 
Instances of scripts are intended to be created solely by the
focus_tracking_presenter.
 
This Script class is not intended to be instantiated directly.
Instead, it is expected that subclasses of the Script class will be
created in their own module.  The module defining the Script subclass
is also required to have a 'getScript(app)' method that returns an
instance of the Script subclass.  See default.py for an example.

 
Modules
       
orca.braillegenerator
orca.debug
orca.flat_review
orca.keybindings
orca.orca_state
orca.settings
orca.speechgenerator

 
Classes
       
Script

 
class Script
    The specific focus tracking scripts for applications.
 
  Methods defined here:
__init__(self, app)
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
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.
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.
getBrailleBindings(self)
Defines the braille bindings for this script.
 
Returns a dictionary where the keys are BrlTTY commands and the
values are InputEventHandler instances.
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.
getKeyBindings(self)
Defines the key bindings for this script.
 
Returns an instance of keybindings.KeyBindings.
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.
getListeners(self)
Sets up the AT-SPI event listeners for this script.
 
Returns a dictionary where the keys are AT-SPI event names
and the values are script methods.
getSpeechGenerator(self)
Returns the speech generator for this script.
locusOfFocusChanged(self, event, oldLocusOfFocus, newLocusOfFocus)
Called when the visual object with focus changes.
 
The primary purpose of this method is to present locus of focus
information to the user.
 
NOTE: scripts should not call this method directly.  Instead,
a script should call orca.setLocusOfFocus, which will eventually
result in this method being called.
 
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
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
processKeyboardEvent(self, keyboardEvent)
Processes the given keyboard event.
 
This method will primarily use the keybindings 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 keybindings for a script.
 
Arguments:
- keyboardEvent: an instance of input_event.KeyboardEvent
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
setupInputEventHandlers(self)
Defines InputEventHandler fields for this script that can be
called by the key and braille bindings.
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.
 
The primary purpose of this method is to present the changed
information to the user.
 
NOTE: scripts should not call this method directly.  Instead,
a script should call orca.visualAppearanceChanged, which will
eventually result in this method being called.
 
Arguments:
- event: if not None, the Event that caused this to happen
- obj: the Accessible whose visual appearance changed.

 
Data
        __copyright__ = 'Copyright (c) 2005-2006 Sun Microsystems Inc.'
__date__ = '$Date$'
__id__ = '$Id$'
__license__ = 'LGPL'
__version__ = '$Revision$'