From 1ba1c6642bcd08f1fde82e6b0d99927346df752b Mon Sep 17 00:00:00 2001 From: pin Date: Mon, 26 Jul 2010 11:45:18 +0000 Subject: [PATCH] =?utf8?q?Ajout=20d'une=20m=C3=A9thode=20pour=20supprimer?= =?utf8?q?=20les=20fichiers=20de=20log=20vides.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit git-svn-id: https://svn.cri.ensmp.fr/svn/minwii/trunk@290 fe552daf-6dbe-4428-90eb-1537e0879342 --- src/minwii/logapp.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/minwii/logapp.py b/src/minwii/logapp.py index a632d60..16be558 100755 --- a/src/minwii/logapp.py +++ b/src/minwii/logapp.py @@ -11,6 +11,7 @@ import tkFileDialog 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 @@ -64,12 +65,26 @@ class Application(Frame) : 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) + 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] -- 2.20.1