more work on restructure (screenManager, input handling)

This commit is contained in:
chrys
2016-09-04 15:04:23 +02:00
parent 9d63a30597
commit ae71bd4ef7
5 changed files with 23 additions and 13 deletions

View File

@ -35,7 +35,7 @@ class commandManager():
return environment
def executeTriggerCommands(self, environment, trigger):
if environment['generalInformation']['suspend']:
if environment['runtime']['screenManager'].isSuspendingScreen(environment) :
return environment
for cmd in sorted(environment['commands'][trigger]):
try:
@ -43,6 +43,7 @@ class commandManager():
if environ != None:
environment = environ
except Exception as e:
print(e)
environment['runtime']['debug'].writeDebugOut(environment,"Error while executing trigger:" + trigger + "." + cmd ,debug.debugLevel.ERROR)
environment['runtime']['debug'].writeDebugOut(environment,str(e),debug.debugLevel.ERROR)
return environment
@ -56,21 +57,27 @@ class commandManager():
if environ != None:
environment = environ
except Exception as e:
print(e)
environment['runtime']['debug'].writeDebugOut(environment,"Error while executing command:" + section + "." + currCommand ,debug.debugLevel.ERROR)
environment['runtime']['debug'].writeDebugOut(environment,str(e),debug.debugLevel.ERROR)
environment['commandInfo']['currCommand'] = ''
environment['commandInfo']['lastCommandTime'] = time.time()
return environment
def isShortcutDefined(self, environment):
def isShortcutDefined(self, environment, currCommand):
return( environment['input']['currShortcutString'] in environment['bindings'])
def getCommandForShortcut(self, environment):
def setCurrCommandForExec(self, environment, currCommand=''):
if not self.isShortcutDefined(environment):
return environment
environment['commandInfo']['currCommand'] = environment['bindings'][environment['input']['currShortcutString']]
environment['commandInfo']['currCommand'] = currCommand
return environment
def getCommandForShortcut(self, environment, currShortcutString):
if not self.isShortcutDefined(environment):
return environment
return environment['bindings'][currShortcutString]
def isCommandDefined(self, environment):
return( environment['commandInfo']['currCommand'] in environment['commands']['commands'])
def isCommandDefined(self, environment, currCommand):
return( currCommand in environment['commands']['commands'])

View File

@ -2,5 +2,4 @@
generalInformation = {
'running': True,
'suspend': False,
}

View File

@ -13,8 +13,9 @@ class screenManager():
environment['generalInformation']['suspend'] = self.isSuspendingScreen(environment)
if not environment['generalInformation']['suspend']:
environment = environment['runtime']['screenDriver'].update(environment)
environment['screenData']['lastScreenUpdate'] = time.time()
return environment
def isSuspendingScreen(self, environment):
return environment['runtime']['screenDriver'].getCurrScreen() in \
environment['runtime']['settingsManager'].getSetting(environment,'screen', 'suspendingScreen').split(',')