from glob import glob
from os.path import join as pjoin
from os.path import basename
from glob import glob
from os.path import join as pjoin
from os.path import basename
+from os.path import getsize
from loganalyse import LogFileAnalyser
from pprint import pprint
from loganalyse import LogFileAnalyser
from pprint import pprint
self.logDir = tkFileDialog.askdirectory()
if self.logDir :
self.logFiles = glob(pjoin(self.logDir, '*.log'))
self.logDir = tkFileDialog.askdirectory()
if self.logDir :
self.logFiles = glob(pjoin(self.logDir, '*.log'))
+ self._cleanupJunkFiles()
self.logFiles.sort()
self.dataFrame.grid(row=0, column=0, sticky=NW)
self.nav.setSize(len(self.logFiles))
self.nav.grid(row=0, column=1)
self.loadLogFile(self.nav)
self.logFiles.sort()
self.dataFrame.grid(row=0, column=0, sticky=NW)
self.nav.setSize(len(self.logFiles))
self.nav.grid(row=0, column=1)
self.loadLogFile(self.nav)
+ def _cleanupJunkFiles(self) :
+ files = []
+ while self.logFiles :
+ f = self.logFiles.pop()
+ if not getsize(f) :
+ continue
+ # TODO : vérifier qu'il existe des événements
+ else :
+ files.append(f)
+
+ self.logFiles = files
+
+
def loadLogFile(self, nav) :
index = nav.index - 1
filepath = self.logFiles[index]
def loadLogFile(self, nav) :
index = nav.index - 1
filepath = self.logFiles[index]