Skip to content

Commit

Permalink
Merge branch 't2953' into next. Incubates #2953
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelDCurran committed Jun 22, 2015
2 parents 5cfc707 + ebca712 commit 46d0a2e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
6 changes: 6 additions & 0 deletions source/inputCore.py
Expand Up @@ -434,6 +434,12 @@ def executeGesture(self, gesture):

gesture.reportExtra()

# #2953: if an intercepted command Script (script that sends a gesture) is queued
# then queue all following gestures (that don't have a script) with a fake script so that they remain in order.
if not script and scriptHandler._numUncompleteInterceptedCommandScripts:
script=lambda gesture: gesture.send()


if script:
scriptHandler.queueScript(script, gesture)
return
Expand Down
12 changes: 10 additions & 2 deletions source/scriptHandler.py
Expand Up @@ -19,6 +19,7 @@
import braille

_numScriptsQueued=0 #Number of scripts that are queued to be executed
_numUncompleteInterceptedCommandScripts=0 #Number of scripts (that send gestures on) that are queued to be executed, or are currently being executed
_lastScriptTime=0 #Time in MS of when the last script was executed
_lastScriptRef=None #Holds a weakref to the last script that was executed
_lastScriptCount=0 #The amount of times the last script was repeated
Expand Down Expand Up @@ -133,14 +134,21 @@ def getScriptLocation(script):
if name in cls.__dict__:
return "%s.%s"%(cls.__module__,cls.__name__)

def _isInterceptedCommandScript(script):
return not getattr(script,'__doc__',None)

def _queueScriptCallback(script,gesture):
global _numScriptsQueued
global _numScriptsQueued, _numUncompleteInterceptedCommandScripts
_numScriptsQueued-=1
executeScript(script,gesture)
if _isInterceptedCommandScript(script):
_numUncompleteInterceptedCommandScripts-=1

def queueScript(script,gesture):
global _numScriptsQueued
global _numScriptsQueued, _numUncompleteInterceptedCommandScripts
_numScriptsQueued+=1
if _isInterceptedCommandScript(script):
_numUncompleteInterceptedCommandScripts+=1
queueHandler.queueFunction(queueHandler.eventQueue,_queueScriptCallback,script,gesture)

def willSayAllResume(gesture):
Expand Down

0 comments on commit 46d0a2e

Please sign in to comment.