fix things

This commit is contained in:
chrys 2016-08-10 15:30:43 +02:00
parent ed27566474
commit 7b4be74688
9 changed files with 30 additions and 29 deletions

View File

@ -6,12 +6,12 @@ volume=1.0
[speech] [speech]
enabled=True enabled=True
driver=espeak driver=speechd
rate=0.75 rate=0.75
pitch=0.5 pitch=0.5
module=espeak module=espeak
voice=en-us voice=de
language=en-us language=de
volume=1.0 volume=1.0
autoReadIncomming=True autoReadIncomming=True
@ -28,7 +28,7 @@ device=all
grabDevices=True grabDevices=True
ignoreShortcuts=False ignoreShortcuts=False
keyboardLayout=desktop keyboardLayout=desktop
charEcho=False charEcho=True
charDeleteEcho=True charDeleteEcho=True
wordEcho=True wordEcho=True
interruptOnKeyPress=False interruptOnKeyPress=False

View File

@ -7,9 +7,9 @@ class command():
environment = environment['runtime']['settingsManager'].setSetting(environment, 'speech', 'autoReadIncomming', str(not environment['runtime']['settingsManager'].getSettingAsBool(environment, 'speech', 'autoReadIncomming'))) environment = environment['runtime']['settingsManager'].setSetting(environment, 'speech', 'autoReadIncomming', str(not environment['runtime']['settingsManager'].getSettingAsBool(environment, 'speech', 'autoReadIncomming')))
if environment['runtime']['settingsManager'].getSettingAsBool(environment, 'speech', 'autoReadIncomming'): if environment['runtime']['settingsManager'].getSettingAsBool(environment, 'speech', 'autoReadIncomming'):
environment['runtime']['outputManager'].presentText(environment, "autoread enabled", soundIconName='', interrupt=True) environment['runtime']['outputManager'].presentText(environment, "autoread enabled", soundIcon='', interrupt=True)
else: else:
environment['runtime']['outputManager'].presentText(environment, "autoread disabled", soundIconName='', interrupt=True) environment['runtime']['outputManager'].presentText(environment, "autoread disabled", soundIcon='', interrupt=True)
return environment return environment
def setCallback(self, callback): def setCallback(self, callback):
pass pass

View File

@ -6,10 +6,10 @@ class command():
def run(self, environment): def run(self, environment):
if environment['runtime']['settingsManager'].getSettingAsBool(environment, 'braille', 'enabled'): if environment['runtime']['settingsManager'].getSettingAsBool(environment, 'braille', 'enabled'):
environment['runtime']['outputManager'].presentText(environment, "braille disabled", soundIconName='BrailleOff', interrupt=True) environment['runtime']['outputManager'].presentText(environment, "braille disabled", soundIcon='BrailleOff', interrupt=True)
environment = environment['runtime']['settingsManager'].setSetting(environment, 'braille', 'enabled', str(not environment['runtime']['settingsManager'].getSettingAsBool(environment, 'braille', 'enabled'))) environment = environment['runtime']['settingsManager'].setSetting(environment, 'braille', 'enabled', str(not environment['runtime']['settingsManager'].getSettingAsBool(environment, 'braille', 'enabled')))
if environment['runtime']['settingsManager'].getSettingAsBool(environment, 'braille', 'enabled'): if environment['runtime']['settingsManager'].getSettingAsBool(environment, 'braille', 'enabled'):
environment['runtime']['outputManager'].presentText(environment, "braille enabled", soundIconName='BrailleOn', interrupt=True) environment['runtime']['outputManager'].presentText(environment, "braille enabled", soundIcon='BrailleOn', interrupt=True)
return environment return environment
def setCallback(self, callback): def setCallback(self, callback):
pass pass

View File

