From 7b4be74688921303bf0e75047833bcae4a496eb1 Mon Sep 17 00:00:00 2001 From: chrys Date: Wed, 10 Aug 2016 15:30:43 +0200 Subject: [PATCH] fix things --- config/settings/settings.conf | 8 ++++---- .../commands/commands/toggle_autoRead.py | 4 ++-- .../commands/commands/toggle_braille.py | 4 ++-- .../commands/commands/toggle_output.py | 4 ++-- .../commands/commands/toggle_sound.py | 4 ++-- .../commands/commands/toggle_speech.py | 4 ++-- ...00-present_line_if_cursor_change_vertical.py | 2 +- src/fenrir-package/core/outputManager.py | 12 ++++++------ src/fenrir-package/fenrir.py | 17 +++++++++-------- 9 files changed, 30 insertions(+), 29 deletions(-) diff --git a/config/settings/settings.conf b/config/settings/settings.conf index 0ea208d0..dfda5d78 100644 --- a/config/settings/settings.conf +++ b/config/settings/settings.conf @@ -6,12 +6,12 @@ volume=1.0 [speech] enabled=True -driver=espeak +driver=speechd rate=0.75 pitch=0.5 module=espeak -voice=en-us -language=en-us +voice=de +language=de volume=1.0 autoReadIncomming=True @@ -28,7 +28,7 @@ device=all grabDevices=True ignoreShortcuts=False keyboardLayout=desktop -charEcho=False +charEcho=True charDeleteEcho=True wordEcho=True interruptOnKeyPress=False diff --git a/src/fenrir-package/commands/commands/toggle_autoRead.py b/src/fenrir-package/commands/commands/toggle_autoRead.py index f88ed08b..c947d640 100644 --- a/src/fenrir-package/commands/commands/toggle_autoRead.py +++ b/src/fenrir-package/commands/commands/toggle_autoRead.py @@ -7,9 +7,9 @@ class command(): 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'): - environment['runtime']['outputManager'].presentText(environment, "autoread enabled", soundIconName='', interrupt=True) + environment['runtime']['outputManager'].presentText(environment, "autoread enabled", soundIcon='', interrupt=True) else: - environment['runtime']['outputManager'].presentText(environment, "autoread disabled", soundIconName='', interrupt=True) + environment['runtime']['outputManager'].presentText(environment, "autoread disabled", soundIcon='', interrupt=True) return environment def setCallback(self, callback): pass diff --git a/src/fenrir-package/commands/commands/toggle_braille.py b/src/fenrir-package/commands/commands/toggle_braille.py index 846c2326..f3451f7b 100644 --- a/src/fenrir-package/commands/commands/toggle_braille.py +++ b/src/fenrir-package/commands/commands/toggle_braille.py @@ -6,10 +6,10 @@ class command(): def run(self, environment): 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'))) 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 def setCallback(self, callback): pass diff --git a/src/fenrir-package/commands/commands/toggle_output.py b/src/fenrir-package/commands/commands/toggle_output.py index 2eb0fae9..62045c19 100644 --- a/src/fenrir-package/commands/commands/toggle_output.py +++ b/src/fenrir-package/commands/commands/toggle_output.py @@ -7,7 +7,7 @@ class command(): if environment['runtime']['settingsManager'].getSettingAsBool(environment, 'speech', 'enabled') or \ environment['runtime']['settingsManager'].getSettingAsBool(environment, 'sound', 'enabled') or \ 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, 'sound', '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, 'sound', '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 def setCallback(self, callback): pass diff --git a/src/fenrir-package/commands/commands/toggle_sound.py b/src/fenrir-package/commands/commands/toggle_sound.py index 7f9c7dd3..e103f5af 100644 --- a/src/fenrir-package/commands/commands/toggle_sound.py +++ b/src/fenrir-package/commands/commands/toggle_sound.py @@ -6,10 +6,10 @@ class command(): def run(self, environment): 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'))) 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 def setCallback(self, callback): pass diff --git a/src/fenrir-package/commands/commands/toggle_speech.py b/src/fenrir-package/commands/commands/toggle_speech.py index 8f844d11..f4e2af75 100644 --- a/src/fenrir-package/commands/commands/toggle_speech.py +++ b/src/fenrir-package/commands/commands/toggle_speech.py @@ -6,10 +6,10 @@ class command(): def run(self, environment): 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'))) 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 def setCallback(self, callback): pass diff --git a/src/fenrir-package/commands/onInput/55000-present_line_if_cursor_change_vertical.py b/src/fenrir-package/commands/onInput/55000-present_line_if_cursor_change_vertical.py index f554afc7..45ebcc67 100644 --- a/src/fenrir-package/commands/onInput/55000-present_line_if_cursor_change_vertical.py +++ b/src/fenrir-package/commands/onInput/55000-present_line_if_cursor_change_vertical.py @@ -11,7 +11,7 @@ class command(): 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) + environment['runtime']['outputManager'].presentText(environment, "blank", soundIcon='EmptyLine', interrupt=True) else: environment['runtime']['outputManager'].presentText(environment, environment['screenData']['newContentText'].split('\n')[environment['screenData']['newCursor']['y']], True) diff --git a/src/fenrir-package/core/outputManager.py b/src/fenrir-package/core/outputManager.py index cb04aa0e..b5822b3f 100644 --- a/src/fenrir-package/core/outputManager.py +++ b/src/fenrir-package/core/outputManager.py @@ -3,8 +3,8 @@ class outputManager(): def __init__(self): pass - def presentText(self, environment, text, interrupt=True, soundIconName = ''): - if self.playSoundIcon(environment, soundIconName, interrupt): + def presentText(self, environment, text, interrupt=True, soundIcon = ''): + if self.playSoundIcon(environment, soundIcon, interrupt): return self.speakText(environment, text, interrupt) self.brailleText(environment, text, interrupt) @@ -34,8 +34,8 @@ class outputManager(): environment['runtime']['speechDriver'].cancel() environment['runtime']['soundDriver'].cancel() - def playSoundIcon(self, environment, soundIconName = '', interrupt=True): - if soundIconName == '': + def playSoundIcon(self, environment, soundIcon = '', interrupt=True): + if soundIcon == '': return False if not environment['runtime']['settingsManager'].getSettingAsBool(environment, 'sound', 'enabled'): return False @@ -43,8 +43,8 @@ class outputManager(): return False try: 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 except: - print('no icon there for' + soundIconName) + pass return False diff --git a/src/fenrir-package/fenrir.py b/src/fenrir-package/fenrir.py index fe7120da..b6da6197 100755 --- a/src/fenrir-package/fenrir.py +++ b/src/fenrir-package/fenrir.py @@ -21,7 +21,8 @@ class fenrir(): signal.signal(signal.SIGINT, self.captureSignal) 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() while(self.environment['generalInformation']['running']): self.onInput() @@ -49,19 +50,19 @@ class fenrir(): def handleCommands(self): if (self.environment['commandInfo']['currCommand'] != ''): 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): + self.environment['runtime']['outputManager'].presentText(self.environment, "Quit Fenrir", soundIcon='ScreenReaderOff', interrupt=True) - def shutdown(self): - self.environment['runtime']['outputManager'].presentText(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: self.environment['runtime']['debug'].closeDebugFile() if self.environment['runtime']['soundDriver'] != None: self.environment['runtime']['soundDriver'].shutdown() - + if self.environment['runtime']['speechDriver'] != None: + self.environment['runtime']['speechDriver'].shutdown() def captureSignal(self, siginit, frame): - self.shutdown() + self.shutdownRequest() app = fenrir() app.proceed()