Module BasicSpeechScript :: Class BasicSpeechScript
[hide private]
[frames] | no frames]

Class BasicSpeechScript

source code

                                  object --+            
                                           |            
AccessEngine.AEUserInterface.AEUserInterface --+        
                                               |        
                  AccessEngine.AEScript.AEScript --+    
                                                   |    
                   AccessEngine.AEScript.EventScript --+
                                                       |
                                                      BasicSpeechScript

Defines a default user interface that makes SUE act like a typical screen reader. It defines special hotkeys.

Nested Classes [hide private]
AEState class STATE
Class to instantiate and use to store state information across all instances of this AEScript.
Instance Methods [hide private]
 
init(self)
Registers event tasks to handle focus, view, caret, selector, state, and property change events.
source code
 
resetLasts(self, container='')
Resets variables tracking the last container, caret position, tree level, selection length, row/col offsets, and row/col count on view change.
source code
 
resetLastsOnFocus(self)
Resets variables tracking some of the stateful information on a focus change.
source code
 
resetLastsForNew(self)
Resets variables tracking whether an item is new or not for readNewRole, readNewLevel, readNewLabel, etc.
source code
string
getName(self)
Provides the localized name of this AEScript.
source code
string
getDescription(self)
Describe what this special AEScript do.
source code
 
switchLanguages(self, por, layer)
Attempts to switch the active speech engine to the POSIX message language in use in this AETier.
source code
 
stopSpeech(self, **kwargs)
Task to stop speech immediately, ignoring the value of the Stopping setting.
source code
 
increaseRate(self, **kwargs)
Increase the speech rate.
source code
 
decreaseRate(self, **kwargs)
Decrease the speech rate.
source code
 
readReviewItem(self, **kwargs)
Reads the details of the item at the pointer or speaks an informational message about why the item cannot be read.
source code
 
readReviewSkip(self, **kwargs)
Reads a summary of an item skipped during review.
source code
 
readReviewWord(self, text=None, **kwargs)
Reads the word at the pointer or speaks an informational message about why the word cannot be read.
source code
 
readReviewChar(self, **kwargs)
Reads the character at the pointer or speaks an informational message about why the item cannot be read.
source code
 
spellReviewWord(self, text=None, **kwargs)
Spells the word at the current AEPor.
source code
 
pronounceReviewWord(self, text=None, **kwargs)
Spells the word at the current AEPor using the phonetic alphabet and names for known symbols and punctuation.
source code
 
pronounceReviewChar(self, **kwargs)
Says the current character using the phonetic alphabet and names for known symbols and punctuation.
source code
 
readPointerToFocus(self, por, **kwargs)
Reports the new location of the pointer AEPor when it snaps back to the application focus, selection, and caret position.
source code
 
whereAmIAncestors(self, **kwargs)
Reports all control and container names in child-to-parent order from the current AEPor to the root accessible.
source code
 
whereAmINow(self, **kwargs)
Reports the details of the current AEPor.
source code
 
readItemText(self, text, **kwargs)
Reads the text of the current item.
source code
 
readItemIndex(self, por=None, **kwargs)
Speaks the row and column indices of the given AEPor.
source code
 
readNewHeaders(self, por=None, **kwargs)
Reads the row/column headers if they differ from the last ones announced.
source code
 
readNewRole(self, por=None, role=None, say_role=True, **kwargs)
Speaks the role of the given AEPor if it is different from the last role read.
source code
 
readNewLevel(self, por=None, **kwargs)
Reads the tree level of a widget if it's different from the last level read.
source code
 
readNewLabel(self, por=None, **kwargs)
Read the label on a widget if it is different from the item text of the widget and the last container label read.
source code
 
readNewContainer(self, por=None, **kwargs)
Speaks the first interesting ancestor of the given AEPor if it is different from the last interesting ancestor announced.
source code
 
readMessage(self, text, sem=AEConstants.SEM_INFO, **kwargs)
Makes an arbitrary announcement using the given semantic for styling.
source code
 
readAll(self, interval=None, **kwargs)
Read the remaining contents of the active view starting at the current point of regard.
source code
 
_continueReadAll(self, **kwargs)
Continue queuing up contents in the view on a timed interval.
source code
 
