0981be2df3a6510149623194680dddccc8fb8d3f
1 # -*- coding: utf-8 -*-
3 Interface graphique pour l'analyse des fichiers de log minwii.
12 from os
.path
import join
as pjoin
14 class Application(Frame
) :
15 def __init__(self
, master
=None) :
16 Frame
.__init
__(self
, master
)
17 self
.configureStretching()
22 def configureStretching(self
) :
23 top
=self
.winfo_toplevel()
24 top
.rowconfigure(0, weight
=1)
25 top
.columnconfigure(0, weight
=1)
27 self
.grid(sticky
=N
+S
+E
+W
, padx
=10, pady
=10)
28 self
.rowconfigure(0, weight
=1)
29 self
.columnconfigure(0, weight
=1)
31 def createWidgets(self
) :
32 # zone d'affichage des données'
33 self
.dataFrame
= df
= Frame(self
)
36 self
.identFrame
= Identification(df
)
37 self
.identFrame
.grid(sticky
=NW
)
43 self
.btnFrame
= bf
= Frame(self
)
44 bf
.grid(row
=1, column
=0, sticky
=W
+S
+E
)
45 bf
.rowconfigure(0, weight
=1)
46 bf
.columnconfigure(0, weight
=1)
47 bf
.columnconfigure(1, weight
=1)
50 self
.chooseLogDir
= Button(bf
, text
="Parcourir…", command
=self
.openFileDialog
)
51 self
.chooseLogDir
.grid(row
=0, column
=0, sticky
=W
)
53 self
.quitButton
= Button(bf
, text
='Terminer', command
=self
.quit
)
54 self
.quitButton
.grid(row
=0, column
=1, sticky
=E
)
56 def openFileDialog(self
) :
57 self
.logDir
= tkFileDialog
.askdirectory()
59 self
.logFiles
= glob(pjoin(self
.logDir
, '*.log'))
61 self
.dataFrame
.grid(row
=0, column
=0, sticky
=NW
)
65 def __init__(self
, master
=None, from_
=1, to
=10, start
=1, step
=1) :
66 Frame
.__init
__(self
, master
)
72 self
.caption
= StringVar()
73 self
.caption
.set('%d / %d' % (self
.index
, self
.to
))
76 def createWidgets(self
) :
77 self
.backBtn
= Button(self
,
79 state
= DISABLED
if self
.index
==self
.from_
else NORMAL
,
82 self
.backBtn
.grid(row
=0, column
=0)
84 self
.lbl
= Label(self
, textvariable
=self
.caption
)
85 self
.lbl
.grid(row
=0, column
=1)
87 self
.nextBtn
= Button(self
,
89 state
= DISABLED
if self
.index
==self
.to
else NORMAL
,
91 self
.nextBtn
.grid(row
=0, column
=2)
94 self
.index
= self
.index
- self
.step
95 self
.caption
.set('%d / %d' % (self
.index
, self
.to
))
96 if self
.index
== self
.from_
:
97 self
.backBtn
.configure(state
=DISABLED
)
98 if self
.index
< self
.to
:
99 self
.nextBtn
.configure(state
=NORMAL
)
102 self
.index
= self
.index
+ self
.step
103 self
.caption
.set('%d / %d' % (self
.index
, self
.to
))
104 if self
.index
== self
.to
:
105 self
.nextBtn
.configure(state
=DISABLED
)
106 if self
.index
> self
.from_
:
107 self
.backBtn
.configure(state
=NORMAL
)
110 class Identification(Frame
) :
111 def __init__(self
, master
=None) :
112 Frame
.__init
__(self
, master
)
115 def createWidgets(self
) :
116 nameLbl
= Label(self
, text
='Patient :')
117 nameLbl
.grid(row
=0, column
=0)
119 self
.nameEntry
= Entry(self
, width
=40)
120 self
.nameEntry
.grid(row
=0, column
=1)
122 commentsLbl
= Label(self
, text
='Commentaires :')
123 commentsLbl
.grid(row
=1, column
=0)
125 self
.commentsText
= Text(self
, width
=40, height
=4, undo
=True, wrap
=WORD
)
126 self
.commentsText
.grid(row
=1, column
=1)
130 app
.master
.title("Analyseur des sessions MINWii")