add debug flag
This commit is contained in:
parent
b772c0736e
commit
045539bb46
@ -37,7 +37,8 @@ class fenrirManager():
|
|||||||
args = None
|
args = None
|
||||||
parser = argparse.ArgumentParser(description="Fenrir Help")
|
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('-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('-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:
|
try:
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
@ -54,7 +55,6 @@ class fenrirManager():
|
|||||||
if eventReceived:
|
if eventReceived:
|
||||||
self.prepareCommand()
|
self.prepareCommand()
|
||||||
if not (self.wasCommand or self.environment['general']['tutorialMode']) or self.environment['runtime']['screenManager'].isSuspendingScreen():
|
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()
|
self.environment['runtime']['inputManager'].writeEventBuffer()
|
||||||
if self.environment['runtime']['inputManager'].noKeyPressed():
|
if self.environment['runtime']['inputManager'].noKeyPressed():
|
||||||
if self.wasCommand:
|
if self.wasCommand:
|
||||||
|
@ -226,8 +226,16 @@ class settingsManager():
|
|||||||
for key in keyList:
|
for key in keyList:
|
||||||
if not key in self.env['input']['scriptKey']:
|
if not key in self.env['input']['scriptKey']:
|
||||||
self.env['input']['scriptKey'].append(key)
|
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):
|
def parseSettingArgs(self, settingArgs):
|
||||||
optionArgDict = {}
|
|
||||||
for optionElem in settingArgs.split(';'):
|
for optionElem in settingArgs.split(';'):
|
||||||
if len(optionElem.split('#',1)) != 2:
|
if len(optionElem.split('#',1)) != 2:
|
||||||
continue
|
continue
|
||||||
@ -236,13 +244,8 @@ class settingsManager():
|
|||||||
section = str(optionElem.split('#',1)[0]).lower()
|
section = str(optionElem.split('#',1)[0]).lower()
|
||||||
option = str(optionElem.split('#',1)[1].split('=',1)[0]).lower()
|
option = str(optionElem.split('#',1)[1].split('=',1)[0]).lower()
|
||||||
value = optionElem.split('#',1)[1].split('=',1)[1]
|
value = optionElem.split('#',1)[1].split('=',1)[1]
|
||||||
try:
|
self.setOptionArgDict(section, option, value)
|
||||||
e = optionArgDict[section]
|
|
||||||
except KeyError:
|
|
||||||
optionArgDict[section] = {}
|
|
||||||
optionArgDict[section][option] = str(value)
|
|
||||||
print(optionArgDict)
|
|
||||||
return optionArgDict
|
|
||||||
def initFenrirConfig(self, cliArgs, fenrirManager = None, environment = environment.environment):
|
def initFenrirConfig(self, cliArgs, fenrirManager = None, environment = environment.environment):
|
||||||
settingsRoot = '/etc/fenrir/'
|
settingsRoot = '/etc/fenrir/'
|
||||||
settingsFile = cliArgs.setting
|
settingsFile = cliArgs.setting
|
||||||
@ -272,11 +275,15 @@ class settingsManager():
|
|||||||
validConfig = environment['runtime']['settingsManager'].loadSettings(settingsFile)
|
validConfig = environment['runtime']['settingsManager'].loadSettings(settingsFile)
|
||||||
if not validConfig:
|
if not validConfig:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
if cliArgs.options != '':
|
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.setFenrirKeys(self.getSetting('general','fenrirKeys'))
|
||||||
self.setScriptKeys(self.getSetting('general','scriptKeys'))
|
self.setScriptKeys(self.getSetting('general','scriptKeys'))
|
||||||
|
|
||||||
if not os.path.exists(self.getSetting('keyboard','keyboardLayout')):
|
if not os.path.exists(self.getSetting('keyboard','keyboardLayout')):
|
||||||
if os.path.exists(settingsRoot + 'keyboard/' + self.getSetting('keyboard','keyboardLayout')):
|
if os.path.exists(settingsRoot + 'keyboard/' + self.getSetting('keyboard','keyboardLayout')):
|
||||||
self.setSetting('keyboard', 'keyboardLayout', settingsRoot + 'keyboard/' + self.getSetting('keyboard','keyboardLayout'))
|
self.setSetting('keyboard', 'keyboardLayout', settingsRoot + 'keyboard/' + self.getSetting('keyboard','keyboardLayout'))
|
||||||
|
Loading…
Reference in New Issue
Block a user