readTop(self, **kwargs)
Read top of the active view, typically the title of the foreground window.
source code
dictionary
_getAttrs(self, **kwargs)
Reusable method for getting default and current text attributes and merging them into one dictionary.
source code
 
readTextColor(self, **kwargs)
Read the text foreground and background color names followed by their values.
source code
 
readTextAttributes(self, **kwargs)
Read all remaining text attribute name/value pairs sans color information.
source code
 
readDescription(self, **kwargs)
Read the description of the accessible at the current point of regard.
source code
 
readItemDetails(self, text=None, say_role=True, **kwargs)
Reads all details of the current item.
source code
boolean
onViewFirstGained(self, **kwargs)
Announces the title of the first view to be activated, but without stopping previous speech which is likely to be the SUE welcome message.
source code
boolean
onViewGained(self, **kwargs)
Stops output then calls onViewFirstGained to reuse its code for announcing the new view.
source code
boolean
onViewLost(self, **kwargs)
Decrement the active window count.
source code
 
inViewTimer(self, **kwargs)
Executes some time after a View lost event to check for an active window.
source code
boolean
onFocusGained(self, **kwargs)
Annouces the label and role of the newly focused widget.
source code
boolean
onSelectorActive(self, **kwargs)
Announces the text of the active item.
source code
boolean
onSelectorText(self, text, **kwargs)
Announces the localized word selected or unselected followed by the total number of characters in the selection.
source code
boolean
onCaretChange(self, **kwargs)
Stores the point of regard to the caret event location.
source code
boolean
onCaretInserted(self, **kwargs)
Announces the inserted text.
source code
boolean
onCaretMoved(self, **kwargs)
Announces the text passed in the caret movement.
source code
boolean
onCaretDeleted(self, **kwargs)
Announces the deleted text.
source code
 
updateOnCaretChange(self, por, text, text_offset, added, **kwargs)
Updates the last caret cache with the current AEPor, but only if the temp value of 'no update' has not been set to True.
source code
boolean
onStateChange(self, **kwargs)
Announces state changes according to the ones of interest defined by View.getStateText.
source code
boolean
onPropertyChange(self, **kwargs)
Announces value changes.
source code
boolean
readAlert(self, **kwargs)
Task registered temporarily when an alert dialog is shown.
source code
boolean
readDialog(self, **kwargs)
Task registered temporarily when a dialog (not alert) is shown.
source code

Inherited from AccessEngine.AEScript.EventScript: chainNewEventTaskAround, executeAroundTask, onChildAdded, onChildRemoved, onChildrenChange, onChooserChange, onChooserEnd, onChooserSignal, onChooserStart, onFocusChange, onFocusLost, onMouseChange, onMouseMoved, onMousePressed, onMouseReleased, onScreenChange, onScreenReflowed, onScreenRefreshed, onScreenResized, onSelectorAdded, onSelectorChange, onSelectorRemoved, onTableChange, onTableColumnDeleted, onTableColumnInserted, onTableColumnReordered, onTableRowDeleted, onTableRowInserted, onTableRowReordered, onViewChange, onViewStartup, registerEventTask, unregisterEventTask, updateAroundTask, updateOnChildrenChange, updateOnFocusChange, updateOnMouseChange, updateOnPropertyChange, updateOnScreenChange, updateOnSelectorChange, updateOnStateChange, updateOnTableChange, updateOnViewChange

Inherited from AccessEngine.AEScript.AEScript: __init__, bindToEvent, chainTask, close, doCyclicInputTask, doTask, getAETier, getAnchorScriptClassName, getAnchorTaskId, getChainSegment, getChooserTask, getCommandTask, getEventTasks, getIdealOutput, getLastKey, getOutputDevices, getPointerPOR, getRegisteredTask, getScriptSetting, getScriptSettingVal, getState, getTaskKeys, getTempData, getVirtualPOR, mergeChain, postClose, preInit, registerChooserTask, registerCommand, registerCyclicInputTask, registerCyclicInputTasks, registerModifiers, registerTask, registerTimerTask, setIdealOutput, setPointerPOR, setScriptSettingVal, setTempData, setVirtualPOR, unbindFromEvent, unchainTask, unregisterChooserTask, unregisterCommand, unregisterCyclicInputTask, unregisterModifiers, unregisterTask, unregisterTaskFromCyclicInputTask, unregisterTimerTask

