scriptHandler module
- scriptHandler._numIncompleteInterceptedCommandScripts = 0
Number of scripts that send their gestures on that are queued to be executed or are currently being executed.
- scriptHandler._makeKbEmulateScript(scriptName)
- scriptHandler._getObjScript(obj: NVDAObject, gesture: InputGesture, globalMapScripts: List[Tuple[InputGestureBindingClassT, str | None]]) Callable[[InputGesture], None] | None
@param globalMapScripts: An ordered list of scripts. The list is ordered by resolution priority, the first map in the list should be used to resolve the script first.
- scriptHandler.getGlobalMapScripts(gesture: InputGesture) List[Tuple[InputGestureBindingClassT, str | None]]
@returns: An ordered list of scripts. The list is ordered by resolution priority, the first map in the list should be used to resolve scripts first.
- scriptHandler.findScript(gesture: InputGesture) Callable[[InputGesture], None] | None
- scriptHandler._findScript(gesture: InputGesture) Callable[[InputGesture], None] | None
- scriptHandler._getTreeModeInterceptorScript(func: Callable[[InputGesture], None] | None, obj: NVDAObject, gesture: InputGesture) Callable[[InputGesture], None] | None
A filtering function used with _yieldObjectsForFindScript, to ensure a tree interceptor should propagate scripts and therefore handle the input gesture.
- scriptHandler._getFocusAncestorScript(func: Callable[[InputGesture], None] | None, obj: NVDAObject, gesture: InputGesture) Callable[[InputGesture], None] | None
A filtering function used with _yieldObjectsForFindScript, to ensure a focus ancestor should propagate scripts and therefore handle the input gesture.
- scriptHandler._yieldObjectsForFindScript(gesture: InputGesture) Generator[Tuple[NVDAObject, Callable[[Callable[[InputGesture], None] | None, NVDAObject, InputGesture], Callable[[InputGesture], None] | None] | None], None, None]
This generator is used to determine which NVDAObject to perform an input gesture on, in order of priority. For example, if the first yielded object has an associated script for the given gesture, findScript will use that script. @yields: A tuple, which includes
an NVDAObject, to check if there is an associated script
an optional function to handle any further filtering required after checking for an associated script
- scriptHandler.getScriptName(script)
- scriptHandler.getScriptLocation(script)
- scriptHandler._isInterceptedCommandScript(script)
- scriptHandler._queueScriptCallback(script, gesture)
- scriptHandler.queueScript(script, gesture)
- scriptHandler.willSayAllResume(gesture)
- scriptHandler.executeScript(script, gesture)
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 L{getLastScriptRepeatCount} to find out this count value. @param script: 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. @type script: callable. @param gesture: the input gesture that activated this script @type gesture: L{inputCore.InputGesture}
- scriptHandler.getLastScriptRepeatCount()
The count of how many times the most recent script has been executed. This should only be called from with in a script. @returns: 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. @rtype: integer
- scriptHandler.clearLastScript()
Clears the variables that keeps track of the execution of duplicate scripts with in a certain amount of time, so that next script execution will always be detected as a first execution of this script. This function should only be called from the main thread.
- scriptHandler.getCurrentScript() Callable[[InputGesture], None] | None
- scriptHandler.isScriptWaiting()
- scriptHandler.script(description: str = '', category: str | None = None, gesture: str | None = None, gestures: Iterator[str] | None = None, canPropagate: bool = False, bypassInputHelp: bool = False, allowInSleepMode: bool = False, resumeSayAllMode: int | None = None, speakOnDemand: bool = False)
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 have a name starting with “script_” :param description: A short translatable description of the script to be used in the gesture editor, etc. :param category: The category of the script displayed in the gesture editor. :param gesture: A gesture associated with this script. :param gestures: A collection of gestures associated with this script :param canPropagate: Whether this script should also apply when it belongs to a focus ancestor object. :param bypassInputHelp: Whether this script should run when input help is active. :param allowInSleepMode: Whether this script should run when NVDA is in sleep mode. :param resumeSayAllMode: The say all mode that should be resumed when active before executing this script. One of the C{sayAll.CURSOR_*} constants. :param speakOnDemand: Whether this script should speak when NVDA speech mode is “on-demand”