initial word echo

This commit is contained in:
chrys 2016-08-06 14:12:29 +02:00
parent cea7fe6c5b
commit e5ffd128b7
6 changed files with 24 additions and 62 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,8 +22,8 @@ driver=linux
[keyboard] [keyboard]
keyboardLayout=desktop keyboardLayout=desktop
charEcho=False charEcho=True
wordEcho=False wordEcho=True
interruptOnKeyPress=False interruptOnKeyPress=False
[general] [general]

View File

@ -5,7 +5,9 @@ class command():
pass pass
def run(self, environment): def run(self, environment):
if not environment['runtime']['settingsManager'].getSettingAsBool(environment, 'keyboard', 'interruptOnKeyPress'): if not environment['runtime']['settingsManager'].getSettingAsBool(environment, 'keyboard', 'interruptOnKeyPress'):
return environment return environment
if environment['screenData']['newTTY'] != environment['screenData']['oldTTY']:
return environment
# if environment['screenData']['newCursor'] == environment['screenData']['oldCursor'] and\ # if environment['screenData']['newCursor'] == environment['screenData']['oldCursor'] and\
# environment['screenData']['newDelta'] == environment['screenData']['oldDelta']: # environment['screenData']['newDelta'] == environment['screenData']['oldDelta']:
# return environment # return environment

View File

@ -1,23 +0,0 @@
#!/bin/python
import time
class command():
def __init__(self):
pass
def run(self, 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,20 +0,0 @@
#!/bin/python
class command():
def __init__(self):
pass
def run(self, 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,20 +5,23 @@ class command():
def __init__(self): def __init__(self):
pass pass
def run(self, environment): def run(self, environment):
return environment #return environment
if not environment['runtime']['settingsManager'].getSettingAsBool(environment, 'keyboard', 'wordEcho') and\ if not environment['runtime']['settingsManager'].getSettingAsBool(environment, 'keyboard', 'wordEcho'):
environment['screenData']['newCursor']['x'] <= environment['screenData']['oldCursor']['x']: return environment
if environment['screenData']['newCursor']['x'] <= environment['screenData']['oldCursor']['x']:
return environment return environment
#if environment['screenData']['newTTY'] != environment['screenData']['oldTTY']: if environment['screenData']['newTTY'] != environment['screenData']['oldTTY']:
# return environment return environment
#print('drin')
if environment['screenData']['newDelta'] == environment['screenData']['oldDelta']: if environment['screenData']['newDelta'] == environment['screenData']['oldDelta'] and \
environment['screenData']['newNegativeDelta'] == '':
return environment return environment
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(len(currWord) + x + 2, environment['screenData']['newCursor']['x'],'|',newContent[environment['screenData']['newCursor']['x'] - 1],'|',x, y, currWord) print('|',environment['screenData']['newNegativeDelta'] ,'|',len(currWord) + x + 2, environment['screenData']['newCursor']['x'],'|',newContent[environment['screenData']['newCursor']['x'] - 1],'|',x, y, currWord)
print(newContent ) print(newContent )
#len(currWord) + x + 2 == environment['screenData']['newCursor']['x']: #len(currWord) + x + 2 == environment['screenData']['newCursor']['x']:
if environment['screenData']['newCursor']['x'] > 0 and \ if environment['screenData']['newCursor']['x'] > 0 and \

View File

@ -27,7 +27,7 @@ class sound:
self._player.set_state(Gst.State.NULL) self._player.set_state(Gst.State.NULL)
error, info = message.parse_error() error, info = message.parse_error()
print(error, info) print(error, info)
print('drin') print('_onPlayerMessage')
def _onPipelineMessage(self, bus, message): def _onPipelineMessage(self, bus, message):
if message.type == Gst.MessageType.EOS: if message.type == Gst.MessageType.EOS:
self._pipeline.set_state(Gst.State.NULL) self._pipeline.set_state(Gst.State.NULL)
@ -35,7 +35,7 @@ class sound:
self._pipeline.set_state(Gst.State.NULL) self._pipeline.set_state(Gst.State.NULL)
error, info = message.parse_error() error, info = message.parse_error()
print(error, info) print(error, info)
print('drin') print('_onPipelineMessage')
def _onTimeout(self, element): def _onTimeout(self, element):
element.set_state(Gst.State.NULL) element.set_state(Gst.State.NULL)
@ -46,7 +46,7 @@ class sound:
self.cancel() self.cancel()
self._player.set_property('uri', 'file://%s' % fileName) self._player.set_property('uri', 'file://%s' % fileName)
self._player.set_state(Gst.State.PLAYING) self._player.set_state(Gst.State.PLAYING)
print('playSoundFile')
def playFrequence(self, frequence, duration, adjustVolume, interrupt=True): def playFrequence(self, frequence, duration, adjustVolume, interrupt=True):
if interrupt: if interrupt:
self.cancel() self.cancel()