Script scriptHandler
[hide private]

Module scriptHandler

source code

Functions [hide private]
 
_makeKbEmulateScript(scriptName) source code
 
_getObjScript(obj, gesture, globalMapScripts) source code
 
findScript(gesture) source code
 
getScriptName(script) source code
 
getScriptLocation(script) source code
 
_isInterceptedCommandScript(script) source code
 
_queueScriptCallback(script, gesture) source code
 
queueScript(script, gesture) source code
 
willSayAllResume(gesture) source code
 
executeScript(script, gesture)
Executes a given script (function) passing it the given gesture.
source code
integer
getLastScriptRepeatCount()
The count of how many times the most recent script has been executed.
source code
 
isScriptWaiting() source code
boolean
isCurrentScript(scriptFunc)
Finds out if the given script is equal to the script that isCurrentScript is being called from.
source code
 
script(description="", category=None, gesture=None, gestures=None, canPropagate=False, bypassInputHelp=False, resumeSayAllMode=None)
Define metadata for a script.
source code
Variables [hide private]
  _numScriptsQueued = 0
  _numIncompleteInterceptedCommandScripts = 0
Number of scripts that send their gestures on that are queued to be executed or are currently being executed.
  _lastScriptTime = 0
  _lastScriptRef = None
hash(x)
  _lastScriptCount = 0
  _isScriptRunning = False
Function Details [hide private]

executeScript(script, gesture)

source code 

Executes a given script (function) passing it the given gesture. It also keeps track of the execution of duplicate scripts with in a certain amount of time, and counts how many times this happens. Use getLastScriptRepeatCount to find out this count value.

Parameters:
  • script (callable.) - the function or method that should be executed. The function or method must take an argument of 'gesture'. This must be the same value as gesture.script, but its passed in here purely for performance.
  • gesture (inputCore.InputGesture) - the input gesture that activated this script

getLastScriptRepeatCount()

source code 

The count of how many times the most recent script has been executed. This should only be called from with in a script.

Returns: integer
a value greater or equal to 0. If the script has not been repeated it is 0, if it has been repeated once its 1, and so forth.

isCurrentScript(scriptFunc)

source code 

Finds out if the given script is equal to the script that isCurrentScript is being called from.

Parameters:
  • scriptFunc (Instance method) - the script retreaved from ScriptableObject.getScript(gesture)
Returns: boolean
True if they are equal, False otherwise

script(description="", category=None, gesture=None, gestures=None, canPropagate=False, bypassInputHelp=False, resumeSayAllMode=None)

source code 

Define metadata for a script. This function is to be used as a decorator to set metadata used by the scripting system and gesture editor. It can only decorate methods which name start swith "script_"

Parameters:
  • description (string) - A short translatable description of the script to be used in the gesture editor, etc.
  • category (string) - The category of the script displayed in the gesture editor.
  • gesture (string) - A gesture associated with this script.
  • gestures (list(string)) - A list of gestures associated with this script
  • canPropagate (bool) - Whether this script should also apply when it belongs to a focus ancestor object.
  • bypassInputHelp (bool) - Whether this script should run when input help is active.
  • resumeSayAllMode (int) - The say all mode that should be resumed when active before executing this script. One of the sayAllHandler.CURSOR_* constants.