OSDN Git Service

InputGesture: Add a scriptableObject property which allows a gesture to specify a...
authorJames Teh <jamie@jantrid.net>
Wed, 8 Dec 2010 07:35:56 +0000 (17:35 +1000)
committerJames Teh <jamie@jantrid.net>
Wed, 8 Dec 2010 07:35:56 +0000 (17:35 +1000)
source/inputCore.py
source/scriptHandler.py

index f2fc46b..fb28ca0 100644 (file)
@@ -95,6 +95,14 @@ class InputGesture(baseObject.AutoPropertyObject):
                """\r
                raise NotImplementedError\r
 \r
+       def _get_scriptableObject(self):\r
+               """An object which contains scripts specific to this  gesture or type of gesture.\r
+               This object will be searched for scripts before any other object when handling this gesture.\r
+               @return: The gesture specific scriptable object or C{None} if there is none.\r
+               @rtype: L{baseObject.ScriptableObject}\r
+               """\r
+               return None\r
+\r
 class GlobalGestureMap(object):\r
        """Maps gestures to scripts anywhere in NVDA.\r
        This is used to allow users and locales to bind gestures in addition to those bound by individual scriptable objects.\r
index 07e213c..5f9a010 100644 (file)
@@ -62,6 +62,13 @@ def findScript(gesture):
                for identifier in gesture.identifiers:\r
                        globalMapScripts.extend(globalMap.getScriptsForGesture(identifier))\r
 \r
+       # Gesture specific scriptable object.\r
+       obj = gesture.scriptableObject\r
+       if obj:\r
+               func = _getObjScript(obj, gesture, globalMapScripts)\r
+               if func:\r
+                       return func\r
+\r
        # Global plugin level.\r
        for plugin in globalPluginHandler.runningPlugins:\r
                func = _getObjScript(plugin, gesture, globalMapScripts)\r