Inherited from AccessEngine.AEUserInterface.AEUserInterface: getClassName, getPath

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Instance Variables [hide private]
boolean caret_changed
Tracks whether the last caret move event was a caused by a change (insert/delete) or just navigation
AEPor continue_por
Point of regard where reading should continue
AEPor last_caret
Stores the previous caret AEPor
integer last_col
Index of the last column activated
string last_container
Stores the previously announced container name
integer last_count
Was count of items in a collection announced during last announcement?
integer last_level
Stores the previous level to avoid duplicate announcements
string last_role
Stores the previous role to avoid duplicate announcements
integer last_row
Index of the last row activated
integer last_sel_len
Length of the selected text when the last selection event was received
AEPor start_por
Starting point of regard for the read operation

Inherited from AccessEngine.AEScript.AEScript: after_chains, around_chains, around_tasks, before_chains, chooser_tasks, command_descriptions, commands, cyclic_input_tasks, def_out, event_tasks, out_caps, registered_modifiers, registered_tasks, state, tier

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

init(self)

source code 
Registers event tasks to handle focus, view, caret, selector, state, and property change events. Registers tasks that can be mapped to AEInput.Gestures.
Overrides: AccessEngine.AEScript.AEScript.init

resetLasts(self, container='')

source code 
Resets variables tracking the last container, caret position, tree level, selection length, row/col offsets, and row/col count on view change.
Parameters:
  • container (string) - Last container name announced

resetLastsOnFocus(self)

source code 
Resets variables tracking some of the stateful information on a focus change. Does not reset the last role or last container announced.

getName(self)

source code 
Provides the localized name of this AEScript.
Returns: string
Human readable name of this script.
Overrides: AccessEngine.AEUserInterface.AEUserInterface.getName

getDescription(self)

source code 
Describe what this special AEScript do.
Returns: string
Human readable translated description of this script.
Overrides: AccessEngine.AEUserInterface.AEUserInterface.getDescription

switchLanguages(self, por, layer)

source code 
Attempts to switch the active speech engine to the POSIX message language in use in this AETier.
Parameters:
  • por (AEPor) - Point of regard for the related accessible
  • layer (integer) - Layer on which the event occurred

stopSpeech(self, **kwargs)

source code 
Task to stop speech immediately, ignoring the value of the Stopping setting.
Parameters:
  • kwargs (dictionary) - Arbitrary keyword arguments to pass to the task

increaseRate(self, **kwargs)

source code 
Increase the speech rate. The maximum rate is announced when reached.
Parameters:
  • kwargs (dictionary) - Arbitrary keyword arguments to pass to the task

See Also: decreaseRate

decreaseRate(self, **kwargs)

source code 
Decrease the speech rate. The minimum rate is announced when reached.
Parameters:
  • kwargs (dictionary) - Arbitrary keyword arguments to pass to the task

See Also: increaseRate

readReviewItem(self, **kwargs)

source code 
Reads the details of the item at the pointer or speaks an informational message about why the item cannot be read.
Parameters:
  • kwargs (dictionary) - Arbitrary keyword arguments to pass to the task

readReviewSkip(self, **kwargs)

source code 
Reads a summary of an item skipped during review.
Parameters:
  • kwargs (dictionary) - Arbitrary keyword arguments to pass to the task

readReviewWord(self, text=None, **kwargs)

source code 
Reads the word at the pointer or speaks an informational message about why the word cannot be read.
Parameters:
  • text (string) - Text to say, or None to use the pointer AEPor by default
  • kwargs (dictionary) - Arbitrary keyword arguments to pass to the task

readReviewChar(self, **kwargs)

source code 
Reads the character at the pointer or speaks an informational message about why the item cannot be read.
Parameters:
  • kwargs (dictionary) - Arbitrary keyword arguments to pass to the task

spellReviewWord(self, text=None, **kwargs)

source code 
Spells the word at the current AEPor. Says translated names for known symbols and punctuation. Says Unicode values for unknown characters.
Parameters:
  • text (string) - Text to say, or None to use the pointer AEPor by default
  • kwargs (dictionary) - Arbitrary keyword arguments to pass to the task

