polish word echo

This commit is contained in:
chrys 2016-08-06 14:43:00 +02:00
parent 54b2682d03
commit 30155b6d83
4 changed files with 57 additions and 7 deletions

View File

@ -23,7 +23,7 @@ driver=linux
[keyboard] [keyboard]
keyboardLayout=desktop keyboardLayout=desktop
charEcho=False charEcho=False
wordEcho=False wordEcho=True
interruptOnKeyPress=False interruptOnKeyPress=False
[general] [general]

View File

@ -0,0 +1,24 @@
#!/bin/python
import time
class command():
def __init__(self):
pass
def run(self, environment):
if environment['screenData']['newTTY'] != environment['screenData']['oldTTY']:
return environment
if environment['screenData']['newDelta'] != environment['screenData']['oldDelta']:
return environment
if environment['screenData']['newCursor']['y'] != environment['screenData']['oldCursor']['y'] or\
environment['screenData']['newCursor']['x'] == environment['screenData']['oldCursor']['x']:
return environment
if environment['screenData']['newContentText'].split('\n')[environment['screenData']['newCursor']['y']][environment['screenData']['newCursor']['x']].strip(" \t\n") == '':
pass
#environment['runtime']['outputManager'].presentText(environment, "blank",True)
else:
environment['runtime']['outputManager'].presentText(environment, environment['screenData']['newContentText'].split('\n')[environment['screenData']['newCursor']['y']][environment['screenData']['newCursor']['x']],interrupt=True)
return environment
def setCallback(self, callback):
pass
def shutdown(self):
pass

View File

@ -0,0 +1,21 @@
#!/bin/python
class command():
def __init__(self):
pass
def run(self, environment):
if environment['screenData']['newTTY'] != environment['screenData']['oldTTY']:
return environment
if environment['screenData']['newDelta'] != environment['screenData']['oldDelta']:
return environment
if environment['screenData']['newCursor']['y'] == environment['screenData']['oldCursor']['y']:
return environment
if environment['screenData']['newContentText'].split('\n')[environment['screenData']['newCursor']['y']].strip(" \t\n") == '':
environment['runtime']['outputManager'].presentText(environment, "blank", soundIconName='EmptyLine', interrupt=True)
else:
environment['runtime']['outputManager'].presentText(environment, environment['screenData']['newContentText'].split('\n')[environment['screenData']['newCursor']['y']], True)
return environment
def setCallback(self, callback):
pass
def shutdown(self):
pass

View File

@ -5,29 +5,34 @@ class command():
def __init__(self): def __init__(self):
pass pass
def run(self, environment): def run(self, environment):
#return environment
if not environment['runtime']['settingsManager'].getSettingAsBool(environment, 'keyboard', 'wordEcho'): if not environment['runtime']['settingsManager'].getSettingAsBool(environment, 'keyboard', 'wordEcho'):
return environment return environment
# just when typing is a new word
if environment['screenData']['newCursor']['x'] <= environment['screenData']['oldCursor']['x']: if environment['screenData']['newCursor']['x'] <= environment['screenData']['oldCursor']['x']:
return environment return environment
# TTY Change is no new word
if environment['screenData']['newTTY'] != environment['screenData']['oldTTY']: if environment['screenData']['newTTY'] != environment['screenData']['oldTTY']:
return environment return environment
# here we just arrow arround (left right) no changes
if environment['screenData']['newDelta'] == environment['screenData']['oldDelta'] and \ if environment['screenData']['newDelta'] == environment['screenData']['oldDelta'] and \
environment['screenData']['newNegativeDelta'] == '': environment['screenData']['newNegativeDelta'] == '':
return environment
# this is not the end of the word
if environment['screenData']['newDelta'] == environment['screenData']['oldDelta'] and \
environment['screenData']['newNegativeDelta'] != ' ':
return environment return environment
# japp its a finished word... announce it:x
newContent = environment['screenData']['newContentText'].split('\n')[environment['screenData']['newCursor']['y']] newContent = environment['screenData']['newContentText'].split('\n')[environment['screenData']['newCursor']['y']]
x, y, currWord = word_utils.getCurrentWord(environment['screenData']['newCursor']['x'], 0, newContent) x, y, currWord = word_utils.getCurrentWord(environment['screenData']['newCursor']['x'], 0, newContent)
print('|',environment['screenData']['newNegativeDelta'] ,'|',len(currWord) + x + 2, environment['screenData']['newCursor']['x'],'|',newContent[environment['screenData']['newCursor']['x'] - 1],'|',x, y, currWord)
print(newContent )
#len(currWord) + x + 2 == environment['screenData']['newCursor']['x']:
if environment['screenData']['newCursor']['x'] > 0 and \ if environment['screenData']['newCursor']['x'] > 0 and \
newContent[environment['screenData']['newCursor']['x']- 1] == ' ': newContent[environment['screenData']['newCursor']['x']- 1] == ' ':
environment['runtime']['outputManager'].presentText(environment, currWord, interrupt=True) environment['runtime']['outputManager'].presentText(environment, currWord, interrupt=True)
print('word')
return environment return environment
def setCallback(self, callback): def setCallback(self, callback):
pass pass