Module baseObject :: Class ScriptableObject
[hide private]
[frames] | no frames]

Class ScriptableObject

source code

        object --+    
                 |    
AutoPropertyObject --+
                     |
                    ScriptableObject

A class that implements NVDA's scripting interface. Input gestures are bound to scripts such that the script will be executed when the appropriate input gesture is received. Scripts are methods named with a prefix of script_; e.g. script_foo. They accept an inputCore.InputGesture as their single argument. Gesture bindings can be specified on the class by creating a __gestures dict which maps gesture identifiers to script names. They can also be bound on an instance using the bindGesture method.

Nested Classes [hide private]

Inherited from AutoPropertyObject: __metaclass__

Instance Methods [hide private]
 
__init__(self)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
bindGesture(self, gestureIdentifier, scriptName)
Bind an input gesture to a script.
source code
 
clearGestureBindings(self)
Remove all input gesture bindings from this object.
source code
 
bindGestures(self, gestureMap)
Bind multiple input gestures to scripts.
source code
script function
getScript(self, gesture)
Retrieve the script bound to a given gesture.
source code

Inherited from AutoPropertyObject: invalidateCache

Inherited from AutoPropertyObject (private): _getPropertyViaCache

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

Class Methods [hide private]

Inherited from AutoPropertyObject: invalidateCaches

Class Variables [hide private]

Inherited from AutoPropertyObject: cachePropertiesByDefault

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

bindGesture(self, gestureIdentifier, scriptName)

source code 

Bind an input gesture to a script.

Parameters:
  • gestureIdentifier (str) - The identifier of the input gesture.
  • scriptName (str) - The name of the script, which is the name of the method excluding the script_ prefix.
Raises:
  • LookupError - If there is no script with the provided name.

bindGestures(self, gestureMap)

source code 

Bind multiple input gestures to scripts. This is a convenience method which simply calls bindGesture for each gesture and script pair, logging any errors.

Parameters:
  • gestureMap (dict of str to str) - A mapping of gesture identifiers to script names.

getScript(self, gesture)

source code 

Retrieve the script bound to a given gesture.

Parameters:
Returns: script function
The script function or None if none was found.