pronounceReviewWord(self, text=None, **kwargs)

source code 
Spells the word at the current AEPor using the phonetic alphabet and names for known symbols and punctuation. Says Unicode values and classifications for unknown characters.
Parameters:
  • text (string) - Text to say, or None to use the pointer AEPor by default
  • kwargs (dictionary) - Arbitrary keyword arguments to pass to the task

pronounceReviewChar(self, **kwargs)

source code 
Says the current character using the phonetic alphabet and names for known symbols and punctuation. Says Unicode values and classifications for unknown characters.
Parameters:
  • kwargs (dictionary) - Arbitrary keyword arguments to pass to the task

readPointerToFocus(self, por, **kwargs)

source code 
Reports the new location of the pointer AEPor when it snaps back to the application focus, selection, and caret position.
Parameters:
  • por (AEPor) - Point of regard for the related accessible
  • kwargs (dictionary) - Arbitrary keyword arguments to pass to the task

whereAmIAncestors(self, **kwargs)

source code 
Reports all control and container names in child-to-parent order from the current AEPor to the root accessible.
Parameters:
  • kwargs (dictionary) - Arbitrary keyword arguments to pass to the task

whereAmINow(self, **kwargs)

source code 
Reports the details of the current AEPor.
Parameters:
  • kwargs (dictionary) - Arbitrary keyword arguments to pass to the task

readItemText(self, text, **kwargs)

source code 
Reads the text of the current item.
Parameters:
  • text (string) - Text to say
  • kwargs (dictionary) - Arbitrary keyword arguments to pass to the task

readItemIndex(self, por=None, **kwargs)

source code 
Speaks the row and column indices of the given AEPor. Also speaks the total number of items if it has not been announced previously.
Parameters:
  • por (AEPor) - Point of regard to an object possibly having an index of interest
  • kwargs (dictionary) - Arbitrary keyword arguments to pass to the task

readNewHeaders(self, por=None, **kwargs)

source code 
Reads the row/column headers if they differ from the last ones announced. Speaks the row and column headers of the given AEPor. Only makes an announcement if the last row/col encountered by this task or this readNewHeaders task is different from the current.
Parameters:
  • por (AEPor) - Point of regard to a table cell possibly having a header
  • kwargs (dictionary) - Arbitrary keyword arguments to pass to the task

readNewRole(self, por=None, role=None, say_role=True, **kwargs)

source code 
Speaks the role of the given AEPor if it is different from the last role read. Depends on the RoleVerbosity setting. Does an explicit check for the identity of the task invoking this one to account for double role announcements from both focus and selector events.
Parameters:
  • por (AEPor) - Point of regard to the accessible whose role should be said
  • role (string) - Translated role name to speak. Prefers using this if available over fetching the string from the AEPor
  • say_role (boolean) - Recommendation based on data other than the last_role to take into account when the role verbosity is set to always so that we don't double announce roles.
  • kwargs (dictionary) - Arbitrary keyword arguments to pass to the task

readNewLevel(self, por=None, **kwargs)

source code 
Reads the tree level of a widget if it's different from the last level read. Speaks the level of the given AEPor only if it is different than the last level spoken by this method.
Parameters:
  • por (AEPor) - Point of regard to the accessible whose role should be said
  • kwargs (dictionary) - Arbitrary keyword arguments to pass to the task

readNewLabel(self, por=None, **kwargs)

source code 
Read the label on a widget if it is different from the item text of the widget and the last container label read. Speaks the text of a new label at the given AEPor only if it is different than the item text and the last container announced by readNewContainer.
Parameters:
  • por (AEPor) - Point of regard to an accessible that should be announced if it is a new label
  • kwargs (dictionary) - Arbitrary keyword arguments to pass to the task

readNewContainer(self, por=None, **kwargs)

source code 
Speaks the first interesting ancestor of the given AEPor if it is different from the last interesting ancestor announced.
Parameters:
  • por (AEPor) - Point of regard to an accessible that should be announced if it is a new menu.
  • kwargs (dictionary) - Arbitrary keyword arguments to pass to the task

readMessage(self, text, sem=AEConstants.SEM_INFO, **kwargs)

