From: pin Date: Fri, 23 Jul 2010 09:53:54 +0000 (+0000) Subject: Ajout affichage du nom du fichier. X-Git-Url: https://scm.cri.mines-paristech.fr/git/minwii.git/commitdiff_plain/aad4f1d5575ea73d106c9c40a96e29121d213342?ds=inline Ajout affichage du nom du fichier. git-svn-id: https://svn.cri.ensmp.fr/svn/minwii/trunk@286 fe552daf-6dbe-4428-90eb-1537e0879342 --- diff --git a/src/minwii/logapp.py b/src/minwii/logapp.py index 0981be2..2f5cc4f 100755 --- a/src/minwii/logapp.py +++ b/src/minwii/logapp.py @@ -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()