fenrir/src/fenrir-package/core/commandManager.py
2016-07-08 18:33:32 +02:00

33 lines
1.2 KiB
Python

#!/bin/python
class commandManager():
def __init__(self):
pass
def loadCommands(self, environment):
return environment
def executeCommand(self, environment):
print(environment['commandInfo']['currCommand'])
if self.isCommandDefined(environment):
environment['commands'][environment['commandInfo']['currCommand']].run(environment)
environment['commandInfo']['currCommand'] = ''
return environment
def executeNextCommand(self, environment):
pass
def isShortcutDefined(self, environment):
return( environment['input']['currShortcutString'] in environment['bindings'])
def getCommandForShortcut(self, environment):
if not self.isShortcutDefined(environment):
return environment
environment['commandInfo']['currCommand'] = environment['bindings'][environment['input']['currShortcutString']]
return environment
def isCommandDefined(self, environment):
return( environment['commandInfo']['currCommand'] in environment['commands'])
def enqueueCommand(self, environment):
if not self.isCommandDefined(environment):
return False
return True