@ -7,7 +7,7 @@ class command():
if environment['runtime']['settingsManager'].getSettingAsBool(environment, 'speech', 'enabled') or \ if environment['runtime']['settingsManager'].getSettingAsBool(environment, 'speech', 'enabled') or \
environment['runtime']['settingsManager'].getSettingAsBool(environment, 'sound', 'enabled') or \ environment['runtime']['settingsManager'].getSettingAsBool(environment, 'sound', 'enabled') or \
environment['runtime']['settingsManager'].getSettingAsBool(environment, 'braille', 'enabled'): environment['runtime']['settingsManager'].getSettingAsBool(environment, 'braille', 'enabled'):
environment['runtime']['outputManager'].presentText(environment, "fenrir muted", soundIconName='Accept', interrupt=True) environment['runtime']['outputManager'].presentText(environment, "fenrir muted", soundIcon='Accept', interrupt=True)
environment = environment['runtime']['settingsManager'].setSetting(environment, 'speech', 'enabled','False') environment = environment['runtime']['settingsManager'].setSetting(environment, 'speech', 'enabled','False')
environment = environment['runtime']['settingsManager'].setSetting(environment, 'sound', 'enabled','False') environment = environment['runtime']['settingsManager'].setSetting(environment, 'sound', 'enabled','False')
environment = environment['runtime']['settingsManager'].setSetting(environment, 'braille', 'enabled','False') environment = environment['runtime']['settingsManager'].setSetting(environment, 'braille', 'enabled','False')
@ -15,7 +15,7 @@ class command():
environment = environment['runtime']['settingsManager'].setSetting(environment, 'speech', 'enabled','True') environment = environment['runtime']['settingsManager'].setSetting(environment, 'speech', 'enabled','True')
environment = environment['runtime']['settingsManager'].setSetting(environment, 'sound', 'enabled','True') environment = environment['runtime']['settingsManager'].setSetting(environment, 'sound', 'enabled','True')
environment = environment['runtime']['settingsManager'].setSetting(environment, 'braille', 'enabled','True') environment = environment['runtime']['settingsManager'].setSetting(environment, 'braille', 'enabled','True')
environment['runtime']['outputManager'].presentText(environment, "fenrir unmuted", soundIconName='Cancel', interrupt=True) environment['runtime']['outputManager'].presentText(environment, "fenrir unmuted", soundIcon='Cancel', interrupt=True)
return environment return environment
def setCallback(self, callback): def setCallback(self, callback):
pass pass

View File

@ -6,10 +6,10 @@ class command():
def run(self, environment): def run(self, environment):
if environment['runtime']['settingsManager'].getSettingAsBool(environment, 'sound', 'enabled'): if environment['runtime']['settingsManager'].getSettingAsBool(environment, 'sound', 'enabled'):
environment['runtime']['outputManager'].presentText(environment, "sound disabled", soundIconName='SoundOff', interrupt=True) environment['runtime']['outputManager'].presentText(environment, "sound disabled", soundIcon='SoundOff', interrupt=True)
environment = environment['runtime']['settingsManager'].setSetting(environment, 'sound', 'enabled', str(not environment['runtime']['settingsManager'].getSettingAsBool(environment, 'sound', 'enabled'))) environment = environment['runtime']['settingsManager'].setSetting(environment, 'sound', 'enabled', str(not environment['runtime']['settingsManager'].getSettingAsBool(environment, 'sound', 'enabled')))
if environment['runtime']['settingsManager'].getSettingAsBool(environment, 'sound', 'enabled'): if environment['runtime']['settingsManager'].getSettingAsBool(environment, 'sound', 'enabled'):
environment['runtime']['outputManager'].presentText(environment, "sound enabled", soundIconName='SoundOn', interrupt=True) environment['runtime']['outputManager'].presentText(environment, "sound enabled", soundIcon='SoundOn', interrupt=True)
return environment return environment
def setCallback(self, callback): def setCallback(self, callback):
pass pass

View File

@ -6,10 +6,10 @@ class command():
def run(self, environment): def run(self, environment):
if environment['runtime']['settingsManager'].getSettingAsBool(environment, 'speech', 'enabled'): if environment['runtime']['settingsManager'].getSettingAsBool(environment, 'speech', 'enabled'):
environment['runtime']['outputManager'].presentText(environment, "speech disabled", soundIconName='SpeechOff', interrupt=True) environment['runtime']['outputManager'].presentText(environment, "speech disabled", soundIcon='SpeechOff', interrupt=True)
environment = environment['runtime']['settingsManager'].setSetting(environment, 'speech', 'enabled', str(not environment['runtime']['settingsManager'].getSettingAsBool(environment, 'speech', 'enabled'))) environment = environment['runtime']['settingsManager'].setSetting(environment, 'speech', 'enabled', str(not environment['runtime']['settingsManager'].getSettingAsBool(environment, 'speech', 'enabled')))
if environment['runtime']['settingsManager'].getSettingAsBool(environment, 'speech', 'enabled'): if environment['runtime']['settingsManager'].getSettingAsBool(environment, 'speech', 'enabled'):
environment['runtime']['outputManager'].presentText(environment, "speech enabled", soundIconName='SpeechOn', interrupt=True) environment['runtime']['outputManager'].presentText(environment, "speech enabled", soundIcon='SpeechOn', interrupt=True)
return environment return environment
def setCallback(self, callback): def setCallback(self, callback):
pass pass

View File

@ -11,7 +11,7 @@ class command():
if environment['screenData']['newCursor']['y'] == environment['screenData']['oldCursor']['y']: if environment['screenData']['newCursor']['y'] == environment['screenData']['oldCursor']['y']:
return environment return environment
if environment['screenData']['newContentText'].split('\n')[environment['screenData']['newCursor']['y']].strip(" \t\n") == '': if environment['screenData']['newContentText'].split('\n')[environment['screenData']['newCursor']['y']].strip(" \t\n") == '':
environment['runtime']['outputManager'].presentText(environment, "blank", soundIconName='EmptyLine', interrupt=True) environment['runtime']['outputManager'].presentText(environment, "blank", soundIcon='EmptyLine', interrupt=True)
else: else:
environment['runtime']['outputManager'].presentText(environment, environment['screenData']['newContentText'].split('\n')[environment['screenData']['newCursor']['y']], True) environment['runtime']['outputManager'].presentText(environment, environment['screenData']['newContentText'].split('\n')[environment['screenData']['newCursor']['y']], True)

