self.resultsFrame = None
# debug
- self.chooseDirDialog(dir='/Users/pinbe/minwii_logs')
+ #self.chooseDirDialog(dir='/Users/pinbe/minwii_logs')
def configureStretching(self) :
top=self.winfo_toplevel()
def chooseDirDialog(self, dir=None) :
if dir is None :
- self.logDir = tkFileDialog.askdirectory()
+ self.logDir = tkFileDialog.askdirectory(title='Sélectionnez un dossier de fichiers de logs')
else :
self.logDir = dir
if self.logDir :
self.logFiles = glob(pjoin(self.logDir, '*.log'))
self._cleanupJunkFiles()
self.logFiles.sort()
+ self.logFiles.reverse()
self.dataFrame.grid(row=0, column=0, sticky=NW)
self.nav.setSize(len(self.logFiles))
self.nav.grid(row=0, column=1)
def _cleanupJunkFiles(self) :
files = []
+ junk = []
while self.logFiles :
f = self.logFiles.pop()
if not getsize(f) :
- os.remove(f)
+ junk.append(f)
continue
- # TODO : vérifier qu'il existe des événements
else :
+ lfa = LogFileAnalyser(f)
+ if lfa.getLastEventTicks() is None :
+ junk.append(f)
+ continue
+
files.append(f)
+ for f in junk :
+ os.remove(f)
+
self.logFiles = files
lfa = LogFileAnalyser(self.logFilePath)
results = lfa.analyse()
if results :
- for i, kv in enumerate(results.items()) :
+ for i, kv in enumerate(results) :
k, v = kv
kl = Label(self, text='%s :' % k)
kl.grid(row=i, column=0, sticky=E)