initial rebuild of onInput commands

This commit is contained in:
Chrys 2016-08-03 19:43:36 +02:00
parent 03722148f8
commit 592be62188
3 changed files with 71 additions and 0 deletions

View File

@ -0,0 +1,24 @@
#!/bin/python
class command():
def __init__(self):
pass
def run(self, environment):
if not environment['runtime']['settingsManager'].getSettingAsBool(environment, 'keyboard', 'charEcho'):
return environment
if environment['screenData']['newCursor']['x'] <= environment['screenData']['oldCursor']['x']:
return environment
if environment['screenData']['newTTY'] != environment['screenData']['oldTTY']:
return environment
if environment['screenData']['newDelta'] == environment['screenData']['oldDelta']:
return environment
environment['runtime']['outputManager'].presentText(environment, environment['screenData']['newDelta'], interrupt=True)
return environment
def setCallback(self, callback):
pass
def shutdown(self):
pass

View File

@ -0,0 +1,30 @@
#!/bin/python
from utils import word_utils
class command():
def __init__(self):
pass
def run(self, environment):
if not environment['runtime']['settingsManager'].getSettingAsBool(environment, 'keyboard', 'wordEcho') and\
environment['screenData']['newCursor']['x'] <= environment['screenData']['oldCursor']['x']:
return environment
if environment['screenData']['newTTY'] != environment['screenData']['oldTTY']:
return environment
if environment['screenData']['newDelta'] == environment['screenData']['oldDelta']:
return environment
newContent = environment['screenData']['newContentText'].split('\n')[environment['screenData']['newCursor']['y']]
x, y, currWord = word_utils.getCurrentWord(environment['screenData']['newCursorReview']['x'], 0, newContent)
if environment['screenData']['newCursor']['x'] > 0 and \
newContent[environment['screenData']['newCursor']['x'] - 1] == ' ':
environment['runtime']['outputManager'].presentText(environment, currWord, interrupt=True)
return environment
def setCallback(self, callback):
pass
def shutdown(self):
pass

View File

@ -0,0 +1,17 @@
#!/bin/python
class command():
def __init__(self):
pass
def run(self, environment):
if environment['screenData']['newTTY'] == environment['screenData']['oldTTY']:
return environment
environment['runtime']['outputManager'].playSoundIcon(environment,'ChangeTTY')
environment['runtime']['outputManager'].presentText(environment, environment['screenData']['newDelta'], interrupt=True)
return environment
def setCallback(self, callback):
pass
def shutdown(self):
pass