source code 
Makes an arbitrary announcement using the given semantic for styling.
Parameters:
  • text (string) - Text to announce
  • sem (integer) - Semantic of the announcement. Defaults to info.
  • kwargs (dictionary) - Arbitrary keyword arguments to pass to the task

readAll(self, interval=None, **kwargs)

source code 
Read the remaining contents of the active view starting at the current point of regard.
Parameters:
  • interval (integer) - Interval in seconds on which the timer fires.
  • kwargs (dictionary) - Arbitrary keyword arguments to pass to the task

_continueReadAll(self, **kwargs)

source code 
Continue queuing up contents in the view on a timed interval.
Parameters:
  • kwargs (dictionary) - Arbitrary keyword arguments to pass to the task

Note: if index markers are supported, update the start_por accordingly so a stop leaves the user near the last reviewed location, or maybe this is an option?

readTop(self, **kwargs)

source code 
Read top of the active view, typically the title of the foreground window.
Parameters:
  • kwargs (dictionary) - Arbitrary keyword arguments to pass to the task

_getAttrs(self, **kwargs)

source code 
Reusable method for getting default and current text attributes and merging them into one dictionary.
Parameters:
  • kwargs (dictionary) - Arbitrary keyword arguments to pass to the task
Returns: dictionary
Dictionary of name/value attribute pairs

readTextColor(self, **kwargs)

source code 
Read the text foreground and background color names followed by their values.
Parameters:
  • kwargs (dictionary) - Arbitrary keyword arguments to pass to the task

readTextAttributes(self, **kwargs)

source code 
Read all remaining text attribute name/value pairs sans color information.
Parameters:
  • kwargs (dictionary) - Arbitrary keyword arguments to pass to the task

readDescription(self, **kwargs)

source code 
Read the description of the accessible at the current point of regard.
Parameters:
  • kwargs (dictionary) - Arbitrary keyword arguments to pass to the task

readItemDetails(self, text=None, say_role=True, **kwargs)

source code 
Reads all details of the current item.
Parameters:
  • text (string) - Item text to use in the announcement
  • say_role (boolean) - Recommendation about whether the role should be announced or not purely based on the type of event received
  • kwargs (dictionary) - Arbitrary keyword arguments to pass to the task

onViewFirstGained(self, **kwargs)

source code 
Announces the title of the first view to be activated, but without stopping previous speech which is likely to be the SUE welcome message. Inhibits the next stop to avoid never announcing the title because of another immediate event following this one (i.e. focus).
Parameters:
  • kwargs (dictionary) - Arbitrary keyword arguments to pass to the task
Returns: boolean
True to allow other tasks to process this event.
Overrides: AccessEngine.AEScript.EventScript.onViewFirstGained

onViewGained(self, **kwargs)

source code 
Stops output then calls onViewFirstGained to reuse its code for announcing the new view.
Parameters:
  • kwargs (dictionary) - Arbitrary keyword arguments to pass to the task
Returns: boolean
True to allow other tasks to process this event.
Overrides: AccessEngine.AEScript.EventScript.onViewGained

onViewLost(self, **kwargs)

source code 
Decrement the active window count. If no active window when make an announcement.
Parameters:
  • kwargs (dictionary) - Arbitrary keyword arguments to pass to the task
Returns: boolean
True to allow other tasks to process this event.
Overrides: AccessEngine.AEScript.EventScript.onViewLost

To Do: disabled announcement for the time being

inViewTimer(self, **kwargs)

source code 
Executes some time after a View lost event to check for an active window. Makes an announcement if no window is active.
Parameters:
  • kwargs (dictionary) - Arbitrary keyword arguments to pass to the task

onFocusGained(self, **kwargs)

source code 
Annouces the label and role of the newly focused widget. The role is output only if it is different from the last one announced.
Parameters:
  • kwargs (dictionary) - Arbitrary keyword arguments to pass to the task
Returns: boolean
True to allow other tasks to process this event.
Overrides: AccessEngine.AEScript.EventScript.onFocusGained

onSelectorActive(self, **kwargs)

source code 
Announces the text of the active item.
Parameters:
  • kwargs (dictionary) - Arbitrary keyword arguments to pass to the task
