look at /usr/share/sounds/fenrir for sound
This commit is contained in:
parent
f1365f21ae
commit
02ef75d966
@ -110,6 +110,7 @@ timeFormat=%H:%M:%P
|
|||||||
dateFormat=%A, %B %d, %Y
|
dateFormat=%A, %B %d, %Y
|
||||||
autoSpellCheck=True
|
autoSpellCheck=True
|
||||||
spellCheckLanguage=en_US
|
spellCheckLanguage=en_US
|
||||||
|
scriptPath=/etc/fenrir/scripts
|
||||||
|
|
||||||
[promote]
|
[promote]
|
||||||
enabled=True
|
enabled=True
|
||||||
|
@ -110,6 +110,7 @@ timeFormat=%H:%M:%P
|
|||||||
dateFormat=%A, %B %d, %Y
|
dateFormat=%A, %B %d, %Y
|
||||||
autoSpellCheck=True
|
autoSpellCheck=True
|
||||||
spellCheckLanguage=en_US
|
spellCheckLanguage=en_US
|
||||||
|
scriptPath=/etc/fenrir/scripts
|
||||||
|
|
||||||
[promote]
|
[promote]
|
||||||
enabled=True
|
enabled=True
|
||||||
|
@ -60,6 +60,7 @@ timeFormat=%H:%M:%P
|
|||||||
dateFormat="%A, %B %d, %Y"
|
dateFormat="%A, %B %d, %Y"
|
||||||
autoSpellCheck=True
|
autoSpellCheck=True
|
||||||
spellCheckLanguage=en_US
|
spellCheckLanguage=en_US
|
||||||
|
scriptPath=/etc/fenrir/scripts
|
||||||
|
|
||||||
[promote]
|
[promote]
|
||||||
enabled=True
|
enabled=True
|
||||||
|
@ -20,7 +20,7 @@ class commandManager():
|
|||||||
self.env['runtime']['commandManager'].loadCommands('onScreenChanged')
|
self.env['runtime']['commandManager'].loadCommands('onScreenChanged')
|
||||||
self.env['runtime']['commandManager'].loadCommands('onApplicationChange')
|
self.env['runtime']['commandManager'].loadCommands('onApplicationChange')
|
||||||
self.env['runtime']['commandManager'].loadCommands('onSwitchApplicationProfile')
|
self.env['runtime']['commandManager'].loadCommands('onSwitchApplicationProfile')
|
||||||
|
self.env['runtime']['commandManager'].loadScriptCommands()
|
||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
self.env['runtime']['commandManager'].shutdownCommands('commands')
|
self.env['runtime']['commandManager'].shutdownCommands('commands')
|
||||||
self.env['runtime']['commandManager'].shutdownCommands('onInput')
|
self.env['runtime']['commandManager'].shutdownCommands('onInput')
|
||||||
@ -52,6 +52,35 @@ class commandManager():
|
|||||||
self.env['runtime']['debug'].writeDebugOut(str(e),debug.debugLevel.ERROR)
|
self.env['runtime']['debug'].writeDebugOut(str(e),debug.debugLevel.ERROR)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
def loadScriptCommands(self, section='commands'):
|
||||||
|
scriptPath = self.env['runtime']['settingsManager'].getSetting('general', 'scriptPath')
|
||||||
|
if not os.path.exists(scriptPath):
|
||||||
|
self.env['runtime']['debug'].writeDebugOut("scriptpath not exists:" + scriptPath ,debug.debugLevel.ERROR)
|
||||||
|
return
|
||||||
|
if not os.path.isdir(scriptPath):
|
||||||
|
self.env['runtime']['debug'].writeDebugOut("scriptpath not a directory:" + scriptPath ,debug.debugLevel.ERROR)
|
||||||
|
return
|
||||||
|
if not os.access(scriptPath, os.R_OK):
|
||||||
|
self.env['runtime']['debug'].writeDebugOut("scriptpath not readable:" + scriptPath ,debug.debugLevel.ERROR)
|
||||||
|
return
|
||||||
|
commandList = glob.glob(self.env['runtime']['settingsManager'].getSetting('general', 'scriptPath')+'/*')
|
||||||
|
for command in commandList:
|
||||||
|
try:
|
||||||
|
fileName, fileExtension = os.path.splitext(command)
|
||||||
|
fileName = fileName.split('/')[-1]
|
||||||
|
if fileName.startswith('__'):
|
||||||
|
continue
|
||||||
|
spec = importlib.util.spec_from_file_location(__main__.__file__+'/commands/commands/subprocess.py', command)
|
||||||
|
command_mod = importlib.util.module_from_spec(spec)
|
||||||
|
spec.loader.exec_module(command_mod)
|
||||||
|
self.env['commands'][section][fileName.upper()] = command_mod.command()
|
||||||
|
self.env['commands'][section][fileName.upper()].initialize(self.env,command)
|
||||||
|
self.env['runtime']['debug'].writeDebugOut("Load script:" + section + "." + fileName.upper() ,debug.debugLevel.INFO, onAnyLevel=True)
|
||||||
|
except Exception as e:
|
||||||
|
print(e)
|
||||||
|
self.env['runtime']['debug'].writeDebugOut("Loading script:" + command ,debug.debugLevel.ERROR)
|
||||||
|
self.env['runtime']['debug'].writeDebugOut(str(e),debug.debugLevel.ERROR)
|
||||||
|
continue
|
||||||
def shutdownCommands(self, section):
|
def shutdownCommands(self, section):
|
||||||
for command in sorted(self.env['commands'][section]):
|
for command in sorted(self.env['commands'][section]):
|
||||||
try:
|
try:
|
||||||
|
@ -53,6 +53,7 @@ settings = {
|
|||||||
'dateFormat': '%A, %B %d, %Y',
|
'dateFormat': '%A, %B %d, %Y',
|
||||||
'autoSpellCheck': False,
|
'autoSpellCheck': False,
|
||||||
'spellCheckLanguage': 'en_US',
|
'spellCheckLanguage': 'en_US',
|
||||||
|
'scriptPath':'/etc/fenrir/scripts',
|
||||||
},
|
},
|
||||||
'promote':{
|
'promote':{
|
||||||
'enabled': True,
|
'enabled': True,
|
||||||
|
@ -192,7 +192,7 @@ class settingsManager():
|
|||||||
for key in keyList:
|
for key in keyList:
|
||||||
if not key in self.env['input']['scriptKey']:
|
if not key in self.env['input']['scriptKey']:
|
||||||
self.env['input']['scriptKey'].append(key)
|
self.env['input']['scriptKey'].append(key)
|
||||||
def initFenrirConfig(self, environment = environment.environment, settingsRoot = '/etc/fenrir/', settingsFile='settings.conf'):
|
def initFenrirConfig(self, environment = environment.environment, settingsRoot = '/etc/fenrir/', settingsFile='settings.conf', soundRoot = '/usr/share/sounds/fenrir'):
|
||||||
environment['runtime']['debug'] = debug.debug()
|
environment['runtime']['debug'] = debug.debug()
|
||||||
environment['runtime']['debug'].initialize(environment)
|
environment['runtime']['debug'].initialize(environment)
|
||||||
if not os.path.exists(settingsRoot):
|
if not os.path.exists(settingsRoot):
|
||||||
@ -200,6 +200,9 @@ class settingsManager():
|
|||||||
settingsRoot = os.path.dirname(os.path.realpath(__main__.__file__)) +'/../../config/'
|
settingsRoot = os.path.dirname(os.path.realpath(__main__.__file__)) +'/../../config/'
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
if not os.path.exists(soundRoot):
|
||||||
|
if os.path.exists(os.path.dirname(os.path.realpath(__main__.__file__)) +'/../../config/'):
|
||||||
|
soundRoot = os.path.dirname(os.path.realpath(__main__.__file__)) +'/../../config/'
|
||||||
|
|
||||||
environment['runtime']['settingsManager'] = self
|
environment['runtime']['settingsManager'] = self
|
||||||
environment['runtime']['settingsManager'].initialize(environment)
|
environment['runtime']['settingsManager'].initialize(environment)
|
||||||
@ -220,8 +223,8 @@ class settingsManager():
|
|||||||
environment['runtime']['settingsManager'].loadShortcuts(self.getSetting('keyboard','keyboardLayout'))
|
environment['runtime']['settingsManager'].loadShortcuts(self.getSetting('keyboard','keyboardLayout'))
|
||||||
|
|
||||||
if not os.path.exists(self.getSetting('sound','theme') + '/soundicons.conf'):
|
if not os.path.exists(self.getSetting('sound','theme') + '/soundicons.conf'):
|
||||||
if os.path.exists(settingsRoot + 'sound/'+ self.getSetting('sound','theme')):
|
if os.path.exists(soundRoot + 'sound/'+ self.getSetting('sound','theme')):
|
||||||
self.setSetting('sound', 'theme', settingsRoot + 'sound/'+ self.getSetting('sound','theme'))
|
self.setSetting('sound', 'theme', soundRoot + 'sound/'+ self.getSetting('sound','theme'))
|
||||||
if os.path.exists(self.getSetting('sound','theme') + '/soundicons.conf'):
|
if os.path.exists(self.getSetting('sound','theme') + '/soundicons.conf'):
|
||||||
environment['runtime']['settingsManager'].loadSoundIcons(self.getSetting('sound','theme'))
|
environment['runtime']['settingsManager'].loadSoundIcons(self.getSetting('sound','theme'))
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user