From: James Teh Date: Wed, 8 Dec 2010 07:35:56 +0000 (+1000) Subject: InputGesture: Add a scriptableObject property which allows a gesture to specify a... X-Git-Tag: jpdev130418~2045^2~17 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=f610a1cbd7ed630f0660be2b4cfc49239e689a8a;p=nvdajp%2Fnvdajp.git InputGesture: Add a scriptableObject property which allows a gesture to specify a scriptable object which contains scripts specific to this gesture/type of gesture. --- diff --git a/source/inputCore.py b/source/inputCore.py index f2fc46b71..fb28ca09e 100644 --- a/source/inputCore.py +++ b/source/inputCore.py @@ -95,6 +95,14 @@ class InputGesture(baseObject.AutoPropertyObject): """ raise NotImplementedError + def _get_scriptableObject(self): + """An object which contains scripts specific to this gesture or type of gesture. + This object will be searched for scripts before any other object when handling this gesture. + @return: The gesture specific scriptable object or C{None} if there is none. + @rtype: L{baseObject.ScriptableObject} + """ + return None + class GlobalGestureMap(object): """Maps gestures to scripts anywhere in NVDA. This is used to allow users and locales to bind gestures in addition to those bound by individual scriptable objects. diff --git a/source/scriptHandler.py b/source/scriptHandler.py index 07e213cd9..5f9a01057 100644 --- a/source/scriptHandler.py +++ b/source/scriptHandler.py @@ -62,6 +62,13 @@ def findScript(gesture): for identifier in gesture.identifiers: globalMapScripts.extend(globalMap.getScriptsForGesture(identifier)) + # Gesture specific scriptable object. + obj = gesture.scriptableObject + if obj: + func = _getObjScript(obj, gesture, globalMapScripts) + if func: + return func + # Global plugin level. for plugin in globalPluginHandler.runningPlugins: func = _getObjScript(plugin, gesture, globalMapScripts)