| | |
- Method resolution order:
- Script
- orca.Gecko.Script
- orca.default.Script
- orca.script.Script
Methods defined here:
- __init__(self, app)
Methods inherited from orca.Gecko.Script:
- 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.
- dumpContents(self, inputEvent, contents=None)
- Dumps the document frame content to stdout.
Arguments:
-inputEvent: the input event that caused this to be called
-contents: an ordered list of [obj, startOffset, endOffset] tuples
- dumpInfo(self, obj)
- Dumps the parental hierachy info of obj to stdout.
- findFirstCaretContext(self, obj, characterOffset)
- Given an object and a character offset, find the first
[obj, characterOffset] that is actually presenting something
on the display. The reason we do this is that the
[obj, characterOffset] passed in may actually be pointing
to an embedded object character. In those cases, we dig
into the hierarchy to find the 'real' thing.
Arguments:
-obj: an accessible object
-characterOffset: the offset of the character where to start
looking for real rext
Returns [obj, characterOffset] that points to real content.
- findNextCaretInOrder(self, obj=None, startOffset=-1, includeNonText=True)
- Given an object at a character offset, return the next
caret context following an in-order traversal rule.
Arguments:
- root: the Accessible to start at. If None, starts at the
document frame.
- startOffset: character position in the object text field
(if it exists) to start at. Defaults to -1, which means
start at the beginning - that is, the next character is the
first character in the object.
- includeNonText: If False, only land on objects that support the
accessible text interface; otherwise, include logical leaf
nodes like check boxes, combo boxes, etc.
Returns [obj, characterOffset] or [None, -1]
- findNextObject(self, obj)
- Finds the object after to this one, where the tree we're
dealing with is a DOM and 'next' means the next object
in a linear presentation sense.
Arguments:
-obj: the object where to start.
- findNextRole(self, roles)
- Finds the caret offset at the beginning of the next object
using the given roles list as a pattern to match or not match.
Arguments:
-roles: a list of roles from rolenames.py
-match: if True, the found object will have a role from roles;
if False, the found object will not have a role from roles
- findPreviousCaretInOrder(self, obj=None, startOffset=-1, includeNonText=True)
- Given an object an a character offset, return the previous
caret context following an in order traversal rule.
Arguments:
- root: the Accessible to start at. If None, starts at the
document frame.
- startOffset: character position in the object text field
(if it exists) to start at. Defaults to -1, which means
start at the end - that is, the previous character is the
last character of the object.
Returns [obj, characterOffset] or [None, -1]
- findPreviousObject(self, obj)
- Finds the object prior to this one, where the tree we're
dealing with is a DOM and 'prior' means the previous object
in a linear presentation sense.
Arguments:
-obj: the object where to start.
- findPreviousRole(self, roles)
- Finds the caret offset at the beginning of the next object
using the given roles list as a pattern to match.
Arguments:
-roles: a list of roles from rolenames.py
- getACSS(self, obj, string)
- Returns the ACSS to speak anything for the given obj.
- getAutocompleteEntry(self, obj)
- Returns the ROLE_ENTRY object of a ROLE_AUTOCOMPLETE object or
None if the entry cannot be found.
- getBoundary(self, a, b)
- Returns the smallest [x, y, width, height] that encompasses
both extents a and b.
Arguments:
-a: [x, y, width, height]
-b: [x, y, width, height]
- getBrailleGenerator(self)
- Returns the braille generator for this script.
- getCaretContext(self, includeNonText=True)
- Returns the current [obj, caretOffset] if defined. If not,
it returns the first [obj, caretOffset] found by an in order
traversal from the beginning of the document.
- getCellCoordinates(self, obj)
- Returns the [row, col] of a ROLE_TABLE_CELL or [0, 0] if this
if the coordinates cannot be found.
- getCellHeaders(self, obj)
- Returns the [rowHeader, colHeader] of a ROLE_TABLE_CELL or
[None, None] if the headers cannot be found.
- getCharacterAtOffset(self, obj, characterOffset)
- Returns the character at the given characterOffset in the
given object or None if the object does not implement the
accessible text specialization.
- getCharacterOffsetInParent(self, obj)
- Returns the character offset of the embedded object
character for this object in its parent's accessible text.
Arguments:
- obj: an Accessible that should implement the accessible hyperlink
specialization.
Returns an integer representing the character offset of the
embedded object character for this hyperlink in its parent's
accessible text, or -1 something was amuck.
- getChildIndex(self, obj, characterOffset)
- Given an object that implements accessible text, determine
the index of the child that is represented by an
EMBEDDED_OBJECT_CHARACTER at characterOffset in the object's
accessible text.
- getContainingLink(self, obj)
- Returns the link containing the given object, or None if the
given object is not in a link.
- getDocumentContents(self)
- Returns an ordered list where each element is composed of
an [obj, startOffset, endOffset] tuple. The list is created
via an in-order traversal of the document contents starting at
the current caret context (or the beginning of the document if
there is no caret context).
WARNING: THIS TRAVERSES A LARGE PART OF THE DOCUMENT AND IS
INTENDED PRIMARILY FOR DEBUGGING PURPOSES ONLY.
- getDocumentFrame(self)
- Returns the document frame that holds the content being shown.
- getDocumentString(self)
- Trivial debug utility to stringify the document contents
showing on the screen.
- getExtents(self, obj, startOffset, endOffset)
- Returns [x, y, width, height] of the text at the given offsets
if the object implements accessible text, or just the extents of
the object if it doesn't implement accessible text.
- getKeyBindings(self)
- Defines the key bindings for this script.
Returns an instance of keybindings.KeyBindings.
- getLineContentsAtOffset(self, obj, characterOffset)
- Returns an ordered list where each element is composed of
an [obj, startOffset, endOffset] tuple. The list is created
via an in-order traversal of the document contents starting at
the given object and characterOffset. The first element in
the list represents the beginning of the line. The last
element in the list represents the character just before the
beginning of the next line.
Arguments:
-obj: the object to start at
-characterOffset: the characterOffset in the object
- getLinkBasename(self, obj)
- Returns the relevant information from the URI. The idea is
to attempt to strip off all prefix and suffix, much like the
basename command in a shell.
- getListeners(self)
- Sets up the AT-SPI event listeners for this script.
- getObjectContentsAtOffset(self, obj, characterOffset)
- Returns an ordered list where each element is composed of
an [obj, startOffset, endOffset] tuple. The list is created
via an in-order traversal of the document contents starting and
stopping at the given object.
- getSpeechGenerator(self)
- Returns the speech generator for this script.
- getTableCaption(self, obj)
- Returns the ROLE_CAPTION object of a ROLE_TABLE object or None
if the caption cannot be found.
- getUnicodeText(self, obj)
- Returns the unicode text for an object or None if the object
doesn't implement the accessible text specialization.
- getUtterancesFromContents(self, contents, speakRole=True)
- Returns a list of [text, acss] tuples based upon the
list of [obj, startOffset, endOffset] tuples passed in.
Arguments:
-contents: a list of [obj, startOffset, endOffset] tuples
-speakRole: if True, speak the roles of objects
- getWordContentsAtOffset(self, obj, characterOffset)
- Returns an ordered list where each element is composed of
an [obj, startOffset, endOffset] tuple. The list is created
via an in-order traversal of the document contents starting at
the given object and characterOffset. The first element in
the list represents the beginning of the word. The last
element in the list represents the character just before the
beginning of the next word.
Arguments:
-obj: the object to start at
-characterOffset: the characterOffset in the object
- goNextCharacter(self, inputEvent)
- Positions the caret offset to the next character or object
in the document window.
- goNextChunk(self, inputEvent)
- goNextHeading(self, inputEvent)
- goNextLine(self, inputEvent)
- Positions the caret offset at the next line in the document
window, attempting to preserve horizontal caret position.
- goNextWord(self, inputEvent)
- Positions the caret offset to the end of next word or object
in the document window.
- goPreviousCharacter(self, inputEvent)
- Positions the caret offset to the previous character or object
in the document window.
- goPreviousChunk(self, inputEvent)
- goPreviousHeading(self, inputEvent)
- goPreviousLine(self, inputEvent)
- Positions the caret offset at the previous line in the
document window, attempting to preserve horizontal caret
position.
- goPreviousWord(self, inputEvent)
- Positions the caret offset to beginning of the previous
word or object in the document window.
- inDocumentContent(self, obj=None)
- Returns True if the given object (defaults to the current
locus of focus is in the document content).
- isLabellingContents(self, obj, contents)
- Given and obj and a list of [obj, startOffset, endOffset] tuples,
determine if obj is labelling anything in the tuples.
- isLayoutOnly(self, obj)
- Returns True if the given object is a table and is for layout
purposes only.
- isUselessObject(self, obj)
- Returns true if the given object is an obj that doesn't
have any meaning associated with it and it is not inside a
link.
- 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
- onCaretMoved(self, event)
- Caret movement in Gecko is somewhat unreliable and
unpredictable, but we need to handle it. When we detect caret
movement, we make sure we update our own notion of the caret
position: our caretContext is an [obj, characterOffset] that
points to our current item and character (if applicable) of
interest. If our current item doesn't implement the
accessible text specialization, the characterOffset value
is meaningless (and typically -1).
- onDocumentLoadComplete(self, event)
- Called when a web page load is completed.
- onDocumentLoadStopped(self, event)
- Called when a web page load is interrupted.
- onDocumentReload(self, event)
- Called when the reload button is hit for a web page.
- onFocus(self, event)
- onLinkSelected(self, event)
- onNameChanged(self, event)
- Called whenever a property on an object changes.
Arguments:
- event: the Event
- onSameLine(self, a, b, pixelDelta=5)
- Determine if extents a and b are on the same line.
Arguments:
-a: [x, y, width, height]
-b: [x, y, width, height]
Returns True if a and b are on the same line.
- onStateChanged(self, event)
- Called whenever an object's state changes.
Arguments:
- event: the Event
- onTextDeleted(self, event)
- Called whenever text is from an an object.
Arguments:
- event: the Event
- onTextInserted(self, event)
- Called whenever text is inserted into an object.
Arguments:
- event: the Event
- onVisibleDataChanged(self, event)
- Called when the visible data of an object changes.
We do this to detect when the user switches between
the tabs holding different URL pages in the Firefox
window.
- outlineExtents(self, obj, startOffset, endOffset)
- Draws an outline around the given text for the object or the entire
object if it has no text. This is for debug purposes only.
Arguments:
-obj: the object
-startOffset: character offset to start at
-endOffset: character offset just after last character to end at
- pursueForFlatReview(self, obj)
- Determines if we should look any further at the object
for flat review.
- sayCharacter(self, obj)
- Speaks the character at the current caret position.
- sayLine(self, obj)
- Speaks the line at the current caret position.
- sayWord(self, obj)
- Speaks the word at the current caret position.
- setCaretPosition(self, obj, characterOffset)
- Sets the caret position to the given character offset in the
given object.
- setupInputEventHandlers(self)
- Defines InputEventHandler fields for this script that can be
called by the key and braille bindings.
- speakCharacterAtOffset(self, obj, characterOffset)
- Speaks the character at the given characterOffset in the
given object.
- speakContents(self, contents)
- toggleCaretNavigation(self, inputEvent)
- Toggles between Firefox native and Orca caret navigation.
- 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
- useCaretNavigationModel(self, keyboardEvent)
- Returns True if we should do our own caret navigation.
- useStructuralNavigationModel(self)
- Returns True if we should do our own structural navigation.
[[[TODO: WDW - this should return False if we're in something
like an entry area or a list because we want their keyboard
navigation stuff to work.]]]
- 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
- 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.
- 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.
- 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
- onSelectionChanged(self, event)
- Called when an object's selection changes.
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
- 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
- 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)
- 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.
- 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.
- 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.
- 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
|