polish auto output

This commit is contained in:
chrys 2016-08-07 17:00:39 +02:00
parent a277c10dcd
commit 590623b61d
9 changed files with 10 additions and 186 deletions

View File

@ -5,13 +5,13 @@ theme=default
[speech] [speech]
enabled=True enabled=True
driver=espeak driver=speechd
rate=800 rate=50
volume=100
pitch=50 pitch=50
module=espeak module=espeak
voice=en-us voice=de
language=en-us language=de
volume=200
[braille] [braille]
enabled=False enabled=False
@ -22,7 +22,7 @@ driver=linux
[keyboard] [keyboard]
keyboardLayout=desktop keyboardLayout=desktop
charEcho=False charEcho=True
charDeleteEcho=True charDeleteEcho=True
wordEcho=True wordEcho=True
interruptOnKeyPress=False interruptOnKeyPress=False

View File

@ -1,24 +0,0 @@
#!/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

@ -1,21 +0,0 @@
#!/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

@ -1,25 +0,0 @@
#!/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

@ -1,40 +0,0 @@
#!/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'):
return environment
# just when typing is a new word
if environment['screenData']['newCursor']['x'] <= environment['screenData']['oldCursor']['x']:
return environment
# TTY Change is no new word
if environment['screenData']['newTTY'] != environment['screenData']['oldTTY']:
return environment
# here we just arrow arround (left right) no changes
if environment['screenData']['newDelta'] == environment['screenData']['oldDelta'] and \
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
# japp its a finished word... announce it:x
newContent = environment['screenData']['newContentText'].split('\n')[environment['screenData']['newCursor']['y']]
x, y, currWord = word_utils.getCurrentWord(environment['screenData']['newCursor']['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

@ -1,31 +0,0 @@
#!/bin/python
class command():
def __init__(self):
pass
def run(self, environment):
if not environment['runtime']['settingsManager'].getSettingAsBool(environment, 'keyboard', 'charDeleteEcho'):
return environment
# detect typing
if environment['screenData']['newCursor']['x'] > environment['screenData']['oldCursor']['x']:
return environment
# TTY change
if environment['screenData']['newTTY'] != environment['screenData']['oldTTY']:
return environment
# More than just a deletion happend
if environment['screenData']['newDelta'] != environment['screenData']['oldDelta']:
return environment
# No deletion
if environment['screenData']['newNegativeDelta'] == environment['screenData']['oldNegativeDelta']:
return environment
if environment['screenData']['newNegativeDelta'] == '':
return environment
environment['runtime']['outputManager'].presentText(environment, environment['screenData']['newNegativeDelta'], interrupt=True)
return environment
def setCallback(self, callback):
pass
def shutdown(self):
pass

View File

@ -1,21 +0,0 @@
#!/bin/python
class command():
def __init__(self):
pass
def run(self, 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=False)
return environment
def setCallback(self, callback):
pass
def shutdown(self):
pass

View File

@ -1,17 +0,0 @@
#!/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

View File

@ -80,7 +80,10 @@ class screen():
environment['screenData']['newContentText'][diffStart:].splitlines()) environment['screenData']['newContentText'][diffStart:].splitlines())
diffList = list(diff) diffList = list(diff)
environment['screenData']['newDelta'] = ''.join(x[2:] for x in diffList if x.startswith('+ ')) environment['screenData']['newDelta'] = ''.join(x[2:] for x in diffList if x.startswith('+ '))
environment['screenData']['newNegativeDelta'] = ''.join(x[2:] for x in diffList if x.startswith('- ')) environment['screenData']['newNegativeDelta'] = ''.join(x[2:] for x in diffList if x.startswith('- '))
else:
environment['screenData']['newNegativeDelta'] = ''
environment['screenData']['newDelta'] = ''
return environment return environment