fix enable/disable commands
This commit is contained in:
parent
5677e3e0e8
commit
d6a6ad5583
@ -1,3 +1,4 @@
|
||||
|
||||
[sound]
|
||||
enabled=False,
|
||||
driver=sox
|
||||
@ -5,19 +6,23 @@ theme=default
|
||||
|
||||
[speech]
|
||||
enabled=True
|
||||
driver=espeak
|
||||
rate=800
|
||||
#driver=espeak
|
||||
#language=en-us
|
||||
#voice=en-us
|
||||
driver=speechd
|
||||
#rate=800
|
||||
rate=50
|
||||
volume=100
|
||||
pitch=50
|
||||
module=espeak
|
||||
voice=en-us
|
||||
language=en-us
|
||||
volume=200
|
||||
voice=de
|
||||
language=de
|
||||
|
||||
[braille]
|
||||
enabled=False
|
||||
layout=en
|
||||
|
||||
[screen]
|
||||
['screen]
|
||||
driver=linux
|
||||
|
||||
[keyboard]
|
||||
@ -28,3 +33,4 @@ wordEcho=True
|
||||
[general]
|
||||
debugLevel=0
|
||||
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):
|
||||
pass
|
||||
def run(self, environment):
|
||||
environment['braille']['enabled'] = not environment['braille']['enabled']
|
||||
if environment['braille']['enabled']:
|
||||
environment['runtime']['outputManager'].presentText(environment, "braille enabled")
|
||||
else:
|
||||
|
||||
if environment['runtime']['settingsManager'].getSettingAsBool(environment, 'braille', 'enabled'):
|
||||
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
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -4,18 +4,18 @@ class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def run(self, environment):
|
||||
if environment['speech']['enabled'] or \
|
||||
environment['sound']['enabled'] or \
|
||||
environment['braille']['enabled']:
|
||||
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")
|
||||
environment['speech']['enabled'] = False
|
||||
environment['sound']['enabled'] = False
|
||||
environment['braille']['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, 'braille', 'enabled','False')
|
||||
else:
|
||||
environment['runtime']['outputManager'].presentText(environment, "fenrir unmuted")
|
||||
environment['speech']['enabled'] = True
|
||||
environment['sound']['enabled'] = True
|
||||
environment['braille']['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, 'braille', 'enabled','True')
|
||||
return environment
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -4,11 +4,12 @@ class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def run(self, environment):
|
||||
environment['sound']['enabled'] = not environment['sound']['enabled']
|
||||
if environment['sound']['enabled']:
|
||||
environment['runtime']['outputManager'].presentText(environment, "sound enabled")
|
||||
else:
|
||||
|
||||
if environment['runtime']['settingsManager'].getSettingAsBool(environment, 'sound', 'enabled'):
|
||||
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
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -4,11 +4,12 @@ class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def run(self, environment):
|
||||
environment['speech']['enabled'] = not environment['speech']['enabled']
|
||||
if environment['speech']['enabled']:
|
||||
environment['runtime']['outputManager'].presentText(environment, "speech enabled")
|
||||
else:
|
||||
|
||||
if environment['runtime']['settingsManager'].getSettingAsBool(environment, 'speech', 'enabled'):
|
||||
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
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -41,56 +41,3 @@ class inputManager():
|
||||
currShortcutStringList = sorted(currShortcutStringList)
|
||||
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)
|
||||
return environment
|
||||
|
||||
def setSetting(self, environment, section, setting, value):
|
||||
environment['settings'].set(section, setting, value)
|
||||
return environment
|
||||
|
||||
def getSetting(self, environment, section, setting):
|
||||
value = ''
|
||||
try:
|
||||
@ -81,7 +85,7 @@ class settingsManager():
|
||||
return value
|
||||
|
||||
def getSettingAsInt(self, environment, section, setting):
|
||||
value = ''
|
||||
value = 0
|
||||
try:
|
||||
value = environment['settings'].getint(section, setting)
|
||||
except:
|
||||
@ -89,14 +93,14 @@ class settingsManager():
|
||||
return value
|
||||
|
||||
def getSettingAsFloat(self, environment, section, setting):
|
||||
value = ''
|
||||
value = 0.0
|
||||
try:
|
||||
value = environment['settings'].getfloat(section, setting)
|
||||
except:
|
||||
value = self.settings[section][setting]
|
||||
return value
|
||||
def getSettingAsBool(self, environment, section, setting):
|
||||
value = ''
|
||||
value = False
|
||||
try:
|
||||
value = environment['settings'].getboolean(section, setting)
|
||||
except:
|
||||
|
Loading…
Reference in New Issue
Block a user