View File

@ -3,8 +3,8 @@
class outputManager(): class outputManager():
def __init__(self): def __init__(self):
pass pass
def presentText(self, environment, text, interrupt=True, soundIconName = ''): def presentText(self, environment, text, interrupt=True, soundIcon = ''):
if self.playSoundIcon(environment, soundIconName, interrupt): if self.playSoundIcon(environment, soundIcon, interrupt):
return return
self.speakText(environment, text, interrupt) self.speakText(environment, text, interrupt)
self.brailleText(environment, text, interrupt) self.brailleText(environment, text, interrupt)
@ -34,8 +34,8 @@ class outputManager():
environment['runtime']['speechDriver'].cancel() environment['runtime']['speechDriver'].cancel()
environment['runtime']['soundDriver'].cancel() environment['runtime']['soundDriver'].cancel()
def playSoundIcon(self, environment, soundIconName = '', interrupt=True): def playSoundIcon(self, environment, soundIcon = '', interrupt=True):
if soundIconName == '': if soundIcon == '':
return False return False
if not environment['runtime']['settingsManager'].getSettingAsBool(environment, 'sound', 'enabled'): if not environment['runtime']['settingsManager'].getSettingAsBool(environment, 'sound', 'enabled'):
return False return False
@ -43,8 +43,8 @@ class outputManager():
return False return False
try: try:
environment['runtime']['soundDriver'].setVolume(environment['runtime']['settingsManager'].getSettingAsFloat(environment, 'sound', 'volume')) environment['runtime']['soundDriver'].setVolume(environment['runtime']['settingsManager'].getSettingAsFloat(environment, 'sound', 'volume'))
environment['runtime']['soundDriver'].playSoundFile(environment['soundIcons'][soundIconName], interrupt) environment['runtime']['soundDriver'].playSoundFile(environment['soundIcons'][soundIcon], interrupt)
return True return True
except: except:
print('no icon there for' + soundIconName) pass
return False return False

View File

@ -21,7 +21,8 @@ class fenrir():
signal.signal(signal.SIGINT, self.captureSignal) signal.signal(signal.SIGINT, self.captureSignal)
def proceed(self): def proceed(self):
self.environment['runtime']['outputManager'].presentText(environment, "Start Fenrir", soundIcon= 'ScreenReaderOn', interrupt=True) self.environment['runtime']['outputManager'].presentText(self.environment, "Start Fenrir", soundIcon='ScreenReaderOn', interrupt=True)
time.sleep(1)# we need a is presenting methot for exact waiting
#self.threadonInput.start() #self.threadonInput.start()
while(self.environment['generalInformation']['running']): while(self.environment['generalInformation']['running']):
self.onInput() self.onInput()
@ -49,19 +50,19 @@ class fenrir():
def handleCommands(self): def handleCommands(self):
if (self.environment['commandInfo']['currCommand'] != ''): if (self.environment['commandInfo']['currCommand'] != ''):
self.environment = self.environment['runtime']['commandManager'].executeCommand(self.environment, self.environment['commandInfo']['currCommand'], 'commands') self.environment = self.environment['runtime']['commandManager'].executeCommand(self.environment, self.environment['commandInfo']['currCommand'], 'commands')
def shutdownRequest(self):
self.environment['generalInformation']['running'] = False
def shutdown(self): def shutdown(self):
self.environment['runtime']['outputManager'].presentText(environment, "Quit Fenrir", soundIcon= 'ScreenReaderOff', interrupt=True) self.environment['runtime']['outputManager'].presentText(self.environment, "Quit Fenrir", soundIcon='ScreenReaderOff', interrupt=True)
time.sleep(1)
if self.environment['runtime']['speechDriver'] != None:
self.environment['runtime']['speechDriver'].shutdown()
if self.environment['runtime']['debug'] != None: if self.environment['runtime']['debug'] != None:
self.environment['runtime']['debug'].closeDebugFile() self.environment['runtime']['debug'].closeDebugFile()
if self.environment['runtime']['soundDriver'] != None: if self.environment['runtime']['soundDriver'] != None:
self.environment['runtime']['soundDriver'].shutdown() self.environment['runtime']['soundDriver'].shutdown()
if self.environment['runtime']['speechDriver'] != None:
self.environment['runtime']['speechDriver'].shutdown()
def captureSignal(self, siginit, frame): def captureSignal(self, siginit, frame):
self.shutdown() self.shutdownRequest()
app = fenrir() app = fenrir()
app.proceed() app.proceed()