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