Skip to content

Commit

Permalink
fixing some issues with _repeat.py
Browse files Browse the repository at this point in the history
  • Loading branch information
quintijn committed Dec 21, 2022
1 parent 97ffbcf commit dad81e9
Showing 1 changed file with 16 additions and 19 deletions.
35 changes: 16 additions & 19 deletions src/unimacro/UnimacroGrammars/_repeat.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
from natlinkcore import natlinktimer
from natlinkcore import natlinkstatus
import natlink
DEBUG = 0
DEBUG = 1
status = natlinkstatus.NatlinkStatus()
stateError = 'invalid state for timer routine'

Expand Down Expand Up @@ -327,7 +327,7 @@ def startNow(self):
k = self.state + self.minorState
s = self.curSpeed + 2 # very slow =2 -->> 0
if self.waiting:
natlinktimer.setTimerCallback(self.onTimer, waitingSpeed)
natlinktimer.setTimerCallback(self.onTimer, waitingSpeed, callAtMicOff=self.cancelMode)
elif k == 'mousing' or self.state == 'dragging':
speed = SPEED[k][s]
steps = defaultMousePixels
Expand All @@ -342,14 +342,14 @@ def startNow(self):
else:
speed = s
debugPrint(f'mouse starting with speed: {speed}, steps: {steps}')
natlinktimer.setTimerCallback(self.onTimer, speed)
natlinktimer.setTimerCallback(self.onTimer, speed, callAtMicOff=self.cancelMode)
self.mouseSteps = steps
elif k in SPEED:
debugPrint(f'starting with speed: {SPEED[k][s]}')
natlinktimer.setTimerCallback(self.onTimer, SPEED[k][s]) ##, debug=1)
natlinktimer.setTimerCallback(self.onTimer, SPEED[k][s], callAtMicOff=self.cancelMode)
else:
debugPrint(f'timer starting with unknown speed for state/minorstate: {k}')
natlinktimer.setTimerCallback(self.onTimer, defaultSpeed)
natlinktimer.setTimerCallback(self.onTimer, defaultSpeed, callAtMicOff=self.cancelMode)

self.inTimer = 1

Expand Down Expand Up @@ -908,16 +908,13 @@ def findKeyWord(list1,list2):
return None

startTime = time.time()
if DEBUG:
fOutName = 'c:\\DEBUG '+__name__+'.txt'
debugFile = open(fOutName, 'w', encoding='utf8')
print(f'DEBUG uitvoer naar: {fOutName}')

def debugPrint(t):
if not DEBUG: return
debugFile.write(t)
debugFile.write('\n')
debugFile.flush()
print(t)
# debugFile.write(t)
# debugFile.write('\n')
# debugFile.flush()


iconDirectory = os.path.join(status.getUnimacroDirectory(), 'icons')
Expand All @@ -937,11 +934,11 @@ def unload():
if thisGrammar: thisGrammar.unload()
thisGrammar = None

def changeCallback(type,args):
# not active without special version of natlinkmain,
# call the cancelMode, to switch off exclusive mode when mic toggles:
if ((type == 'mic') and (args=='on')):
return # check WAS in natlinkmain...
if thisGrammar:
thisGrammar.cancelMode()
# def changeCallback(type,args):
# # not active without special version of natlinkmain,
# # call the cancelMode, to switch off exclusive mode when mic toggles:
# if ((type == 'mic') and (args=='on')):
# return # check WAS in natlinkmain...
# if thisGrammar:
# thisGrammar.cancelMode()

0 comments on commit dad81e9

Please sign in to comment.