remove unneded returns from onScreenUpdate commands
This commit is contained in:
parent
30f579f12b
commit
2aaa242479
@ -4,30 +4,29 @@ class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
return environment
|
||||
pass
|
||||
def shutdown(self, environment):
|
||||
return environment
|
||||
pass
|
||||
def getDescription(self, environment):
|
||||
return ''
|
||||
|
||||
def run(self, environment):
|
||||
if not environment['runtime']['settingsManager'].getSettingAsBool(environment, 'keyboard', 'charEcho'):
|
||||
return environment
|
||||
return
|
||||
# detect deletion or chilling
|
||||
if environment['screenData']['newCursor']['x'] <= environment['screenData']['oldCursor']['x']:
|
||||
return environment
|
||||
return
|
||||
# TTY Change
|
||||
if environment['screenData']['newTTY'] != environment['screenData']['oldTTY']:
|
||||
return environment
|
||||
return
|
||||
# is there any change?
|
||||
if environment['screenData']['newDelta'] == '':
|
||||
return environment
|
||||
return
|
||||
# big changes are no char (but the value is bigger than one maybe the differ needs longer than you can type, so a little strange random buffer for now)
|
||||
if len(environment['screenData']['newDelta']) > 3:
|
||||
return environment
|
||||
return
|
||||
environment['runtime']['outputManager'].presentText(environment, environment['screenData']['newDelta'], interrupt=True)
|
||||
|
||||
return environment
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
||||
|
@ -5,33 +5,33 @@ class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
return environment
|
||||
pass
|
||||
def shutdown(self, environment):
|
||||
return environment
|
||||
pass
|
||||
def getDescription(self, environment):
|
||||
return ''
|
||||
|
||||
def run(self, environment):
|
||||
if not environment['runtime']['settingsManager'].getSettingAsBool(environment, 'keyboard', 'wordEcho'):
|
||||
return environment
|
||||
return
|
||||
|
||||
# just when cursor move worddetection is needed
|
||||
if environment['screenData']['newCursor']['x'] == environment['screenData']['oldCursor']['x']:
|
||||
return environment
|
||||
return
|
||||
|
||||
# for now no new line
|
||||
if environment['screenData']['newCursor']['y'] != environment['screenData']['oldCursor']['y']:
|
||||
return environment
|
||||
if len(environment['screenData']['newDelta']) > 1:
|
||||
return environment
|
||||
return
|
||||
|
||||
# TTY Change is no new word
|
||||
if environment['screenData']['newTTY'] != environment['screenData']['oldTTY']:
|
||||
return environment
|
||||
return
|
||||
|
||||
# first place could not be the end of a word
|
||||
if environment['screenData']['newCursor']['x'] == 0:
|
||||
return environment
|
||||
return
|
||||
|
||||
# get the word
|
||||
newContent = environment['screenData']['newContentText'].split('\n')[environment['screenData']['newCursor']['y']]
|
||||
@ -39,16 +39,15 @@ class command():
|
||||
# was this a typed word?
|
||||
if environment['screenData']['newDelta'] != '':
|
||||
if not(newContent[environment['screenData']['oldCursor']['x']].strip() == '' and x != environment['screenData']['oldCursor']['x']):
|
||||
return environment
|
||||
return
|
||||
else:
|
||||
# or just arrow arround?
|
||||
if not(newContent[environment['screenData']['newCursor']['x']].strip() == '' and x != environment['screenData']['newCursor']['x']):
|
||||
return environment
|
||||
return
|
||||
|
||||
if currWord != '':
|
||||
environment['runtime']['outputManager'].presentText(environment, currWord, interrupt=True)
|
||||
|
||||
return environment
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
||||
|
@ -12,42 +12,42 @@ class command():
|
||||
self.language = ''
|
||||
self.spellChecker = ''
|
||||
def initialize(self, environment):
|
||||
return environment
|
||||
pass
|
||||
def shutdown(self, environment):
|
||||
return environment
|
||||
pass
|
||||
def getDescription(self, environment):
|
||||
return 'No Description found'
|
||||
|
||||
def run(self, environment):
|
||||
if not environment['runtime']['settingsManager'].getSettingAsBool(environment, 'general', 'autoSpellCheck'):
|
||||
return environment
|
||||
return
|
||||
|
||||
if not initialized:
|
||||
return environment
|
||||
return
|
||||
if environment['runtime']['settingsManager'].getSetting(environment, 'general', 'spellCheckLanguage') != self.language:
|
||||
try:
|
||||
self.spellChecker = enchant.Dict(environment['runtime']['settingsManager'].getSetting(environment, 'general', 'spellCheckLanguage'))
|
||||
self.language = environment['runtime']['settingsManager'].getSetting(environment, 'general', 'spellCheckLanguage')
|
||||
except:
|
||||
return environment
|
||||
return
|
||||
|
||||
# just when cursor move worddetection is needed
|
||||
if environment['screenData']['newCursor']['x'] == environment['screenData']['oldCursor']['x']:
|
||||
return environment
|
||||
return
|
||||
|
||||
# for now no new line
|
||||
if environment['screenData']['newCursor']['y'] != environment['screenData']['oldCursor']['y']:
|
||||
return environment
|
||||
return
|
||||
if len(environment['screenData']['newDelta']) > 1:
|
||||
return environment
|
||||
return
|
||||
|
||||
# TTY Change is no new word
|
||||
if environment['screenData']['newTTY'] != environment['screenData']['oldTTY']:
|
||||
return environment
|
||||
return
|
||||
|
||||
# first place could not be the end of a word
|
||||
if environment['screenData']['newCursor']['x'] == 0:
|
||||
return environment
|
||||
return
|
||||
|
||||
# get the word
|
||||
newContent = environment['screenData']['newContentText'].split('\n')[environment['screenData']['newCursor']['y']]
|
||||
@ -55,16 +55,15 @@ class command():
|
||||
# was this a typed word?
|
||||
if environment['screenData']['newDelta'] != '':
|
||||
if not(newContent[environment['screenData']['oldCursor']['x']].strip() == '' and x != environment['screenData']['oldCursor']['x']):
|
||||
return environment
|
||||
return
|
||||
else:
|
||||
# or just arrow arround?
|
||||
if not(newContent[environment['screenData']['newCursor']['x']].strip() == '' and x != environment['screenData']['newCursor']['x']):
|
||||
return environment
|
||||
return
|
||||
|
||||
if currWord != '':
|
||||
if not self.spellChecker.check(currWord):
|
||||
environment['runtime']['outputManager'].presentText(environment, 'misspelled',soundIcon='mispell', interrupt=True)
|
||||
|
||||
return environment
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -4,37 +4,37 @@ class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
return environment
|
||||
pass
|
||||
def shutdown(self, environment):
|
||||
return environment
|
||||
pass
|
||||
def getDescription(self, environment):
|
||||
return ''
|
||||
|
||||
def run(self, environment):
|
||||
if not environment['runtime']['settingsManager'].getSettingAsBool(environment, 'keyboard', 'charDeleteEcho'):
|
||||
return environment
|
||||
return
|
||||
|
||||
# detect typing or chilling
|
||||
if environment['screenData']['newCursor']['x'] >= environment['screenData']['oldCursor']['x']:
|
||||
return environment
|
||||
return
|
||||
|
||||
# TTY change
|
||||
if environment['screenData']['newTTY'] != environment['screenData']['oldTTY']:
|
||||
return environment
|
||||
return
|
||||
|
||||
# More than just a deletion happend
|
||||
if environment['screenData']['newDelta'].strip() != '':
|
||||
if environment['screenData']['newDelta'] != environment['screenData']['oldDelta']:
|
||||
return environment
|
||||
return
|
||||
|
||||
# No deletion
|
||||
if environment['screenData']['newNegativeDelta'] == '':
|
||||
return environment
|
||||
return
|
||||
# too much for a single backspace...
|
||||
if len(environment['screenData']['newNegativeDelta']) >= 5:
|
||||
return environment
|
||||
return
|
||||
environment['runtime']['outputManager'].presentText(environment, environment['screenData']['newNegativeDelta'], interrupt=True)
|
||||
return environment
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
||||
|
@ -4,29 +4,28 @@ class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
return environment
|
||||
pass
|
||||
def shutdown(self, environment):
|
||||
return environment
|
||||
pass
|
||||
def getDescription(self, environment):
|
||||
return ''
|
||||
|
||||
def run(self, environment):
|
||||
if not environment['runtime']['settingsManager'].getSettingAsBool(environment, 'speech', 'autoReadIncomming'):
|
||||
return environment
|
||||
return
|
||||
# is there something to read?
|
||||
if environment['screenData']['newDelta'] == '':
|
||||
return environment
|
||||
return
|
||||
# dont read TTY change
|
||||
if environment['screenData']['newTTY'] != environment['screenData']['oldTTY']:
|
||||
return environment
|
||||
return
|
||||
# its a cursor movement (experimental) - maybe also check current shortcut string?
|
||||
if abs(environment['screenData']['newCursor']['x'] - environment['screenData']['oldCursor']['x']) >= 1:
|
||||
if len(environment['screenData']['newDelta']) <= 5:
|
||||
return environment
|
||||
return
|
||||
|
||||
environment['runtime']['outputManager'].presentText(environment, environment['screenData']['newDelta'], interrupt=False)
|
||||
|
||||
return environment
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
||||
|
@ -5,30 +5,29 @@ class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
return environment
|
||||
pass
|
||||
def shutdown(self, environment):
|
||||
return environment
|
||||
pass
|
||||
def getDescription(self, environment):
|
||||
return ''
|
||||
|
||||
def run(self, environment):
|
||||
if not environment['runtime']['settingsManager'].getSettingAsBool(environment, 'promote', 'enabled'):
|
||||
return environment
|
||||
return
|
||||
if environment['screenData']['newTTY'] != environment['screenData']['oldTTY']:
|
||||
return environment
|
||||
return
|
||||
if environment['screenData']['newDelta'] == '':
|
||||
return environment
|
||||
return
|
||||
if int(time.time() - environment['input']['lastInputTime']) < environment['runtime']['settingsManager'].getSettingAsInt(environment, 'promote', 'inactiveTimeoutSec'):
|
||||
return environment
|
||||
return
|
||||
if len(environment['runtime']['settingsManager'].getSetting(environment, 'promote', 'list')) == 0:
|
||||
return environment
|
||||
return
|
||||
for promote in environment['runtime']['settingsManager'].getSetting(environment, 'promote', 'list').split(','):
|
||||
if promote in environment['screenData']['newDelta']:
|
||||
environment['runtime']['outputManager'].playSoundIcon(environment,'PromotedText')
|
||||
environment['input']['lastInputTime'] = time.time()
|
||||
return environment
|
||||
return
|
||||
|
||||
return environment
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
||||
|
@ -4,19 +4,18 @@ class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
return environment
|
||||
pass
|
||||
def shutdown(self, environment):
|
||||
return environment
|
||||
pass
|
||||
def getDescription(self, environment):
|
||||
return ''
|
||||
|
||||
def run(self, environment):
|
||||
if environment['screenData']['newTTY'] == environment['screenData']['oldTTY']:
|
||||
return environment
|
||||
return
|
||||
environment['runtime']['outputManager'].presentText(environment, "screen " + str(environment['screenData']['newTTY']),soundIcon='ChangeTTY', interrupt=True)
|
||||
environment['runtime']['outputManager'].presentText(environment, environment['screenData']['newDelta'], interrupt=False)
|
||||
|
||||
return environment
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
||||
|
@ -4,19 +4,19 @@ class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
return environment
|
||||
pass
|
||||
def shutdown(self, environment):
|
||||
return environment
|
||||
pass
|
||||
def getDescription(self, environment):
|
||||
return ''
|
||||
|
||||
def run(self, environment):
|
||||
if environment['screenData']['newTTY'] == environment['screenData']['oldTTY']:
|
||||
return environment
|
||||
return
|
||||
environment['commandBuffer']['Marks']['1'] = None
|
||||
environment['commandBuffer']['Marks']['2'] = None
|
||||
environment['commandBuffer']['Marks']['3'] = None
|
||||
return environment
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
||||
|
@ -4,17 +4,17 @@ class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
return environment
|
||||
pass
|
||||
def shutdown(self, environment):
|
||||
return environment
|
||||
pass
|
||||
def getDescription(self, environment):
|
||||
return ''
|
||||
|
||||
def run(self, environment):
|
||||
if environment['screenData']['newTTY'] == environment['screenData']['oldTTY']:
|
||||
return environment
|
||||
return
|
||||
environment['screenData']['oldCursorReview'] = None
|
||||
environment['screenData']['newCursorReview'] = None
|
||||
return environment
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
Loading…
Reference in New Issue
Block a user