From: pin Date: Fri, 23 Jul 2010 14:52:20 +0000 (+0000) Subject: Ça s'affiche déjà un peu plus joliment. X-Git-Url: https://svn.cri.ensmp.fr/git/minwii.git/commitdiff_plain/18017198ab84bb6482239ff5b621cd490b144c9a?hp=a3fc67f3b4b1b435f90c5d823416b6ec5340b215 Ça s'affiche déjà un peu plus joliment. git-svn-id: https://svn.cri.ensmp.fr/svn/minwii/trunk@289 fe552daf-6dbe-4428-90eb-1537e0879342 --- diff --git a/src/minwii/logapp.py b/src/minwii/logapp.py index 4c680ba..a632d60 100755 --- a/src/minwii/logapp.py +++ b/src/minwii/logapp.py @@ -21,6 +21,7 @@ class Application(Frame) : self.createWidgets() self.logDir = '' self.logFiles = [] + self.resultsFrame = None def configureStretching(self) : top=self.winfo_toplevel() @@ -39,7 +40,7 @@ class Application(Frame) : self.identFrame = Identification(df) self.identFrame.grid(sticky=NW) self.nav = Navbar(df, incCallback=self.loadLogFile, decCallback=self.loadLogFile) - self.nav.grid() +# self.nav.grid() # barre de boutons @@ -52,9 +53,12 @@ class Application(Frame) : self.chooseLogDir = Button(bf, text="Parcourir…", command=self.openFileDialog) self.chooseLogDir.grid(row=0, column=0, sticky=W) + + self.nav = Navbar(bf, incCallback=self.loadLogFile, decCallback=self.loadLogFile) + #self.nav.grid(row=0, column=1) self.quitButton = Button(bf, text='Terminer', command=self.quit) - self.quitButton.grid(row=0, column=1, sticky=E) + self.quitButton.grid(row=0, column=2, sticky=E) def openFileDialog(self) : self.logDir = tkFileDialog.askdirectory() @@ -63,6 +67,7 @@ class Application(Frame) : 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 loadLogFile(self, nav) : @@ -70,9 +75,11 @@ class Application(Frame) : filepath = self.logFiles[index] filename = basename(filepath) self.identFrame.setFileName(filename) - rf = ResultsFrame(self.dataFrame, filepath) - rf.layResults() - rf.grid() + if self.resultsFrame : + self.resultsFrame.destroy() + self.resultsFrame = ResultsFrame(self.dataFrame, filepath) + self.resultsFrame.layResults() + self.resultsFrame.grid() class Navbar(Frame) : @@ -83,7 +90,6 @@ class Navbar(Frame) : self.setSize(size) self.incCallback = incCallback if incCallback else lambda x : None self.decCallback = decCallback if decCallback else lambda x : None - self.grid() self.caption.set('%d / %d' % (self.index, self.to)) def createWidgets(self) : @@ -168,9 +174,18 @@ class ResultsFrame(Frame) : def layResults(self) : lfa = LogFileAnalyser(self.logFilePath) results = lfa.analyse() - pprint(results) - rawPrint = Label(self, text=str(results)) - rawPrint.grid() + if results : + for i, kv in enumerate(results.items()) : + k, v = kv + kl = Label(self, text='%s :' % k) + kl.grid(row=i, column=0, sticky=E) + + vl = Label(self, text=v) + vl.grid(row=i, column=1, sticky=W) + else : + msg = Label(self, text="Pas de données exploitables.") + msg.grid() + app = Application()