fix debug
This commit is contained in:
parent
6634df1999
commit
e8a0a63c38
@ -28,9 +28,11 @@ class debugManager():
|
|||||||
directory = os.path.dirname(self._fileName)
|
directory = os.path.dirname(self._fileName)
|
||||||
if not os.path.exists(directory):
|
if not os.path.exists(directory):
|
||||||
pathlib.Path(directory).mkdir(parents=True, exist_ok=True)
|
pathlib.Path(directory).mkdir(parents=True, exist_ok=True)
|
||||||
|
try:
|
||||||
self._file = open(self._fileName,'a')
|
self._file = open(self._fileName,'a')
|
||||||
self._fileOpened = True
|
self._fileOpened = True
|
||||||
|
except Exception as e:
|
||||||
|
print(e)
|
||||||
def writeDebugOut(self, text, level = debug.debugLevel.DEACTIVE, onAnyLevel=False):
|
def writeDebugOut(self, text, level = debug.debugLevel.DEACTIVE, onAnyLevel=False):
|
||||||
|
|
||||||
mode = self.env['runtime']['settingsManager'].getSetting('general','debugMode')
|
mode = self.env['runtime']['settingsManager'].getSetting('general','debugMode')
|
||||||
@ -57,13 +59,18 @@ class debugManager():
|
|||||||
if printMode:
|
if printMode:
|
||||||
print(msg)
|
print(msg)
|
||||||
if fileMode:
|
if fileMode:
|
||||||
|
try:
|
||||||
self._file.write(msg + '\n')
|
self._file.write(msg + '\n')
|
||||||
|
except Exception as e:
|
||||||
|
print(e)
|
||||||
def closeDebugFile(self):
|
def closeDebugFile(self):
|
||||||
if not self._fileOpened:
|
if not self._fileOpened:
|
||||||
return False
|
return False
|
||||||
if self._file != None:
|
if self._file != None:
|
||||||
|
try:
|
||||||
self._file.close()
|
self._file.close()
|
||||||
|
except Exception as e:
|
||||||
|
print(e)
|
||||||
self._fileOpened = False
|
self._fileOpened = False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
@ -286,9 +286,6 @@ class settingsManager():
|
|||||||
if not validConfig:
|
if not validConfig:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
environment['runtime']['debug'] = debugManager.debugManager(self.env['runtime']['settingsManager'].getSetting('general','debugFile'))
|
|
||||||
environment['runtime']['debug'].initialize(environment)
|
|
||||||
|
|
||||||
if cliArgs.options != '':
|
if cliArgs.options != '':
|
||||||
self.parseSettingArgs(cliArgs.options)
|
self.parseSettingArgs(cliArgs.options)
|
||||||
if cliArgs.debug:
|
if cliArgs.debug:
|
||||||
@ -299,6 +296,9 @@ class settingsManager():
|
|||||||
self.setFenrirKeys(self.getSetting('general','fenrirKeys'))
|
self.setFenrirKeys(self.getSetting('general','fenrirKeys'))
|
||||||
self.setScriptKeys(self.getSetting('general','scriptKeys'))
|
self.setScriptKeys(self.getSetting('general','scriptKeys'))
|
||||||
|
|
||||||
|
environment['runtime']['debug'] = debugManager.debugManager(self.env['runtime']['settingsManager'].getSetting('general','debugFile'))
|
||||||
|
environment['runtime']['debug'].initialize(environment)
|
||||||
|
|
||||||
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