Module SUEMain
[hide private]
[frames] | no frames]

Module SUEMain

source code

Defines the main function which parses command line arguments and acts on them. Creates an instance of the AERegistrar to add a new user interface element (UIE) to the repository on disk when commands for the AERegistrar are present. If the kill switch is found, kills the running instance of SUE started by this user. Otherwise, starts an instance of the AccessEngine and runs the screen reader.

The main function in this module parses the command line parameters and dispatches command line options to the other top level functions defined here. The other top level functions split up the work of installing/uninstalling new UIEs (install, uninstall), associating/unassociating (associate, disassociate), creating/removing/duplicating profiles (createProfile, removeProfile, duplicateProfile), initializing the global list of installed extensions initGlobal, and running the screen reader (run). Other top level functions are provided for convenience such as configA11y and generate.

#See the SUE man pages for help with using command line parameters.


Authors:
Peter Parente, Frank Zenker
Organizations: Copyright: License:
Functions [hide private]
string
wrap(text, width=79, encoding='utf-8', indent=4)
A word-wrap function that preserves existing line breaks and most spaces in the text.
source code
 
welcome()
Prints copyright, license, and version info.
source code
boolean
confirmRemove(name)
Confirms deletion actions from the command prompt.
source code
string
install(options)
Installs a new UIE in the repository via the AERegistrar.
source code
string
uninstall(options)
Uninstalls a UIE from the repository via the AERegistrar.
source code
string
associate(options)
Associates a UIE with a profile so that it is loaded at a particular time (e.g.
source code
string
disassociate(options)
Disassociates a UIE with a profile so that it is no longer loaded at a particular time.
source code
string
generate(options)
Generates a template file for the given kind of UIE.
source code
string
createProfile(options)
Creates a new, empty profile.
source code
string
duplicateProfile(options)
Duplicates an existing profile.
source code
string
removeProfile(options)
Removes an existing profile.
source code
string
exportPath(options)
Gets the path to the package containing this file.
source code
string
say(options)
Uses the first available audio AEOutput device to output a string.
source code
string
show(options)
Shows all installed scripts and profiles, indicating all associated UIE's via the AERegistrar.
source code
string
run(options)
Runs SUE.
source code
string
initProfiles(options)
Initializes the default user profiles using the AERegistrar.
source code
string
initGlobal(options)
Initializes the global cache of installed UIEs in the HOME_DIR folder using the AERegistrar.
source code
 
getAction(option, opt_str, value, parser)
Maps a command line param to the name of a function in this module that will handle it.
source code
 
configA11y(options)
Runs gconf to check if desktop accessibility support is enabled or not.
source code
 
configGUI(options)
Configures the GUI toolkit with a default icon list for all SUE top level windows.
source code
optparse.Values
parseOptions()
Parses the command line arguments based on the definition of the expected arguments provided here.
source code
 
main()
Print the welcome message, parses command line arguments, and configures the logging system.
source code
Variables [hide private]
  wrap_rx = re.compile(u"([\u2e80-\uffff])", re.UNICODE)
Function Details [hide private]

wrap(text, width=79, encoding='utf-8', indent=4)

source code 

A word-wrap function that preserves existing line breaks and most spaces in the text. Expects that existing line breaks are posix newlines. Recipe by Junyong Pan from the Python Cookbook:

http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/358117
Parameters:
  • text (string) - Text to wrap
  • width (integer) - Maximum width of a line
Returns: string
Wrapped text as a string

confirmRemove(name)

source code 
Confirms deletion actions from the command prompt. Looks for a press of 'y' to indicate confirmation.
Parameters:
  • name (string) - Name of the "thing" being removed
Returns: boolean
Confirm (True) or cancel (False)?

install(options)

source code 
Installs a new UIE in the repository via the AERegistrar.
Parameters:
  • options (optparse.Values) - Options seen on the command line
Returns: string
Description of the action
Raises:
  • Exception - When the AERegistrar reports an error completing the install

uninstall(options)

source code 
Uninstalls a UIE from the repository via the AERegistrar.
Parameters:
  • options (optparse.Values) - Options seen on the command line
Returns: string
Description of the action
Raises:
  • Exception - When the AERegistrar reports an error completing the uninstall

associate(options)

source code 
Associates a UIE with a profile so that it is loaded at a particular time (e.g. on startup, when any tier is created, or when a particular tier is created).
Parameters:
  • options (optparse.Values) - Options seen on the command line
Returns: string
Description of the action
Raises:
  • Exception - When the AERegistrar reports an error completing the association

disassociate(options)

source code 
Disassociates a UIE with a profile so that it is no longer loaded at a particular time.
Parameters:
  • options (optparse.Values) - Options seen on the command line
Returns: string
Description of the action
Raises:
  • Exception - When the AERegistrar reports an error completing the disassociation

generate(options)

source code 
Generates a template file for the given kind of UIE.
Parameters:
  • options (optparse.Values) - Options seen on the command line
Returns: string
Description of the action
Raises:
  • Exception - When there is a problem generating the new template because not all required parameters were specified, the template does not exist, the destination path is not writable, etc.

createProfile(options)

source code 
Creates a new, empty profile.
Parameters:
  • options (optparse.Values) - Options seen on the command line
Returns: string
Description of the action
Raises:

duplicateProfile(options)

source code 
Duplicates an existing profile.
Parameters:
  • options (optparse.Values) - Options seen on the command line
Returns: string
Description of the action
Raises:

removeProfile(options)

source code 
Removes an existing profile.
Parameters:
  • options (optparse.Values) - Options seen on the command line
Returns: string
Description of the action
Raises:

exportPath(options)

source code 
Gets the path to the package containing this file. Essentially, this is the path to the SUE package on disk.
Parameters:
  • options (optparse.Values) - Options seen on the command line
Returns: string
Description of the action

say(options)

source code 
Uses the first available audio AEOutput device to output a string.
Parameters:
  • options (optparse.Values) - Options seen on the command line
Returns: string
Description of the action

show(options)

source code 
Shows all installed scripts and profiles, indicating all associated UIE's via the AERegistrar.
Parameters:
  • options (optparse.Values) - Options seen on the command line
Returns: string
Description of the action

run(options)

source code 
Runs SUE.
Parameters:
  • options (optparse.Values) - Options seen on the command line
Returns: string
Description of the action
Raises:
  • Exception - When anything goes wrong during initialization

initProfiles(options)

source code 
Initializes the default user profiles using the AERegistrar. All UIEs shipped with SUE are associated with their appropriate profiles by this method in a well-defined order specified here.
Parameters:
  • options (optparse.Values) - Options seen on the command line
Returns: string
Description of the action
Raises:
  • Exception - When anything goes wrong during the initialization of the default profiles

initGlobal(options)

source code 
Initializes the global cache of installed UIEs in the HOME_DIR folder using the AERegistrar. All UIEs in the Scripts, Devices, Choosers, and Monitors are installed by this method. Any UIEs with names that do not conflict with the defaults are left untouched by this process.
Parameters:
  • options (optparse.Values) - Options seen on the command line
Returns: string
Description of the action
Raises:
  • ValueError - When anything goes wrong during initialization of the global repository

getAction(option, opt_str, value, parser)

source code 
Maps a command line param to the name of a function in this module that will handle it. For instance, the command line parameter for installing a UIE is mapped to the install function which will carry out the command.

configA11y(options)

source code 
Runs gconf to check if desktop accessibility support is enabled or not. If not, enables it and asks the user to logout.
Parameters:
  • options (optparse.Values) - Options seen on the command line
Raises:
  • ValueError - When accessibility support is not enabled

Note: Current implementation is GNOME, AT-SPI dependent

configGUI(options)

source code 
Configures the GUI toolkit with a default icon list for all SUE top level windows. Also enables accessibility for this application.

Note: Current implementation is gtk/gail dependent

parseOptions()

source code 
Parses the command line arguments based on the definition of the expected arguments provided here.
Returns: optparse.Values
Parsed options

main()

source code 

Print the welcome message, parses command line arguments, and configures the logging system. Dispatches control to one of the top-level functions in this module depending on the command line parameters specified.

If the SUE AccessEngine should be run (i.e. not configured or tested), checks that a11y support is enabled in gconf. If not, enables it but exits with an error.