From 7821f2a454f6a37af96e285e8b72e6b89bbbf5ad Mon Sep 17 00:00:00 2001 From: Jonathan Harris Date: Sun, 24 Jul 2016 14:05:33 +0100 Subject: [PATCH] Don't enable VerboseLogging in E:D client No longer needed with E:D 2.2 journal. Partially reverts 5b1cb25. --- monitor.py | 71 ------------------------------------------------------ 1 file changed, 71 deletions(-) diff --git a/monitor.py b/monitor.py index d6c2846d..42742fca 100644 --- a/monitor.py +++ b/monitor.py @@ -70,52 +70,6 @@ class EDLogs(FileSystemEventHandler): self.callbacks = { 'Jump': None, 'Dock': None } self.last_event = None # for communicating the Jump event - def logging_enabled_in_file(self, appconf): - if not isfile(appconf): - return False - - with open(appconf, 'rU') as f: - content = f.read().lower() - start = content.find('') - if start >= 0 and end >= 0: - return bool(re.search('verboselogging\s*=\s*\"1\"', content[start+8:end])) - else: - return False - - def enable_logging_in_file(self, appconf): - try: - if not exists(appconf): - with open(appconf, 'wt') as f: - f.write('\n\t\n\t\n\n') - return True - - with open(appconf, 'rU') as f: - content = f.read() - f.close() - backup = appconf[:-4] + '_backup.xml' - if exists(backup): - unlink(backup) - rename(appconf, backup) - - with open(appconf, 'wt') as f: - start = content.lower().find('= 0: - f.write(content[:start+8] + '\n\t\tVerboseLogging="1"' + content[start+8:]) - else: - start = content.lower().find("") - if start >= 0: - f.write(content[:start] + '\t\n\t\n' + content[start:]) - else: - f.write(content) # eh ? - return False - - assert self._logging_enabled() - return self.logging_enabled_in_file(appconf) - except: - if __debug__: print_exc() - return False - def set_callback(self, name, callback): if name in self.callbacks: self.callbacks[name] = callback @@ -127,9 +81,6 @@ class EDLogs(FileSystemEventHandler): return False if self.running(): return True - if not self._logging_enabled(): - # verbose logging reduces likelihood that Docked/Undocked messages will be delayed - self._enable_logging() self.root.bind_all('<>', self.jump) # user-generated self.root.bind_all('<>', self.dock) # user-generated @@ -278,13 +229,6 @@ class EDLogs(FileSystemEventHandler): else: return None - def _logging_enabled(self): - return self.logdir and self.logging_enabled_in_file(join(self.logdir, pardir, 'AppConfigLocal.xml')) - - def _enable_logging(self): - return self.logdir and self.enable_logging_in_file(join(self.logdir, pardir, 'AppConfigLocal.xml')) - - elif platform=='win32': def _logdir(self): @@ -360,25 +304,10 @@ class EDLogs(FileSystemEventHandler): return None - def _logging_enabled(self): - return self.logdir and (self.logging_enabled_in_file(join(self.logdir, pardir, 'AppConfigLocal.xml')) or - self.logging_enabled_in_file(join(self.logdir, pardir, 'AppConfig.xml'))) - - def _enable_logging(self): - return self.logdir and self.enable_logging_in_file(isfile(join(self.logdir, pardir, 'AppConfigLocal.xml')) and join(self.logdir, pardir, 'AppConfigLocal.xml') or join(self.logdir, pardir, 'AppConfig.xml')) - - elif platform=='linux2': def _logdir(self): return None - def _logging_enabled(self): - return False - - def _enable_logging(self): - return False - - # singleton monitor = EDLogs()