Ajout affichage du nom du fichier.
authorpin <pin@fe552daf-6dbe-4428-90eb-1537e0879342>
Fri, 23 Jul 2010 09:53:54 +0000 (09:53 +0000)
committerpin <pin@fe552daf-6dbe-4428-90eb-1537e0879342>
Fri, 23 Jul 2010 09:53:54 +0000 (09:53 +0000)
git-svn-id: https://svn.cri.ensmp.fr/svn/minwii/trunk@286 fe552daf-6dbe-4428-90eb-1537e0879342

src/minwii/logapp.py

index 0981be2..2f5cc4f 100755 (executable)
@@ -58,7 +58,8 @@ class Application(Frame) :
         if self.logDir :
              self.logFiles = glob(pjoin(self.logDir, '*.log'))
              self.logFiles.sort()
-        self.dataFrame.grid(row=0, column=0, sticky=NW)
+             self.dataFrame.grid(row=0, column=0, sticky=NW)
+             self.nav.setFileList(self.logFiles)
 
 
 class Navbar(Frame) :
@@ -90,40 +91,62 @@ class Navbar(Frame) :
                               command = self.inc)
         self.nextBtn.grid(row=0, column=2)
     
-    def dec(self) :
-        self.index = self.index - self.step
-        self.caption.set('%d / %d' % (self.index, self.to))
+    def refreshStates(self) :
         if self.index == self.from_ :
             self.backBtn.configure(state=DISABLED)
+        else :
+            self.backBtn.configure(state=NORMAL)
+
         if self.index < self.to :
             self.nextBtn.configure(state=NORMAL)
+        else :
+            self.nextBtn.configure(state=DISABLED)
+
+        self.caption.set('%d / %d' % (self.index, self.to))
+        
+    
+    def dec(self) :
+        self.index = self.index - self.step
+        self.refreshStates()
     
     def inc(self) :
         self.index = self.index + self.step
-        self.caption.set('%d / %d' % (self.index, self.to))
-        if self.index == self.to :
-            self.nextBtn.configure(state=DISABLED)
-        if self.index > self.from_ :
-            self.backBtn.configure(state=NORMAL)
+        self.refreshStates()
+
+    def setFileList(self, fileList) :
+        self.fileList = fileList
+        self.from_ = 1
+        self.to = len(self.fileList)
+        self.index = 1
+        self.refreshStates()
+    
+    def getFile(self) :
+        return self.fileList[self.index - 1]
 
 
 class Identification(Frame) :
     def __init__(self, master=None) :
         Frame.__init__(self, master)
+        self.fileName = StringVar()
         self.createWidgets()
     
     def createWidgets(self) :
+        fileLbl = Label(self, text='Fichier :')
+        fileLbl.grid(row=0, column=0)
+
+        fileNameLbl = Label(self, textvariable=self.fileName)
+        
         nameLbl = Label(self, text='Patient :')
-        nameLbl.grid(row=0, column=0)
+        nameLbl.grid(row=1, column=0)
         
         self.nameEntry = Entry(self, width=40)
-        self.nameEntry.grid(row=0, column=1)
+        self.nameEntry.grid(row=1, column=1)
         
         commentsLbl = Label(self, text='Commentaires :')
-        commentsLbl.grid(row=1, column=0)
+        commentsLbl.grid(row=2, column=0)
         
         self.commentsText = Text(self, width=40, height=4, undo=True, wrap=WORD)
-        self.commentsText.grid(row=1, column=1)
+        self.commentsText.grid(row=2, column=1)
     
 
 app = Application()