add debug flag
This commit is contained in:
parent
b772c0736e
commit
045539bb46
@ -38,6 +38,7 @@ class fenrirManager():
|
||||
parser = argparse.ArgumentParser(description="Fenrir Help")
|
||||
parser.add_argument('-s', '--setting', metavar='SETTING-FILE', default='/etc/fenrir/settings/settings.conf', help='Use a specified settingsfile')
|
||||
parser.add_argument('-o', '--options', metavar='SECTION#SETTING=VALUE,..', default='', help='Overwrite options in given settings file')
|
||||
parser.add_argument('-d', '--debug', const=True, default='', nargs='?', help='Turns on Debugmode')
|
||||
try:
|
||||
args = parser.parse_args()
|
||||
except Exception as e:
|
||||
@ -54,7 +55,6 @@ class fenrirManager():
|
||||
if eventReceived:
|
||||
self.prepareCommand()
|
||||
if not (self.wasCommand or self.environment['general']['tutorialMode']) or self.environment['runtime']['screenManager'].isSuspendingScreen():
|
||||
print('ignore screen', self.environment['runtime']['screenManager'].isSuspendingScreen())
|
||||
self.environment['runtime']['inputManager'].writeEventBuffer()
|
||||
if self.environment['runtime']['inputManager'].noKeyPressed():
|
||||
if self.wasCommand:
|
||||
|
@ -226,8 +226,16 @@ class settingsManager():
|
||||
for key in keyList:
|
||||
if not key in self.env['input']['scriptKey']:
|
||||
self.env['input']['scriptKey'].append(key)
|
||||
def setOptionArgDict(self, section, option, value):
|
||||
section = section.lower()
|
||||
option = option.lower()
|
||||
try:
|
||||
e = self.settingArgDict[section]
|
||||
except KeyError:
|
||||
self.settingArgDict[section] = {}
|
||||
self.settingArgDict[section][option] = str(value)
|
||||
|
||||
def parseSettingArgs(self, settingArgs):
|
||||
optionArgDict = {}
|
||||
for optionElem in settingArgs.split(';'):
|
||||
if len(optionElem.split('#',1)) != 2:
|
||||
continue
|
||||
@ -236,13 +244,8 @@ class settingsManager():
|
||||
section = str(optionElem.split('#',1)[0]).lower()
|
||||
option = str(optionElem.split('#',1)[1].split('=',1)[0]).lower()
|
||||
value = optionElem.split('#',1)[1].split('=',1)[1]
|
||||
try:
|
||||
e = optionArgDict[section]
|
||||
except KeyError:
|
||||
optionArgDict[section] = {}
|
||||
optionArgDict[section][option] = str(value)
|
||||
print(optionArgDict)
|
||||
return optionArgDict
|
||||
self.setOptionArgDict(section, option, value)
|
||||
|
||||
def initFenrirConfig(self, cliArgs, fenrirManager = None, environment = environment.environment):
|
||||
settingsRoot = '/etc/fenrir/'
|
||||
settingsFile = cliArgs.setting
|
||||
@ -272,8 +275,12 @@ class settingsManager():
|
||||
validConfig = environment['runtime']['settingsManager'].loadSettings(settingsFile)
|
||||
if not validConfig:
|
||||
return None
|
||||
|
||||
if cliArgs.options != '':
|
||||
self.settingArgDict = self.parseSettingArgs(cliArgs.options)
|
||||
self.parseSettingArgs(cliArgs.options)
|
||||
if cliArgs.debug:
|
||||
self.setOptionArgDict('general', 'debugLevel', 3)
|
||||
|
||||
self.setFenrirKeys(self.getSetting('general','fenrirKeys'))
|
||||
self.setScriptKeys(self.getSetting('general','scriptKeys'))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user