prepare for use etc as config

This commit is contained in:
chrys 2016-09-14 23:27:19 +02:00
parent cb1feb35ae
commit 7dad7e413c
3 changed files with 18 additions and 19 deletions

View File

@ -49,7 +49,7 @@ class commandManager():
return environment return environment
def executeCommand(self, environment, currCommand, section = 'commands'): def executeCommand(self, environment, currCommand, section = 'commands'):
if environment['generalInformation']['suspend']: if environment['runtime']['screenManager'].isSuspendingScreen(environment) :
return environment return environment
if self.isCommandDefined(environment): if self.isCommandDefined(environment):
try: try:

View File

@ -4,18 +4,18 @@ from utils import debug
class screenManager(): class screenManager():
def __init__(self): def __init__(self):
pass
def initialize(self, environment):
self.autoIgnoreScreens = [] self.autoIgnoreScreens = []
def initialize(self, environment):
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):
return environment return environment
def update(self, environment): def update(self, environment):
environment['generalInformation']['suspend'] = self.isSuspendingScreen(environment) if not self.isSuspendingScreen(environment):
if not environment['generalInformation']['suspend']:
environment = environment['runtime']['screenDriver'].update(environment) environment = environment['runtime']['screenDriver'].update(environment)
environment['screenData']['lastScreenUpdate'] = time.time() environment['screenData']['lastScreenUpdate'] = time.time()
return environment return environment

View File

@ -204,10 +204,12 @@ class settingsManager():
except: except:
return '' return ''
def initFenrirConfig(self): def initFenrirConfig(self, environment = environment.environment, settingsRoot = '/etc/fenrir/config/'):
return self.reInitFenrirConfig(environment.environment) if not os.path.exists(settingsRoot):
if os.path.exists('../../config/'):
def reInitFenrirConfig(self, environment, settingsRoot = '../../config/'): settingsRoot = '../../config/'
else:
return None
environment['runtime']['settingsManager'] = self environment['runtime']['settingsManager'] = self
environment['runtime']['debug'] = debug.debug() environment['runtime']['debug'] = debug.debug()
environment = environment['runtime']['settingsManager'].loadSettings(environment) environment = environment['runtime']['settingsManager'].loadSettings(environment)
@ -230,13 +232,10 @@ class settingsManager():
else: else:
environment = environment['runtime']['settingsManager'].loadSoundIcons(environment, self.getSetting(environment, 'sound','theme')) environment = environment['runtime']['settingsManager'].loadSoundIcons(environment, self.getSetting(environment, 'sound','theme'))
if environment['runtime']['inputManager'] == None:
environment['runtime']['inputManager'] = inputManager.inputManager() environment['runtime']['inputManager'] = inputManager.inputManager()
environment = environment['runtime']['inputManager'].initialize(environment) environment = environment['runtime']['inputManager'].initialize(environment)
if environment['runtime']['outputManager'] == None:
environment['runtime']['outputManager'] = outputManager.outputManager() environment['runtime']['outputManager'] = outputManager.outputManager()
environment = environment['runtime']['outputManager'].initialize(environment) environment = environment['runtime']['outputManager'].initialize(environment)
if environment['runtime']['commandManager'] == None:
environment['runtime']['commandManager'] = commandManager.commandManager() environment['runtime']['commandManager'] = commandManager.commandManager()
environment = environment['runtime']['commandManager'].initialize(environment) environment = environment['runtime']['commandManager'].initialize(environment)