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]
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

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')))
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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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

View File

@ -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(environment, "Quit Fenrir", soundIcon= 'ScreenReaderOff', interrupt=True)
time.sleep(1)
if self.environment['runtime']['speechDriver'] != None:
self.environment['runtime']['speechDriver'].shutdown()
self.environment['runtime']['outputManager'].presentText(self.environment, "Quit Fenrir", soundIcon='ScreenReaderOff', interrupt=True)
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()