make X autodetect working, cleanups, remove unecressary returns, shotdown of the drivers in the managers
This commit is contained in:
parent
52fbef639c
commit
7d7c021774
@ -1,67 +1,24 @@
|
|||||||
[sound]
|
[sound]
|
||||||
# Turn sound on or off:
|
|
||||||
enabled=True
|
enabled=True
|
||||||
|
|
||||||
# Select the driver used to play sounds, choices are generic and gstreamer.
|
|
||||||
# Sox is the default.
|
|
||||||
driver=generic
|
driver=generic
|
||||||
|
|
||||||
# Sound themes. This is the pack of sounds used for sound alerts.
|
|
||||||
# Sound packs may be located at /usr/share/sounds
|
|
||||||
# For system wide availability, or ~/.local/share/fenrir/sounds
|
|
||||||
# For the current user.
|
|
||||||
theme=default
|
theme=default
|
||||||
|
|
||||||
# Sound volume controls how loud the sounds for your chosen soundpack are.
|
|
||||||
# 0 is quietest, 1.0 is loudest.
|
|
||||||
volume=1.0
|
volume=1.0
|
||||||
|
|
||||||
# shell commands for generic sound driver
|
# shell commands for generic sound driver
|
||||||
# the folowing variable are substituded
|
|
||||||
# fenrirVolume = the current volume setting
|
|
||||||
# fenrirSoundFile = the soundfile for an soundicon
|
|
||||||
# fenrirFrequence = the frequence to play
|
|
||||||
# fenrirDuration = the duration of the frequence
|
|
||||||
# the following command is used for play a soundfile
|
|
||||||
genericPlayFileCommand=play -q -v fenrirVolume fenrirSoundFile
|
genericPlayFileCommand=play -q -v fenrirVolume fenrirSoundFile
|
||||||
#the following command is used for generating a frequence beep
|
|
||||||
genericFrequencyCommand=play -q -v fenrirVolume -n -c1 synth fenrirDuration sine fenrirFrequence
|
genericFrequencyCommand=play -q -v fenrirVolume -n -c1 synth fenrirDuration sine fenrirFrequence
|
||||||
|
|
||||||
[speech]
|
[speech]
|
||||||
# Turn speech on or off:
|
|
||||||
enabled=True
|
enabled=True
|
||||||
|
|
||||||
# Select speech driver, options are speechd (default) or espeak:
|
|
||||||
driver=speechd
|
driver=speechd
|
||||||
#driver=espeak
|
rate=0.75
|
||||||
|
|
||||||
|
|
||||||
# The rate selects how fast fenrir will speak. Options range from 0, slowest, to 1.0, fastest.
|
|
||||||
rate=0.45
|
|
||||||
|
|
||||||
# Pitch controls the pitch of the voice, select from 0, lowest, to 1.0, highest.
|
|
||||||
pitch=0.5
|
pitch=0.5
|
||||||
|
|
||||||
# Volume controls the loudness of the voice, select from 0, quietest, to 1.0, loudest.
|
|
||||||
volume=1.0
|
|
||||||
|
|
||||||
# Module is used for speech-dispatcher, to select the speech module you want to use.
|
|
||||||
# Consult speech-dispatcher's configuration and help ti find out which modules are available.
|
|
||||||
# The default is espeak.
|
|
||||||
module=espeak
|
module=espeak
|
||||||
|
voice=de
|
||||||
# Voice selects the varient you want to use, for example, f5 will use the female voice #5 in espeak,
|
language=de
|
||||||
# or if using the espeak module in speech-dispatcher. To find out which voices are available, consult the documentation provided with your chosen synthesizer.
|
volume=0.8
|
||||||
voice=
|
|
||||||
|
|
||||||
# Select the language you want fenrir to use.
|
|
||||||
language=english-us
|
|
||||||
|
|
||||||
# Read new text as it happens?
|
|
||||||
autoReadIncomming=True
|
autoReadIncomming=True
|
||||||
|
|
||||||
[braille]
|
[braille]
|
||||||
#braille is not implemented yet
|
|
||||||
enabled=False
|
enabled=False
|
||||||
layout=en
|
layout=en
|
||||||
|
|
||||||
@ -70,40 +27,32 @@ driver=linux
|
|||||||
encoding=cp850
|
encoding=cp850
|
||||||
screenUpdateDelay=0.4
|
screenUpdateDelay=0.4
|
||||||
suspendingScreen=1,2
|
suspendingScreen=1,2
|
||||||
autodetectSuspendingScreen=False
|
autodetectSuspendingScreen=True
|
||||||
|
|
||||||
[keyboard]
|
[keyboard]
|
||||||
driver=evdev
|
driver=evdev
|
||||||
device=all
|
device=all
|
||||||
# gives fenrir exclusive access to the keyboard and let consume keystrokes. just disable on problems.
|
|
||||||
grabDevices=True
|
grabDevices=True
|
||||||
ignoreShortcuts=False
|
ignoreShortcuts=False
|
||||||
# the current shortcut layout located in /etc/fenrir/keyboard
|
keyboardLayout=test
|
||||||
keyboardLayout=desktop
|
charEcho=True
|
||||||
# echo chars while typing.
|
|
||||||
charEcho=False
|
|
||||||
# echo deleted chars
|
|
||||||
charDeleteEcho=True
|
charDeleteEcho=True
|
||||||
# echo word after pressing space
|
wordEcho=True
|
||||||
wordEcho=False
|
|
||||||
# interrupt speech on any keypress
|
|
||||||
interruptOnKeyPress=False
|
interruptOnKeyPress=False
|
||||||
# timeout for double tap in sec
|
# timeout for double tap in sec
|
||||||
doubleTapDelay=0.2
|
doubleTapDelay=0.2
|
||||||
|
|
||||||
[general]
|
[general]
|
||||||
debugLevel=0
|
debugLevel=1
|
||||||
punctuationLevel=1
|
punctuationLevel=1
|
||||||
numberOfClipboards=10
|
numberOfClipboards=10
|
||||||
# define the current fenrir key
|
|
||||||
fenrirKeys=KEY_KP0
|
fenrirKeys=KEY_KP0
|
||||||
timeFormat=%H:%M:%P
|
timeFormat=%H:%M:%P
|
||||||
|
dateFormat="%A, %B %d, %Y"
|
||||||
autoSpellCheck=True
|
autoSpellCheck=True
|
||||||
spellCheckLanguage=en_US
|
spellCheckLanguage=en_US
|
||||||
|
|
||||||
[promote]
|
[promote]
|
||||||
enabled=True
|
enabled=True
|
||||||
inactiveTimeoutSec=120
|
inactiveTimeoutSec=120
|
||||||
list=
|
list=chrys,test
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,58 +0,0 @@
|
|||||||
[sound]
|
|
||||||
enabled=True
|
|
||||||
driver=generic
|
|
||||||
theme=default
|
|
||||||
volume=1.0
|
|
||||||
# shell commands for generic sound driver
|
|
||||||
genericPlayFileCommand=play -q -v fenrirVolume fenrirSoundFile
|
|
||||||
genericFrequencyCommand=play -q -v fenrirVolume -n -c1 synth fenrirDuration sine fenrirFrequence
|
|
||||||
|
|
||||||
[speech]
|
|
||||||
enabled=True
|
|
||||||
driver=speechd
|
|
||||||
rate=0.75
|
|
||||||
pitch=0.5
|
|
||||||
module=espeak
|
|
||||||
voice=de
|
|
||||||
language=de
|
|
||||||
volume=0.8
|
|
||||||
autoReadIncomming=True
|
|
||||||
|
|
||||||
[braille]
|
|
||||||
enabled=False
|
|
||||||
layout=en
|
|
||||||
|
|
||||||
[screen]
|
|
||||||
driver=linux
|
|
||||||
encoding=cp850
|
|
||||||
screenUpdateDelay=0.4
|
|
||||||
suspendingScreen=1,2
|
|
||||||
autodetectSuspendingScreen=False
|
|
||||||
|
|
||||||
[keyboard]
|
|
||||||
driver=evdev
|
|
||||||
device=all
|
|
||||||
grabDevices=True
|
|
||||||
ignoreShortcuts=False
|
|
||||||
keyboardLayout=test
|
|
||||||
charEcho=True
|
|
||||||
charDeleteEcho=True
|
|
||||||
wordEcho=True
|
|
||||||
interruptOnKeyPress=False
|
|
||||||
# timeout for double tap in sec
|
|
||||||
doubleTapDelay=0.2
|
|
||||||
|
|
||||||
[general]
|
|
||||||
debugLevel=1
|
|
||||||
punctuationLevel=1
|
|
||||||
numberOfClipboards=10
|
|
||||||
fenrirKeys=KEY_KP0
|
|
||||||
timeFormat=%H:%M:%P
|
|
||||||
dateFormat="%A, %B %d, %Y"
|
|
||||||
autoSpellCheck=True
|
|
||||||
spellCheckLanguage=en_US
|
|
||||||
|
|
||||||
[promote]
|
|
||||||
enabled=True
|
|
||||||
inactiveTimeoutSec=120
|
|
||||||
list=chrys,test
|
|
@ -1,25 +0,0 @@
|
|||||||
#!/bin/python
|
|
||||||
|
|
||||||
class command():
|
|
||||||
def __init__(self):
|
|
||||||
pass
|
|
||||||
def initialize(self, environment):
|
|
||||||
return environment
|
|
||||||
def shutdown(self, environment):
|
|
||||||
return environment
|
|
||||||
def getDescription(self):
|
|
||||||
return ''
|
|
||||||
def run(self, environment):
|
|
||||||
if not environment['runtime']['settingsManager'].getSettingAsBool(environment, 'keyboard', 'interruptOnKeyPress'):
|
|
||||||
return environment
|
|
||||||
if environment['screenData']['newTTY'] != environment['screenData']['oldTTY']:
|
|
||||||
return environment
|
|
||||||
# if environment['screenData']['newCursor'] == environment['screenData']['oldCursor'] and\
|
|
||||||
# environment['screenData']['newDelta'] == environment['screenData']['oldDelta']:
|
|
||||||
# return environment
|
|
||||||
if environment['input']['currShortcut'] != '':
|
|
||||||
return environment
|
|
||||||
environment['runtime']['outputManager'].interruptOutput(environment)
|
|
||||||
return environment
|
|
||||||
def setCallback(self, callback):
|
|
||||||
pass
|
|
@ -10,11 +10,10 @@ class command():
|
|||||||
def getDescription(self):
|
def getDescription(self):
|
||||||
return ''
|
return ''
|
||||||
def run(self, environment):
|
def run(self, environment):
|
||||||
|
|
||||||
if environment['screenData']['newTTY'] == environment['screenData']['oldTTY']:
|
if environment['screenData']['newTTY'] == environment['screenData']['oldTTY']:
|
||||||
return environment
|
return environment
|
||||||
environment['runtime']['outputManager'].playSoundIcon(environment,'ChangeTTY')
|
environment['runtime']['outputManager'].presentText(environment, "screen " + str(environment['screenData']['newTTY']),soundIcon='ChangeTTY', interrupt=True)
|
||||||
environment['runtime']['outputManager'].presentText(environment, environment['screenData']['newDelta'], interrupt=True)
|
environment['runtime']['outputManager'].presentText(environment, environment['screenData']['newDelta'], interrupt=False)
|
||||||
|
|
||||||
return environment
|
return environment
|
||||||
def setCallback(self, callback):
|
def setCallback(self, callback):
|
||||||
|
@ -9,6 +9,9 @@ class commandManager():
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
def initialize(self, environment):
|
def initialize(self, environment):
|
||||||
|
environment['runtime']['commandManager'].loadCommands(environment,'commands')
|
||||||
|
environment['runtime']['commandManager'].loadCommands(environment,'onInput')
|
||||||
|
environment['runtime']['commandManager'].loadCommands(environment,'onScreenChanged')
|
||||||
return environment
|
return environment
|
||||||
def shutdown(self, environment):
|
def shutdown(self, environment):
|
||||||
return environment
|
return environment
|
||||||
@ -35,13 +38,11 @@ class commandManager():
|
|||||||
return environment
|
return environment
|
||||||
|
|
||||||
def executeTriggerCommands(self, environment, trigger):
|
def executeTriggerCommands(self, environment, trigger):
|
||||||
if environment['runtime']['screenManager'].isSuspendingScreen(environment) :
|
if environment['runtime']['screenManager'].isSuspendingScreen(environment):
|
||||||
return environment
|
return environment
|
||||||
for cmd in sorted(environment['commands'][trigger]):
|
for cmd in sorted(environment['commands'][trigger]):
|
||||||
try:
|
try:
|
||||||
environ = environment['commands'][trigger][cmd].run(environment)
|
environment['commands'][trigger][cmd].run(environment)
|
||||||
if environ != None:
|
|
||||||
environment = environ
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
print(e)
|
||||||
environment['runtime']['debug'].writeDebugOut(environment,"Error while executing trigger:" + trigger + "." + cmd ,debug.debugLevel.ERROR)
|
environment['runtime']['debug'].writeDebugOut(environment,"Error while executing trigger:" + trigger + "." + cmd ,debug.debugLevel.ERROR)
|
||||||
@ -53,9 +54,7 @@ class commandManager():
|
|||||||
return environment
|
return environment
|
||||||
if self.isCommandDefined(environment):
|
if self.isCommandDefined(environment):
|
||||||
try:
|
try:
|
||||||
environ = environment['commands'][section][currCommand].run(environment)
|
environment['commands'][section][currCommand].run(environment)
|
||||||
if environ != None:
|
|
||||||
environment = environ
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
print(e)
|
||||||
environment['runtime']['debug'].writeDebugOut(environment,"Error while executing command:" + section + "." + currCommand ,debug.debugLevel.ERROR)
|
environment['runtime']['debug'].writeDebugOut(environment,"Error while executing command:" + section + "." + currCommand ,debug.debugLevel.ERROR)
|
||||||
@ -70,13 +69,4 @@ class commandManager():
|
|||||||
def setCurrCommandForExec(self, environment, currCommand):
|
def setCurrCommandForExec(self, environment, currCommand):
|
||||||
environment['commandInfo']['currCommand'] = currCommand
|
environment['commandInfo']['currCommand'] = currCommand
|
||||||
return environment
|
return environment
|
||||||
|
|
||||||
def getCommandForShortcut(self, environment, shortcut):
|
|
||||||
shortcut = shortcut.upper()
|
|
||||||
if not self.isShortcutDefined(environment, shortcut):
|
|
||||||
return ''
|
|
||||||
return environment['bindings'][shortcut]
|
|
||||||
|
|
||||||
def isCommandDefined(self, environment, currCommand):
|
|
||||||
return( currCommand in environment['commands']['commands'])
|
|
||||||
|
|
||||||
|
@ -7,16 +7,21 @@ class inputManager():
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
def initialize(self, environment):
|
def initialize(self, environment):
|
||||||
return environment
|
environment['runtime']['settingsManager'].loadDriver(environment,\
|
||||||
|
environment['runtime']['settingsManager'].getSetting(environment,'keyboard', 'driver'), 'inputDriver')
|
||||||
|
|
||||||
def shutdown(self, environment):
|
def shutdown(self, environment):
|
||||||
return environment
|
environment['runtime']['inputManager'].releaseDevices(environment)
|
||||||
|
if environment['runtime']['inputDriver']:
|
||||||
|
environment['runtime']['inputDriver'].shutdown(environment)
|
||||||
|
|
||||||
def proceedInputEvent(self, environment):
|
def proceedInputEvent(self, environment):
|
||||||
timeout = True
|
timeout = True
|
||||||
event = environment['runtime']['inputDriver'].getInput(environment)
|
event = environment['runtime']['inputDriver'].getInput(environment)
|
||||||
if event:
|
if event:
|
||||||
timeout = False
|
timeout = False
|
||||||
print(event)
|
#print(event)
|
||||||
return environment, timeout
|
return timeout
|
||||||
|
|
||||||
def grabDevices(self, environment):
|
def grabDevices(self, environment):
|
||||||
environment['runtime']['inputDriver'].grabDevices(environment)
|
environment['runtime']['inputDriver'].grabDevices(environment)
|
||||||
@ -47,4 +52,13 @@ class inputManager():
|
|||||||
return str(currShortcutStringList)[1:-1].replace(" ","").replace("'","")
|
return str(currShortcutStringList)[1:-1].replace(" ","").replace("'","")
|
||||||
|
|
||||||
def isFenrirKey(self,environment, event):
|
def isFenrirKey(self,environment, event):
|
||||||
return str(event.code) in environment['input']['fenrirKey']
|
return str(event.code) in environment['input']['fenrirKey']
|
||||||
|
|
||||||
|
def getCommandForShortcut(self, environment, shortcut):
|
||||||
|
shortcut = shortcut.upper()
|
||||||
|
if not self.isShortcutDefined(environment, shortcut):
|
||||||
|
return ''
|
||||||
|
return environment['bindings'][shortcut]
|
||||||
|
|
||||||
|
def isCommandDefined(self, environment, currCommand):
|
||||||
|
return( currCommand in environment['commands']['commands'])
|
||||||
|
@ -5,10 +5,19 @@ class outputManager():
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
def initialize(self, environment):
|
def initialize(self, environment):
|
||||||
return environment
|
environment['runtime']['settingsManager'].loadDriver(environment,\
|
||||||
|
environment['runtime']['settingsManager'].getSetting(environment,'speech', 'driver'), 'speechDriver')
|
||||||
|
environment['runtime']['settingsManager'].loadDriver(environment,\
|
||||||
|
environment['runtime']['settingsManager'].getSetting(environment,'sound', 'driver'), 'soundDriver')
|
||||||
|
|
||||||
def shutdown(self, environment):
|
def shutdown(self, environment):
|
||||||
return environment
|
if environment['runtime']['soundDriver']:
|
||||||
|
environment['runtime']['soundDriver'].shutdown(environment)
|
||||||
|
if environment['runtime']['speechDriver']:
|
||||||
|
environment['runtime']['speechDriver'].shutdown(environment)
|
||||||
|
|
||||||
def presentText(self, environment, text, interrupt=True, soundIcon = ''):
|
def presentText(self, environment, text, interrupt=True, soundIcon = ''):
|
||||||
|
print(soundIcon,text)
|
||||||
environment['runtime']['debug'].writeDebugOut(environment,"presentText:\nsoundIcon:'"+soundIcon+"'\nText:\n" + text ,debug.debugLevel.INFO)
|
environment['runtime']['debug'].writeDebugOut(environment,"presentText:\nsoundIcon:'"+soundIcon+"'\nText:\n" + text ,debug.debugLevel.INFO)
|
||||||
if self.playSoundIcon(environment, soundIcon, interrupt):
|
if self.playSoundIcon(environment, soundIcon, interrupt):
|
||||||
environment['runtime']['debug'].writeDebugOut(environment,"soundIcon found" ,debug.debugLevel.INFO)
|
environment['runtime']['debug'].writeDebugOut(environment,"soundIcon found" ,debug.debugLevel.INFO)
|
||||||
|
@ -7,14 +7,19 @@ class screenManager():
|
|||||||
self.autoIgnoreScreens = []
|
self.autoIgnoreScreens = []
|
||||||
|
|
||||||
def initialize(self, environment):
|
def initialize(self, environment):
|
||||||
|
environment['runtime']['settingsManager'].loadDriver(environment,\
|
||||||
|
environment['runtime']['settingsManager'].getSetting(environment,'screen', 'driver'), 'screenDriver')
|
||||||
if environment['runtime']['settingsManager'].getSettingAsBool(environment,'screen', 'autodetectSuspendingScreen'):
|
if environment['runtime']['settingsManager'].getSettingAsBool(environment,'screen', 'autodetectSuspendingScreen'):
|
||||||
self.autoIgnoreScreens = environment['runtime']['screenDriver'].getIgnoreScreens()
|
self.autoIgnoreScreens = environment['runtime']['screenDriver'].getIgnoreScreens()
|
||||||
return environment
|
return environment
|
||||||
|
|
||||||
def shutdown(self, environment):
|
def shutdown(self, environment):
|
||||||
|
if environment['runtime']['screenDriver']:
|
||||||
|
environment['runtime']['screenDriver'].shutdown(environment)
|
||||||
return environment
|
return environment
|
||||||
|
|
||||||
def update(self, environment):
|
def update(self, environment):
|
||||||
|
print(self.isSuspendingScreen(environment))
|
||||||
if not self.isSuspendingScreen(environment):
|
if not self.isSuspendingScreen(environment):
|
||||||
environment = environment['runtime']['screenDriver'].update(environment)
|
environment = environment['runtime']['screenDriver'].update(environment)
|
||||||
environment['screenData']['lastScreenUpdate'] = time.time()
|
environment['screenData']['lastScreenUpdate'] = time.time()
|
||||||
|
@ -48,7 +48,7 @@ class settingsManager():
|
|||||||
print(str(shortcut))
|
print(str(shortcut))
|
||||||
environment['bindings'][str(shortcut)] = commandName
|
environment['bindings'][str(shortcut)] = commandName
|
||||||
kbConfig.close()
|
kbConfig.close()
|
||||||
return environment
|
|
||||||
|
|
||||||
def getCodeForKeyID(self, keyID):
|
def getCodeForKeyID(self, keyID):
|
||||||
try:
|
try:
|
||||||
@ -85,10 +85,10 @@ class settingsManager():
|
|||||||
|
|
||||||
def loadSettings(self, environment, settingConfigPath):
|
def loadSettings(self, environment, settingConfigPath):
|
||||||
if not os.path.exists(settingConfigPath):
|
if not os.path.exists(settingConfigPath):
|
||||||
return None
|
return False
|
||||||
environment['settings'] = ConfigParser()
|
environment['settings'] = ConfigParser()
|
||||||
environment['settings'].read(settingConfigPath)
|
environment['settings'].read(settingConfigPath)
|
||||||
return environment
|
return True
|
||||||
|
|
||||||
def setSetting(self, environment, section, setting, value):
|
def setSetting(self, environment, section, setting, value):
|
||||||
environment['settings'].set(section, setting, value)
|
environment['settings'].set(section, setting, value)
|
||||||
@ -128,13 +128,13 @@ class settingsManager():
|
|||||||
|
|
||||||
def loadDriver(self, environment, driverName, driverType):
|
def loadDriver(self, environment, driverName, driverType):
|
||||||
if environment['runtime'][driverType] != None:
|
if environment['runtime'][driverType] != None:
|
||||||
environment['runtime'][driverType].shutdown()
|
print('shutdown %s',driverType)
|
||||||
|
environment['runtime'][driverType].shutdown(environment)
|
||||||
spec = importlib.util.spec_from_file_location(driverName, driverType + '/' + driverName + '.py')
|
spec = importlib.util.spec_from_file_location(driverName, driverType + '/' + driverName + '.py')
|
||||||
driver_mod = importlib.util.module_from_spec(spec)
|
driver_mod = importlib.util.module_from_spec(spec)
|
||||||
spec.loader.exec_module(driver_mod)
|
spec.loader.exec_module(driver_mod)
|
||||||
environment['runtime'][driverType] = driver_mod.driver()
|
environment['runtime'][driverType] = driver_mod.driver()
|
||||||
environment['runtime'][driverType].initialize(environment)
|
environment['runtime'][driverType].initialize(environment)
|
||||||
return environment
|
|
||||||
|
|
||||||
def setFenrirKeys(self, environment, keys):
|
def setFenrirKeys(self, environment, keys):
|
||||||
keys = keys.upper()
|
keys = keys.upper()
|
||||||
@ -142,7 +142,6 @@ class settingsManager():
|
|||||||
for key in keyList:
|
for key in keyList:
|
||||||
if not key in environment['input']['fenrirKey']:
|
if not key in environment['input']['fenrirKey']:
|
||||||
environment['input']['fenrirKey'].append(key)
|
environment['input']['fenrirKey'].append(key)
|
||||||
return environment
|
|
||||||
|
|
||||||
def keyIDasString(self, key):
|
def keyIDasString(self, key):
|
||||||
try:
|
try:
|
||||||
@ -160,52 +159,39 @@ class settingsManager():
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
environment['runtime']['settingsManager'] = self
|
environment['runtime']['settingsManager'] = self
|
||||||
environment = environment['runtime']['settingsManager'].loadSettings(environment, settingsRoot + '/settings/' + settingsFile)
|
validConfig = environment['runtime']['settingsManager'].loadSettings(environment, settingsRoot + '/settings/' + settingsFile)
|
||||||
if environment == None:
|
if not validConfig:
|
||||||
return None
|
return None
|
||||||
environment = self.setFenrirKeys(environment, self.getSetting(environment, 'general','fenrirKeys'))
|
self.setFenrirKeys(environment, self.getSetting(environment, 'general','fenrirKeys'))
|
||||||
if not os.path.exists(self.getSetting(environment, 'keyboard','keyboardLayout')):
|
if not os.path.exists(self.getSetting(environment, 'keyboard','keyboardLayout')):
|
||||||
if os.path.exists(settingsRoot + 'keyboard/' + self.getSetting(environment, 'keyboard','keyboardLayout')):
|
if os.path.exists(settingsRoot + 'keyboard/' + self.getSetting(environment, 'keyboard','keyboardLayout')):
|
||||||
self.setSetting(environment, 'keyboard', 'keyboardLayout', settingsRoot + 'keyboard/' + self.getSetting(environment, 'keyboard','keyboardLayout'))
|
self.setSetting(environment, 'keyboard', 'keyboardLayout', settingsRoot + 'keyboard/' + self.getSetting(environment, 'keyboard','keyboardLayout'))
|
||||||
environment = environment['runtime']['settingsManager'].loadShortcuts(environment, self.getSetting('keyboard','keyboardLayout'))
|
environment['runtime']['settingsManager'].loadShortcuts(environment, self.getSetting('keyboard','keyboardLayout'))
|
||||||
if os.path.exists(settingsRoot + 'keyboard/' + self.getSetting(environment, 'keyboard','keyboardLayout') + '.conf'):
|
if os.path.exists(settingsRoot + 'keyboard/' + self.getSetting(environment, 'keyboard','keyboardLayout') + '.conf'):
|
||||||
self.setSetting(environment, 'keyboard', 'keyboardLayout', settingsRoot + 'keyboard/' + self.getSetting(environment, 'keyboard','keyboardLayout') + '.conf')
|
self.setSetting(environment, 'keyboard', 'keyboardLayout', settingsRoot + 'keyboard/' + self.getSetting(environment, 'keyboard','keyboardLayout') + '.conf')
|
||||||
environment = environment['runtime']['settingsManager'].loadShortcuts(environment, self.getSetting(environment, 'keyboard','keyboardLayout'))
|
environment['runtime']['settingsManager'].loadShortcuts(environment, self.getSetting(environment, 'keyboard','keyboardLayout'))
|
||||||
else:
|
else:
|
||||||
environment = environment['runtime']['settingsManager'].loadShortcuts(environment, self.getSetting(environment, 'keyboard','keyboardLayout'))
|
environment['runtime']['settingsManager'].loadShortcuts(environment, self.getSetting(environment, 'keyboard','keyboardLayout'))
|
||||||
|
|
||||||
if not os.path.exists(self.getSetting(environment, 'sound','theme') + '/soundicons.conf'):
|
if not os.path.exists(self.getSetting(environment, 'sound','theme') + '/soundicons.conf'):
|
||||||
if os.path.exists(settingsRoot + 'sound/'+ self.getSetting(environment, 'sound','theme')):
|
if os.path.exists(settingsRoot + 'sound/'+ self.getSetting(environment, 'sound','theme')):
|
||||||
self.setSetting(environment, 'sound', 'theme', settingsRoot + 'sound/'+ self.getSetting(environment, 'sound','theme'))
|
self.setSetting(environment, 'sound', 'theme', settingsRoot + 'sound/'+ self.getSetting(environment, 'sound','theme'))
|
||||||
if os.path.exists(settingsRoot + 'sound/'+ self.getSetting(environment, 'sound','theme') + '/soundicons.conf'):
|
if os.path.exists(settingsRoot + 'sound/'+ self.getSetting(environment, 'sound','theme') + '/soundicons.conf'):
|
||||||
environment = environment['runtime']['settingsManager'].loadSoundIcons(environment, self.getSetting(environment, 'sound','theme'))
|
environment['runtime']['settingsManager'].loadSoundIcons(environment, self.getSetting(environment, 'sound','theme'))
|
||||||
else:
|
else:
|
||||||
environment = environment['runtime']['settingsManager'].loadSoundIcons(environment, self.getSetting(environment, 'sound','theme'))
|
environment['runtime']['settingsManager'].loadSoundIcons(environment, self.getSetting(environment, 'sound','theme'))
|
||||||
|
|
||||||
environment['runtime']['inputManager'] = inputManager.inputManager()
|
environment['runtime']['inputManager'] = inputManager.inputManager()
|
||||||
environment = environment['runtime']['inputManager'].initialize(environment)
|
environment['runtime']['inputManager'].initialize(environment)
|
||||||
environment['runtime']['outputManager'] = outputManager.outputManager()
|
environment['runtime']['outputManager'] = outputManager.outputManager()
|
||||||
environment = environment['runtime']['outputManager'].initialize(environment)
|
environment['runtime']['outputManager'].initialize(environment)
|
||||||
environment['runtime']['commandManager'] = commandManager.commandManager()
|
environment['runtime']['commandManager'] = commandManager.commandManager()
|
||||||
environment = environment['runtime']['commandManager'].initialize(environment)
|
environment['runtime']['commandManager'].initialize(environment)
|
||||||
|
|
||||||
if environment['runtime']['screenManager'] == None:
|
if environment['runtime']['screenManager'] == None:
|
||||||
environment['runtime']['screenManager'] = screenManager.screenManager()
|
environment['runtime']['screenManager'] = screenManager.screenManager()
|
||||||
environment = environment['runtime']['screenManager'].initialize(environment)
|
environment['runtime']['screenManager'].initialize(environment)
|
||||||
|
|
||||||
|
|
||||||
environment = environment['runtime']['commandManager'].loadCommands(environment,'commands')
|
|
||||||
environment = environment['runtime']['commandManager'].loadCommands(environment,'onInput')
|
|
||||||
environment = environment['runtime']['commandManager'].loadCommands(environment,'onScreenChanged')
|
|
||||||
|
|
||||||
environment = environment['runtime']['settingsManager'].loadDriver(environment,\
|
|
||||||
environment['runtime']['settingsManager'].getSetting(environment,'speech', 'driver'), 'speechDriver')
|
|
||||||
environment = environment['runtime']['settingsManager'].loadDriver(environment,\
|
|
||||||
environment['runtime']['settingsManager'].getSetting(environment,'screen', 'driver'), 'screenDriver')
|
|
||||||
environment = environment['runtime']['settingsManager'].loadDriver(environment,\
|
|
||||||
environment['runtime']['settingsManager'].getSetting(environment,'sound', 'driver'), 'soundDriver')
|
|
||||||
environment = environment['runtime']['settingsManager'].loadDriver(environment,\
|
|
||||||
environment['runtime']['settingsManager'].getSetting(environment,'keyboard', 'driver'), 'inputDriver')
|
|
||||||
environment['runtime']['debug'].writeDebugOut(environment,'\/-------environment-------\/',debug.debugLevel.ERROR)
|
environment['runtime']['debug'].writeDebugOut(environment,'\/-------environment-------\/',debug.debugLevel.ERROR)
|
||||||
environment['runtime']['debug'].writeDebugOut(environment,str(environment),debug.debugLevel.ERROR)
|
environment['runtime']['debug'].writeDebugOut(environment,str(environment),debug.debugLevel.ERROR)
|
||||||
environment['runtime']['debug'].writeDebugOut(environment,'\/-------settings.conf-------\/',debug.debugLevel.ERROR)
|
environment['runtime']['debug'].writeDebugOut(environment,'\/-------settings.conf-------\/',debug.debugLevel.ERROR)
|
||||||
|
@ -33,10 +33,10 @@ class fenrir():
|
|||||||
self.shutdown()
|
self.shutdown()
|
||||||
|
|
||||||
def handleProcess(self):
|
def handleProcess(self):
|
||||||
self.environment, timeout = self.environment['runtime']['inputManager'].proceedInputEvent(self.environment)
|
timeout = self.environment['runtime']['inputManager'].proceedInputEvent(self.environment)
|
||||||
timeout = True
|
timeout = True
|
||||||
try:
|
try:
|
||||||
self.environment = self.environment['runtime']['screenManager'].update(self.environment)
|
self.environment['runtime']['screenManager'].update(self.environment)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
print(e)
|
||||||
self.environment['runtime']['debug'].writeDebugOut(self.environment, str(e),debug.debugLevel.ERROR)
|
self.environment['runtime']['debug'].writeDebugOut(self.environment, str(e),debug.debugLevel.ERROR)
|
||||||
@ -44,17 +44,17 @@ class fenrir():
|
|||||||
#currShortcut = self.environment['runtime']['inputManager'].getCurrShortcut(self.environment)
|
#currShortcut = self.environment['runtime']['inputManager'].getCurrShortcut(self.environment)
|
||||||
currShortcut = ''
|
currShortcut = ''
|
||||||
currCommand = self.environment['runtime']['commandManager'].getCommandForShortcut(self.environment, currShortcut)
|
currCommand = self.environment['runtime']['commandManager'].getCommandForShortcut(self.environment, currShortcut)
|
||||||
self.environment = self.environment['runtime']['commandManager'].setCurrCommandForExec(self.environment, currCommand)
|
self.environment['runtime']['commandManager'].setCurrCommandForExec(self.environment, currCommand)
|
||||||
if not timeout:
|
if not timeout:
|
||||||
self.environment = self.environment['runtime']['commandManager'].executeTriggerCommands(self.environment, 'onInput')
|
self.environment['runtime']['commandManager'].executeTriggerCommands(self.environment, 'onInput')
|
||||||
self.environment = self.environment['runtime']['commandManager'].executeTriggerCommands(self.environment, 'onScreenChanged')
|
self.environment['runtime']['commandManager'].executeTriggerCommands(self.environment, 'onScreenChanged')
|
||||||
if not self.environment['input']['keyForeward']:
|
if not self.environment['input']['keyForeward']:
|
||||||
if self.environment['commandInfo']['currCommand'] != '':
|
if self.environment['commandInfo']['currCommand'] != '':
|
||||||
self.handleCommands()
|
self.handleCommands()
|
||||||
|
|
||||||
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['runtime']['commandManager'].executeCommand(self.environment, self.environment['commandInfo']['currCommand'], 'commands')
|
||||||
|
|
||||||
def shutdownRequest(self):
|
def shutdownRequest(self):
|
||||||
self.environment['generalInformation']['running'] = False
|
self.environment['generalInformation']['running'] = False
|
||||||
@ -63,24 +63,18 @@ class fenrir():
|
|||||||
self.shutdownRequest()
|
self.shutdownRequest()
|
||||||
|
|
||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
self.environment['runtime']['inputManager'].releaseDevices(self.environment)
|
if self.environment['runtime']['inputManager']:
|
||||||
|
self.environment['runtime']['inputManager'].shutdown(self.environment)
|
||||||
self.environment['runtime']['outputManager'].presentText(self.environment, "Quit Fenrir", soundIcon='ScreenReaderOff', interrupt=True)
|
self.environment['runtime']['outputManager'].presentText(self.environment, "Quit Fenrir", soundIcon='ScreenReaderOff', interrupt=True)
|
||||||
|
time.sleep(1.0) # wait a little before splatter it :)
|
||||||
|
|
||||||
if self.environment['runtime']['screenManager']:
|
if self.environment['runtime']['screenManager']:
|
||||||
self.environment['runtime']['screenManager'].shutdown(self.environment)
|
self.environment['runtime']['screenManager'].shutdown(self.environment)
|
||||||
if self.environment['runtime']['commandManager']:
|
if self.environment['runtime']['commandManager']:
|
||||||
self.environment['runtime']['commandManager'].shutdown(self.environment)
|
self.environment['runtime']['commandManager'].shutdown(self.environment)
|
||||||
if self.environment['runtime']['inputManager']:
|
|
||||||
self.environment['runtime']['inputManager'].shutdown(self.environment)
|
|
||||||
if self.environment['runtime']['outputManager']:
|
if self.environment['runtime']['outputManager']:
|
||||||
self.environment['runtime']['outputManager'].shutdown(self.environment)
|
self.environment['runtime']['outputManager'].shutdown(self.environment)
|
||||||
if self.environment['runtime']['screenDriver']:
|
|
||||||
self.environment['runtime']['screenDriver'].shutdown(self.environment)
|
|
||||||
if self.environment['runtime']['inputDriver']:
|
|
||||||
self.environment['runtime']['inputDriver'].shutdown(self.environment)
|
|
||||||
if self.environment['runtime']['soundDriver']:
|
|
||||||
self.environment['runtime']['soundDriver'].shutdown(self.environment)
|
|
||||||
if self.environment['runtime']['speechDriver']:
|
|
||||||
self.environment['runtime']['speechDriver'].shutdown(self.environment)
|
|
||||||
if self.environment['runtime']['debug']:
|
if self.environment['runtime']['debug']:
|
||||||
self.environment['runtime']['debug'].closeDebugFile()
|
self.environment['runtime']['debug'].closeDebugFile()
|
||||||
time.sleep(0.8) # wait a little before splatter it :)
|
time.sleep(0.8) # wait a little before splatter it :)
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import difflib
|
import difflib
|
||||||
|
import subprocess
|
||||||
from utils import debug
|
from utils import debug
|
||||||
|
|
||||||
class driver():
|
class driver():
|
||||||
@ -31,12 +32,13 @@ class driver():
|
|||||||
def getIgnoreScreens(self):
|
def getIgnoreScreens(self):
|
||||||
xlist = []
|
xlist = []
|
||||||
try:
|
try:
|
||||||
x = subprocess.Popen('ps a -o tty,comm | grep -e irssi | grep -v "grep -e irssi"', shell=True, stdout=subprocess.PIPE).stdout.read().decode()[:-1].split('\n')
|
x = subprocess.Popen('ps a -o tty,comm | grep -e Xorg | grep -v "grep -e Xorg"', shell=True, stdout=subprocess.PIPE).stdout.read().decode()[:-1].split('\n')
|
||||||
except:
|
except Exception as e:
|
||||||
|
print(e)
|
||||||
return xlist
|
return xlist
|
||||||
for i in x:
|
for i in x:
|
||||||
if x[:3].upper() == 'TTY':
|
if i[:3].upper() == 'TTY':
|
||||||
xlist.append(i[4])
|
xlist.append(i[3])
|
||||||
return xlist
|
return xlist
|
||||||
|
|
||||||
def update(self, environment, trigger='updateScreen'):
|
def update(self, environment, trigger='updateScreen'):
|
||||||
|
@ -17,6 +17,7 @@ class driver():
|
|||||||
self.frequenceCommand = '=play -q -v fenrirVolume -n -c1 synth fenrirDuration sine fenrirFrequence'
|
self.frequenceCommand = '=play -q -v fenrirVolume -n -c1 synth fenrirDuration sine fenrirFrequence'
|
||||||
return environment
|
return environment
|
||||||
def shutdown(self, environment):
|
def shutdown(self, environment):
|
||||||
|
self.cancel()
|
||||||
return environment
|
return environment
|
||||||
def playFrequence(self, frequence, duration, adjustVolume):
|
def playFrequence(self, frequence, duration, adjustVolume):
|
||||||
if interrupt:
|
if interrupt:
|
||||||
@ -34,6 +35,8 @@ class driver():
|
|||||||
self.proc = subprocess.Popen(popenSoundFileCommand, shell=True)
|
self.proc = subprocess.Popen(popenSoundFileCommand, shell=True)
|
||||||
self.soundType = 'file'
|
self.soundType = 'file'
|
||||||
def cancel(self):
|
def cancel(self):
|
||||||
|
if self.soundType == '':
|
||||||
|
return
|
||||||
if self.soundType == 'file':
|
if self.soundType == 'file':
|
||||||
self.proc.kill()
|
self.proc.kill()
|
||||||
if self.soundType == 'frequence':
|
if self.soundType == 'frequence':
|
||||||
|
Loading…
Reference in New Issue
Block a user