Returns: boolean
True to allow other tasks to process this event.
Overrides: AccessEngine.AEScript.EventScript.onSelectorActive

onSelectorText(self, text, **kwargs)

source code 

Announces the localized word selected or unselected followed by the total number of characters in the selection.

Single line text boxes fire selection events followed by a caret event. Multiline text boxes fire events in the opposite order. The Output.inhibitMayStop allows the selection event to complete for single line text boxes before the caret event stops it with a call to Output.mayStop.
Parameters:
  • kwargs (dictionary) - Arbitrary data given by the observer.
Returns: boolean
Should processing continue? Always returns True by default.
Overrides: AccessEngine.AEScript.EventScript.onSelectorText

onCaretChange(self, **kwargs)

source code 
Stores the point of regard to the caret event location. Tries to stop current output.
Parameters:
  • kwargs (dictionary) - Arbitrary keyword arguments to pass to the task
Returns: boolean
True to allow other tasks to process this event.
Overrides: AccessEngine.AEScript.EventScript.onCaretChange

onCaretInserted(self, **kwargs)

source code 
Announces the inserted text.
Parameters:
  • kwargs (dictionary) - Arbitrary keyword arguments to pass to the task
Returns: boolean
True to allow other tasks to process this event.
Overrides: AccessEngine.AEScript.EventScript.onCaretInserted

onCaretMoved(self, **kwargs)

source code 
Announces the text passed in the caret movement.
Parameters:
  • kwargs (dictionary) - Arbitrary keyword arguments to pass to the task
Returns: boolean
True to allow other tasks to process this event.
Overrides: AccessEngine.AEScript.EventScript.onCaretMoved

Note: MW: With caret movement LSR used to speak the string between the old and the new caret position. This behaviour is not consistent with braille output and confuses a lot. Therefore, this was changed so we'll always speak the character after the caret position which is what other screen reader do, too. More functionality is provided by the review keys.

onCaretDeleted(self, **kwargs)

source code 
Announces the deleted text. Prepends delete and backspace text to indicate which way the caret moved.
Parameters:
  • kwargs (dictionary) - Arbitrary keyword arguments to pass to the task
Returns: boolean
True to allow other tasks to process this event
Overrides: AccessEngine.AEScript.EventScript.onCaretDeleted

updateOnCaretChange(self, por, text, text_offset, added, **kwargs)

source code 
Updates the last caret cache with the current AEPor, but only if the temp value of 'no update' has not been set to True.
Parameters:
  • por (AEPor) - Point of regard where the caret event occurred
  • text (string) - The text inserted, deleted or the line of the caret
  • text_offset (integer) - The offset of the inserted/deleted text or the line offset when movement only
  • added (boolean) - True when text added, c{False} when text deleted, and None when event is for caret movement only
  • kwargs (dictionary) - Arbitrary keyword arguments to pass to the task
Overrides: AccessEngine.AEScript.EventScript.updateOnCaretChange

onStateChange(self, **kwargs)

source code 
Announces state changes according to the ones of interest defined by View.getStateText.
Parameters:
  • kwargs (dictionary) - Arbitrary keyword arguments to pass to the task
Returns: boolean
True to allow other tasks to process this event
Overrides: AccessEngine.AEScript.EventScript.onStateChange

onPropertyChange(self, **kwargs)

source code 
Announces value changes.
Parameters:
  • kwargs (dictionary) - Arbitrary keyword arguments to pass to the task
Returns: boolean
True to allow other tasks to process this event.
Overrides: AccessEngine.AEScript.EventScript.onPropertyChange

readAlert(self, **kwargs)

source code 
Task registered temporarily when an alert dialog is shown. Collects all labels of interest in the dialog and says them in order.
Parameters:
  • kwargs (dictionary) - Arbitrary keyword arguments to pass to the task
Returns: boolean
True to allow other tasks to process this event.

readDialog(self, **kwargs)

source code 
Task registered temporarily when a dialog (not alert) is shown. Announces first two labels in the dialog in the order they were traversed. Traversal of some containers is bypassed.
Parameters:
  • kwargs (dictionary) - Arbitrary keyword arguments to pass to the task
Returns: boolean
True to allow other tasks to process this event.