fix enable/disable commands
This commit is contained in:
parent
5677e3e0e8
commit
d6a6ad5583
@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
[sound]
|
[sound]
|
||||||
enabled=False,
|
enabled=False,
|
||||||
driver=sox
|
driver=sox
|
||||||
@ -5,19 +6,23 @@ theme=default
|
|||||||
|
|
||||||
[speech]
|
[speech]
|
||||||
enabled=True
|
enabled=True
|
||||||
driver=espeak
|
#driver=espeak
|
||||||
rate=800
|
#language=en-us
|
||||||
|
#voice=en-us
|
||||||
|
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
|
||||||
layout=en
|
layout=en
|
||||||
|
|
||||||
[screen]
|
['screen]
|
||||||
driver=linux
|
driver=linux
|
||||||
|
|
||||||
[keyboard]
|
[keyboard]
|
||||||
@ -28,3 +33,4 @@ wordEcho=True
|
|||||||
[general]
|
[general]
|
||||||
debugLevel=0
|
debugLevel=0
|
||||||
punctuationLevel=1
|
punctuationLevel=1
|
||||||
|
|
||||||
|
@ -1,36 +0,0 @@
|
|||||||
|
|
||||||
[sound]
|
|
||||||
enabled=False,
|
|
||||||
driver=sox
|
|
||||||
theme=default
|
|
||||||
|
|
||||||
[speech]
|
|
||||||
enabled=True
|
|
||||||
#driver=espeak
|
|
||||||
#language=en-us
|
|
||||||
#voice=en-us
|
|
||||||
driver=speechd
|
|
||||||
#rate=800
|
|
||||||
rate=50
|
|
||||||
volume=100
|
|
||||||
pitch=50
|
|
||||||
module=espeak
|
|
||||||
voice=de
|
|
||||||
language=de
|
|
||||||
|
|
||||||
[braille]
|
|
||||||
enabled=False
|
|
||||||
layout=en
|
|
||||||
|
|
||||||
['screen]
|
|
||||||
driver=linux
|
|
||||||
|
|
||||||
[keyboard]
|
|
||||||
keyboardLayout=desktop
|
|
||||||
charEcho=False
|
|
||||||
wordEcho=True
|
|
||||||
|
|
||||||
[general]
|
|
||||||
debugLevel=0
|
|
||||||
punctuationLevel=1
|
|
||||||
|
|
@ -4,11 +4,12 @@ class command():
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
def run(self, environment):
|
def run(self, environment):
|
||||||
environment['braille']['enabled'] = not environment['braille']['enabled']
|
|
||||||
if environment['braille']['enabled']:
|
if environment['runtime']['settingsManager'].getSettingAsBool(environment, 'braille', 'enabled'):
|
||||||
environment['runtime']['outputManager'].presentText(environment, "braille enabled")
|
|
||||||
else:
|
|
||||||
environment['runtime']['outputManager'].presentText(environment, "braille disabled")
|
environment['runtime']['outputManager'].presentText(environment, "braille disabled")
|
||||||
|
else:
|
||||||
|
environment['runtime']['outputManager'].presentText(environment, "braille enabled")
|
||||||
|
environment = environment['runtime']['settingsManager'].setSetting(environment, 'braille', 'enabled', str(not environment['runtime']['settingsManager'].getSettingAsBool(environment, 'braille', 'enabled')))
|
||||||
return environment
|
return environment
|
||||||
def setCallback(self, callback):
|
def setCallback(self, callback):
|
||||||
pass
|
pass
|
||||||
|
@ -4,18 +4,18 @@ class command():
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
def run(self, environment):
|
def run(self, environment):
|
||||||
if environment['speech']['enabled'] or \
|
if environment['runtime']['settingsManager'].getSettingAsBool(environment, 'speech', 'enabled') or \
|
||||||
environment['sound']['enabled'] or \
|
environment['runtime']['settingsManager'].getSettingAsBool(environment, 'sound', 'enabled') or \
|
||||||
environment['braille']['enabled']:
|
environment['runtime']['settingsManager'].getSettingAsBool(environment, 'braille', 'enabled'):
|
||||||
environment['runtime']['outputManager'].presentText(environment, "fenrir muted")
|
environment['runtime']['outputManager'].presentText(environment, "fenrir muted")
|
||||||
environment['speech']['enabled'] = False
|
environment = environment['runtime']['settingsManager'].setSetting(environment, 'speech', 'enabled','False')
|
||||||
environment['sound']['enabled'] = False
|
environment = environment['runtime']['settingsManager'].setSetting(environment, 'sound', 'enabled','False')
|
||||||
environment['braille']['enabled'] = False
|
environment = environment['runtime']['settingsManager'].setSetting(environment, 'braille', 'enabled','False')
|
||||||
else:
|
else:
|
||||||
environment['runtime']['outputManager'].presentText(environment, "fenrir unmuted")
|
environment['runtime']['outputManager'].presentText(environment, "fenrir unmuted")
|
||||||
environment['speech']['enabled'] = True
|
environment = environment['runtime']['settingsManager'].setSetting(environment, 'speech', 'enabled','True')
|
||||||
environment['sound']['enabled'] = True
|
environment = environment['runtime']['settingsManager'].setSetting(environment, 'sound', 'enabled','True')
|
||||||
environment['braille']['enabled'] = True
|
environment = environment['runtime']['settingsManager'].setSetting(environment, 'braille', 'enabled','True')
|
||||||
return environment
|
return environment
|
||||||
def setCallback(self, callback):
|
def setCallback(self, callback):
|
||||||
pass
|
pass
|
||||||
|
@ -4,11 +4,12 @@ class command():
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
def run(self, environment):
|
def run(self, environment):
|
||||||
environment['sound']['enabled'] = not environment['sound']['enabled']
|
|
||||||
if environment['sound']['enabled']:
|
if environment['runtime']['settingsManager'].getSettingAsBool(environment, 'sound', 'enabled'):
|
||||||
environment['runtime']['outputManager'].presentText(environment, "sound enabled")
|
|
||||||
else:
|
|
||||||
environment['runtime']['outputManager'].presentText(environment, "sound disabled")
|
environment['runtime']['outputManager'].presentText(environment, "sound disabled")
|
||||||
|
else:
|
||||||
|
environment['runtime']['outputManager'].presentText(environment, "sound enabled")
|
||||||
|
environment = environment['runtime']['settingsManager'].setSetting(environment, 'sound', 'enabled', str(not environment['runtime']['settingsManager'].getSettingAsBool(environment, 'sound', 'enabled')))
|
||||||
return environment
|
return environment
|
||||||
def setCallback(self, callback):
|
def setCallback(self, callback):
|
||||||
pass
|
pass
|
||||||
|
@ -4,11 +4,12 @@ class command():
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
def run(self, environment):
|
def run(self, environment):
|
||||||
environment['speech']['enabled'] = not environment['speech']['enabled']
|
|
||||||
if environment['speech']['enabled']:
|
if environment['runtime']['settingsManager'].getSettingAsBool(environment, 'speech', 'enabled'):
|
||||||
environment['runtime']['outputManager'].presentText(environment, "speech enabled")
|
|
||||||
else:
|
|
||||||
environment['runtime']['outputManager'].presentText(environment, "speech disabled")
|
environment['runtime']['outputManager'].presentText(environment, "speech disabled")
|
||||||
|
else:
|
||||||
|
environment['runtime']['outputManager'].presentText(environment, "speech enabled")
|
||||||
|
environment = environment['runtime']['settingsManager'].setSetting(environment, 'speech', 'enabled', str(not environment['runtime']['settingsManager'].getSettingAsBool(environment, 'speech', 'enabled')))
|
||||||
return environment
|
return environment
|
||||||
def setCallback(self, callback):
|
def setCallback(self, callback):
|
||||||
pass
|
pass
|
||||||
|
@ -41,56 +41,3 @@ class inputManager():
|
|||||||
currShortcutStringList = sorted(currShortcutStringList)
|
currShortcutStringList = sorted(currShortcutStringList)
|
||||||
return str(currShortcutStringList)[1:-1].replace(" ","").replace("'","")
|
return str(currShortcutStringList)[1:-1].replace(" ","").replace("'","")
|
||||||
|
|
||||||
def loadShortcuts(self, environment, kbConfigPath='../../config/keyboard/desktop.kb'):
|
|
||||||
kbConfig = open(kbConfigPath,"r")
|
|
||||||
while(True):
|
|
||||||
line = kbConfig.readline()
|
|
||||||
if not line:
|
|
||||||
break
|
|
||||||
line = line.replace('\n','')
|
|
||||||
if line.replace(" ","").startswith("#"):
|
|
||||||
continue
|
|
||||||
if line.split('#')[0].count("=") != 1:
|
|
||||||
continue
|
|
||||||
sepLine = line.split('#')[0].split('=')
|
|
||||||
commandString = sepLine[1]
|
|
||||||
keys = sepLine[0].replace(" ","").split(',')
|
|
||||||
currShortcut = []
|
|
||||||
validKeyString = True
|
|
||||||
for key in keys:
|
|
||||||
if len(key) < 3:
|
|
||||||
validKeyString = False
|
|
||||||
break
|
|
||||||
if not key[0] in ['0','1','2']:
|
|
||||||
validKeyString = False
|
|
||||||
break
|
|
||||||
if key[1] != '-':
|
|
||||||
validKeyString = False
|
|
||||||
break
|
|
||||||
if key[2:] != '':
|
|
||||||
keyInt = self.getCodeForKeyID(key[2:])
|
|
||||||
else:
|
|
||||||
validKeyString = False
|
|
||||||
break
|
|
||||||
if keyInt == 0:
|
|
||||||
validKeyString = False
|
|
||||||
break
|
|
||||||
if not validKeyString:
|
|
||||||
break
|
|
||||||
else:
|
|
||||||
currShortcut.append(key[0] + '-' + str(keyInt))
|
|
||||||
if validKeyString:
|
|
||||||
keyString = ''
|
|
||||||
for k in sorted(currShortcut):
|
|
||||||
if keyString != '':
|
|
||||||
keyString += ','
|
|
||||||
keyString += k
|
|
||||||
environment['bindings'][keyString] = commandString
|
|
||||||
kbConfig.close()
|
|
||||||
return environment
|
|
||||||
|
|
||||||
def getCodeForKeyID(self, keyID):
|
|
||||||
try:
|
|
||||||
return evdev.ecodes.ecodes[keyID.upper()]
|
|
||||||
except:
|
|
||||||
return 0
|
|
||||||
|
@ -72,6 +72,10 @@ class settingsManager():
|
|||||||
environment['settings'].read(settingConfigPath)
|
environment['settings'].read(settingConfigPath)
|
||||||
return environment
|
return environment
|
||||||
|
|
||||||
|
def setSetting(self, environment, section, setting, value):
|
||||||
|
environment['settings'].set(section, setting, value)
|
||||||
|
return environment
|
||||||
|
|
||||||
def getSetting(self, environment, section, setting):
|
def getSetting(self, environment, section, setting):
|
||||||
value = ''
|
value = ''
|
||||||
try:
|
try:
|
||||||
@ -81,7 +85,7 @@ class settingsManager():
|
|||||||
return value
|
return value
|
||||||
|
|
||||||
def getSettingAsInt(self, environment, section, setting):
|
def getSettingAsInt(self, environment, section, setting):
|
||||||
value = ''
|
value = 0
|
||||||
try:
|
try:
|
||||||
value = environment['settings'].getint(section, setting)
|
value = environment['settings'].getint(section, setting)
|
||||||
except:
|
except:
|
||||||
@ -89,14 +93,14 @@ class settingsManager():
|
|||||||
return value
|
return value
|
||||||
|
|
||||||
def getSettingAsFloat(self, environment, section, setting):
|
def getSettingAsFloat(self, environment, section, setting):
|
||||||
value = ''
|
value = 0.0
|
||||||
try:
|
try:
|
||||||
value = environment['settings'].getfloat(section, setting)
|
value = environment['settings'].getfloat(section, setting)
|
||||||
except:
|
except:
|
||||||
value = self.settings[section][setting]
|
value = self.settings[section][setting]
|
||||||
return value
|
return value
|
||||||
def getSettingAsBool(self, environment, section, setting):
|
def getSettingAsBool(self, environment, section, setting):
|
||||||
value = ''
|
value = False
|
||||||
try:
|
try:
|
||||||
value = environment['settings'].getboolean(section, setting)
|
value = environment['settings'].getboolean(section, setting)
|
||||||
except:
|
except:
|
||||||
|
Loading…
Reference in New Issue
Block a user