Update commandManager.py

This commit is contained in:
chrys87 2017-02-23 15:32:06 +01:00 committed by GitHub
parent a8772f7699
commit 826602831b

View File

@ -14,24 +14,31 @@ class commandManager():
pass
def initialize(self, environment):
self.env = environment
self.env['runtime']['commandManager'].loadCommands('commands')
# commands
self.env['runtime']['commandManager'].loadCommands('commands',
self.env['runtime']['settingsManager'].getSetting('general', 'commandPath'))
self.env['runtime']['commandManager'].loadCommands('onInput')
self.env['runtime']['commandManager'].loadCommands('commands')
# onInput
self.env['runtime']['commandManager'].loadCommands('onInput',
self.env['runtime']['settingsManager'].getSetting('general', 'commandPath'))
self.env['runtime']['commandManager'].loadCommands('onScreenUpdate')
self.env['runtime']['commandManager'].loadCommands('onInput')
# onScreenUpdate
self.env['runtime']['commandManager'].loadCommands('onScreenUpdate',
self.env['runtime']['settingsManager'].getSetting('general', 'commandPath'))
self.env['runtime']['commandManager'].loadCommands('onScreenChanged')
self.env['runtime']['settingsManager'].getSetting('general', 'commandPath'))
self.env['runtime']['commandManager'].loadCommands('onScreenUpdate')
# onScreenChanged
self.env['runtime']['commandManager'].loadCommands('onScreenChanged',
self.env['runtime']['settingsManager'].getSetting('general', 'commandPath'))
self.env['runtime']['commandManager'].loadCommands('onApplicationChange')
self.env['runtime']['commandManager'].loadCommands('onScreenChanged')
# onApplicationChange
self.env['runtime']['commandManager'].loadCommands('onApplicationChange',
self.env['runtime']['settingsManager'].getSetting('general', 'commandPath'))
self.env['runtime']['commandManager'].loadCommands('onSwitchApplicationProfile')
self.env['runtime']['settingsManager'].getSetting('general', 'commandPath'))
self.env['runtime']['commandManager'].loadCommands('onApplicationChange')
# onSwitchApplicationProfile
self.env['runtime']['commandManager'].loadCommands('onSwitchApplicationProfile',
self.env['runtime']['settingsManager'].getSetting('general', 'commandPath'))
self.env['runtime']['settingsManager'].getSetting('general', 'commandPath'))
self.env['runtime']['commandManager'].loadCommands('onSwitchApplicationProfile')
# scripts for scriptKey
self.env['runtime']['commandManager'].loadScriptCommands()
def shutdown(self):
self.env['runtime']['commandManager'].shutdownCommands('commands')
@ -63,6 +70,8 @@ class commandManager():
fileName = fileName.split('/')[-1]
if fileName.startswith('__'):
continue
if self.env['commands'][section][fileName.upper()]:
continue
if fileExtension.lower() == '.py':
command_mod = module_utils.importModule(fileName, command)
self.env['commands'][section][fileName.upper()] = command_mod.command()
@ -101,6 +110,8 @@ class commandManager():
fileName = fileName.split('/')[-1]
if fileName.startswith('__'):
continue
if self.env['commands'][section][fileName.upper()]:
continue
command_mod = module_utils.importModule(fileName ,subCommand)
self.env['commands'][section][fileName.upper()] = command_mod.command()
self.env['commands'][section][fileName.upper()].initialize(self.env,command)