Merge branch 'master' of http://www.netdig.org/git/iramuteq
[iramuteq] / dialog.py
1 #!/bin/env python
2 # -*- coding: utf-8 -*-
3 #Author: Pierre Ratinaud
4 #Copyright (c) 2008-2009 Pierre Ratinaud
5 #Lisense: GNU/GPL
6 import  wx
7 import  wx.lib.colourselect as  csel
8 import wx.lib.sized_controls as sc
9 import wx.lib.filebrowsebutton as filebrowse
10 import locale
11 import os
12 import sys
13 #from listlex import *
14 from KeyFrame import AlcOptFrame
15 #from listlex import ListForSpec
16 #---------------------------------------------------------------------------
17 provider = wx.SimpleHelpProvider()
18 wx.HelpProvider_Set(provider)
19
20 #---------------------------------------------------------------------------
21
22
23 encodages = [[u'cp1252',u'Western Europe'], [u'utf-8',u'all languages'], [u'MacRoman',u'Western Europe'], [u'ascii', u'English'], [u'big5', u'Traditional Chinese'], [u'big5hkscs', u'Traditional Chinese'], [u'cp037', u'English'], [u'cp424', u'Hebrew'], [u'cp437', u'English'], [u'cp500', u'Western Europe'], [u'cp737', u'Greek'], [u'cp775', u'Baltic languages'], [u'cp850', u'Western Europe'], [u'cp852', u'Central and Eastern Europe'], [u'cp855', u'Bulg, Byelorus, Mace, Rus, Serb'], [u'cp856', u'Hebrew'], [u'cp857', u'Turkish'], [u'cp860', u'Portuguese'], [u'cp861', u'Icelandic'], [u'cp862', u'Hebrew'], [u'cp863', u'Canadian'], [u'cp864', u'Arabic'], [u'cp865', u'Danish, Norwegian'], [u'cp866', u'Russian'], [u'cp869', u'Greek'], [u'cp874', u'Thai'], [u'cp875', u'Greek'], [u'cp932', u'Japanese'], [u'cp949', u'Korean'], [u'cp950', u'Traditional Chinese'], [u'cp1006', u'Urdu'], [u'cp1026', u'Turkish'], [u'cp1140', u'Western Europe'], [u'cp1250', u'Central and Eastern Europe'], [u'cp1251', u'Bulg, Byelorus, Mace, Rus, Serb'], [u'cp1253', u'Greek'], [u'cp1254', u'Turkish'], [u'cp1255', u'Hebrew'], [u'cp1256', u'Arabic'], [u'cp1257', u'Baltic languages'], [u'cp1258', u'Vietnamese'], [u'euc_jp', u'Japanese'], [u'euc_jis_2004', u'Japanese'], [u'euc_jisx0213', u'Japanese'], [u'euc_kr', u'Korean'], [u'gb2312', u'Simplified Chinese'], [u'gbk', u'Unified Chinese'], [u'gb18030', u'Unified Chinese'], [u'hz', u'Simplified Chinese'], [u'iso2022_jp', u'Japanese'], [u'iso2022_jp_1', u'Japanese'], [u'iso2022_jp_2', u'Jp, K, S C, WE, G'], [u'iso2022_jp_2004', u'Japanese'], [u'iso2022_jp_3', u'Japanese'], [u'iso2022_jp_ext', u'Japanese'], [u'iso2022_kr', u'Korean'], [u'latin_1', u'West Europe'], [u'iso8859_2', u'Central and Eastern Europe'], [u'iso8859_3', u'Esperanto, Maltese'], [u'iso8859_4', u'Baltic languages'], [u'iso8859_5', u'Bulg, Byelorus, Mace, Rus, Serb'], [u'iso8859_6', u'Arabic'], [u'iso8859_7', u'Greek'], [u'iso8859_8', u'Hebrew'], [u'iso8859_9', u'Turkish'], [u'iso8859_10', u'Nordic languages'], [u'iso8859_13', u'Baltic languages'], [u'iso8859_14', u'Celtic languages'], [u'iso8859_15', u'Western Europe'], [u'iso8859_16', u'South-Eastern Europe'], [u'johab', u'Korean'], [u'koi8_r', u'Russian'], [u'koi8_u', u'Ukrainian'], [u'mac_cyrillic', u'Bulg, Byelorus, Mace, Rus, Serb'], [u'mac_greek', u'Greek'], [u'mac_iceland', u'Icelandic'], [u'mac_latin2', u'Central and Eastern Europe'], [u'mac_turkish', u'Turkish'], [u'ptcp154', u'Kazakh'], [u'shift_jis', u'Japanese'], [u'shift_jis_2004', u'Japanese'], [u'shift_jisx0213', u'Japanese'], [u'utf_32', u'all languages'], [u'utf_32_be', u'all languages'], [u'utf_32_le', u'all languages'], [u'utf_16', u'all languages'], [u'utf_16_be', u'all languages (BMP only)'], [u'utf_16_le', u'all languages (BMP only)'], [u'utf_7', u'all languages'], [u'utf_8_sig', u'all languages']]
24
25 class FileOptionDialog(wx.Dialog):
26     def __init__(
27             self, parent, ID, title, sep=False, sheet = False, size=wx.DefaultSize, pos=wx.DefaultPosition,
28             style=wx.DEFAULT_DIALOG_STYLE
29             ):
30
31         pre = wx.PreDialog()
32         pre.SetExtraStyle(wx.DIALOG_EX_CONTEXTHELP)
33         pre.Create(parent, ID, title, pos, size, style)
34
35         self.PostCreate(pre)
36
37         sizer = wx.BoxSizer(wx.VERTICAL)
38         grid_sizer = wx.FlexGridSizer(0, 2, 2, 2)
39 ##############################
40
41         label = wx.StaticText(self, -1, u"La première ligne contient les noms de colonne")
42         label.SetHelpText(u"La première ligne contient les noms de colonne")
43         grid_sizer.Add(label, 0, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
44         on = ["oui", "non"]
45         self.radio_box_1 = wx.RadioBox(self, -1, u"", choices=on, majorDimension=0, style=wx.RA_SPECIFY_ROWS)
46         self.radio_box_1.SetHelpText(u"La première ligne contient les noms de colonne")
47         grid_sizer.Add(self.radio_box_1, 1, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
48
49 ##############################
50
51         label = wx.StaticText(self, -1, u"La première colonne contient un identifiant")
52         label.SetHelpText(u"La première colonne contient un identifiant")
53         grid_sizer.Add(label, 0, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
54         on = ["oui", "non"]
55         self.radio_box_2 = wx.RadioBox(self, -1, u"", choices=on, majorDimension=0, style=wx.RA_SPECIFY_ROWS)
56         self.radio_box_2.SetHelpText(u"La première colonne contient un identifiant")
57         grid_sizer.Add(self.radio_box_2, 1, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
58
59 ##############################
60         if sep:
61             label = wx.StaticText(self, -1, u"Séparateur de colonne")
62             label.SetHelpText(u"Quel charactère sépare les colonnes ?")
63             grid_sizer.Add(label, 0, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
64             self.colsep = [";", "tabulation", ","]
65             self.choice3 = wx.Choice(self, -1, (100, 50), choices=self.colsep)
66             self.choice3.SetHelpText(u"Quel charactère sépare les colonnes ?")
67             grid_sizer.Add(self.choice3, 1, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
68     
69     ##############################
70     
71             label = wx.StaticText(self, -1, u"Séparateur de texte")
72             label.SetHelpText(u"Quel caractère encadre les champs texte ?")
73             grid_sizer.Add(label, 0, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
74             self.txtsep = ["\"", "'"]
75             self.choice4 = wx.Choice(self, -1, (100, 50), choices=self.txtsep)
76             self.choice4.SetHelpText(u"Quel caractère encadre les champs texte ?")
77             grid_sizer.Add(self.choice4, 1, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
78             self.choice3.SetSelection(0)
79             self.choice4.SetSelection(0)
80             self.text = wx.StaticText(self, -1, u"Encodage du corpus : ")
81             grid_sizer.Add(self.text, 1, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
82             self.le = [enc[0].lower() for enc in encodages] 
83             self.list_encodages = wx.Choice(self, -1, (25, 30), choices=[' - '.join(encodage) for encodage in encodages])
84             if locale.getpreferredencoding().lower() == 'mac-roman' :
85                 enc = self.le.index('macroman')
86             else :
87                 enc = self.le.index(locale.getpreferredencoding().lower())
88             self.list_encodages.SetSelection(enc)
89             grid_sizer.Add(self.list_encodages, 1, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
90         elif sheet :
91             label = wx.StaticText(self, -1, u"Feuille ")
92             grid_sizer.Add(label, 0, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
93             self.spin1 = wx.SpinCtrl(self, -1, '',size = (100,30), min=1, max=500)
94             grid_sizer.Add(self.spin1, 1, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
95         
96         sizer.Add(grid_sizer, 0, wx.GROW | wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5)
97
98
99         line = wx.StaticLine(self, -1, size=(20, -1), style=wx.LI_HORIZONTAL)
100         sizer.Add(line, 0, wx.GROW | wx.ALIGN_CENTER_VERTICAL | wx.RIGHT | wx.TOP, 5)
101
102         btnsizer = wx.StdDialogButtonSizer()
103         
104         if wx.Platform != "__WXMSW__":
105             btn = wx.ContextHelpButton(self)
106             btnsizer.AddButton(btn)
107         
108         btn = wx.Button(self, wx.ID_OK)
109         btn.SetHelpText("The OK button completes the dialog")
110         btn.SetDefault()
111         btnsizer.AddButton(btn)
112
113         btn = wx.Button(self, wx.ID_CANCEL)
114         btn.SetHelpText("The Cancel button cnacels the dialog. (Cool, huh?)")
115         btnsizer.AddButton(btn)
116         btnsizer.Realize()
117
118         sizer.Add(btnsizer, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_CENTER_HORIZONTAL, 5)
119
120         self.SetSizer(sizer)
121         sizer.Fit(self)
122
123
124 class ClusterNbDialog(wx.Dialog):
125     def __init__(
126             self, LIST_CLASSE, parent, ID, title, size=wx.DefaultSize, pos=wx.DefaultPosition,
127             style=wx.DEFAULT_DIALOG_STYLE
128             ):
129
130         pre = wx.PreDialog()
131         pre.SetExtraStyle(wx.DIALOG_EX_CONTEXTHELP)
132         pre.Create(parent, ID, title, pos, size, style)
133
134         self.PostCreate(pre)
135
136         # Now continue with the normal construction of the dialog
137         # contents
138         sizer = wx.BoxSizer(wx.VERTICAL)
139
140         label = wx.StaticText(self, -1, u"Résultats de la classification")
141         label.SetHelpText("This is the help text for the label")
142         sizer.Add(label, 0, wx.ALIGN_CENTRE | wx.ALL, 5)
143
144         box = wx.BoxSizer(wx.HORIZONTAL)
145
146         label = wx.StaticText(self, -1, u"Choisissez le nombre de classes")
147         label.SetHelpText("This is the help text for the label")
148         box.Add(label, 0, wx.ALIGN_CENTRE | wx.ALL, 5)
149         LIST_CLASSE_OK = []
150         if type(LIST_CLASSE) != float :
151             for i in LIST_CLASSE :
152                 LIST_CLASSE_OK.append(str(i))
153         else :
154             LIST_CLASSE_OK.append(str(LIST_CLASSE))
155         print str(LIST_CLASSE_OK)
156         self.list_box_1 = wx.ListBox(self, -1, choices=LIST_CLASSE_OK, style=wx.LB_SINGLE | wx.LB_HSCROLL)
157         self.list_box_1.SetHelpText("Here's some help text for field #1")
158         box.Add(self.list_box_1, 1, wx.ALIGN_CENTRE | wx.ALL, 5)
159
160         sizer.Add(box, 0, wx.GROW | wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5)
161
162
163 ###############################
164         line = wx.StaticLine(self, -1, size=(20, -1), style=wx.LI_HORIZONTAL)
165         sizer.Add(line, 0, wx.GROW | wx.ALIGN_CENTER_VERTICAL | wx.RIGHT | wx.TOP, 5)
166
167         btnsizer = wx.StdDialogButtonSizer()
168         
169         if wx.Platform != "__WXMSW__":
170             btn = wx.ContextHelpButton(self)
171             btnsizer.AddButton(btn)
172         
173         btn = wx.Button(self, wx.ID_OK)
174         btn.SetHelpText("The OK button completes the dialog")
175         btn.SetDefault()
176         btnsizer.AddButton(btn)
177
178         btn = wx.Button(self, wx.ID_CANCEL)
179         btn.SetHelpText("The Cancel button cnacels the dialog. (Cool, huh?)")
180         btnsizer.AddButton(btn)
181         btnsizer.Realize()
182
183         sizer.Add(btnsizer, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5)
184
185         self.SetSizer(sizer)
186         sizer.Fit(self)
187
188 class EncodeDialog(wx.Dialog):
189     def __init__(self, *args, **kwds):
190         # begin wxGlade: MyDialog.__init__
191         kwds["style"] = wx.DEFAULT_DIALOG_STYLE
192         kwds["size"] = wx.Size(100, 60)
193         kwds["title"] = u'Encodage'
194         wx.Dialog.__init__(self, *args, **kwds)
195         self.label_dict = wx.StaticText(self, -1, u"Langue")
196         langues_n = [u'français', u'english', u'german (expérimentale)', u'italian (expérimentale)', u'swedish (exp.)', u'portuguese (exp.)']
197         self.langues = [u'french', u'english', u'german', 'italian', 'swedish', 'portuguese']
198         self.choice_dict = wx.Choice(self, -1, choices = langues_n)
199         self.encodages = encodages
200         self.text = wx.StaticText(self, -1, u"Encodage du corpus : ")
201         self.le = [enc[0].lower() for enc in self.encodages] 
202         self.list_encodages = wx.Choice(self, -1, (25, 50), choices=[' - '.join(encodage) for encodage in self.encodages])#style=wx.LB_SINGLE | wx.LB_HSCROLL)
203         self.button_1 = wx.Button(self, wx.ID_OK, "")
204
205         self.__set_properties()
206         self.__do_layout()
207         # end wxGlade
208
209     def __set_properties(self):
210         # begin wxGlade: MyDialog.__set_properties
211         self.SetTitle(u"Encodage du corpus")
212         self.SetMinSize(wx.Size(300, 100))
213         if  locale.getpreferredencoding().lower() == 'mac-roman' :
214             enc = self.le.index('macroman')
215         else :
216             enc = self.le.index(locale.getpreferredencoding().lower())
217         self.list_encodages.SetSelection(enc)
218         self.choice_dict.SetSelection(0)
219         # end wxGlade
220
221     def __do_layout(self):
222         # begin wxGlade: MyDialog.__do_layout
223         sizer_1 = wx.BoxSizer(wx.VERTICAL)
224         sizer_1.Add(self.text, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL, 0)
225         sizer_1.Add(self.list_encodages, 1, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL, 0)
226         sizer_1.Add(self.label_dict, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL, 0)
227         sizer_1.Add(self.choice_dict, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL, 0)
228         sizer_1.Add(self.button_1, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL, 0)
229         self.SetSizer(sizer_1)
230         sizer_1.Fit(self)
231         self.Layout()
232
233 class CHDDialog(wx.Dialog):
234     def __init__(
235             self, parent, ID, title, size=wx.DefaultSize, pos=wx.DefaultPosition,
236             style=wx.DEFAULT_DIALOG_STYLE | wx.CANCEL
237             ):
238         pre = wx.PreDialog()
239         pre.SetExtraStyle(wx.DIALOG_EX_CONTEXTHELP)
240         pre.Create(parent, ID, title, pos, size, style)
241
242         self.PostCreate(pre)
243        
244         self.colsep = parent.colsep
245         self.Box = 1
246         self.content = parent.content[:]
247         self.header = parent.header[:]
248         LABELLIST = []
249         for i in self.header:
250             if len(i) > 60 :
251                 LABELLIST.append(i[0:60])
252             else:
253                 LABELLIST.append(i)
254         self.LABELLISTTOT = LABELLIST
255         self.LISTVARSUP = []
256 #----------------------------------------------------------------------------------------------------
257         self.text1 = wx.StaticText(self, -1, u"Variables Actives (au moins 3)")
258         self.text2 = wx.StaticText(self, -1, u"Variables Supplémentaires (au moins 1)")
259         self.list_box_1 = wx.ListBox(self, -1, choices=LABELLIST, style=wx.LB_EXTENDED | wx.LB_HSCROLL)
260         self.list_box_2 = wx.ListBox(self, -1, choices=LABELLIST, style=wx.LB_EXTENDED | wx.LB_HSCROLL)
261         self.button_cancel = wx.Button(self, wx.ID_CANCEL)
262         self.button_back = wx.Button(self, wx.ID_BACKWARD)
263         self.button_forw = wx.Button(self, wx.ID_FORWARD)
264         self.button_ok = wx.Button(self, wx.ID_OK)
265         self.button_pref = wx.Button(self, wx.ID_PROPERTIES)
266         self.button_selectall = wx.Button(self, wx.NewId(), u"Sélectionner tout")
267         self.__set_properties()
268         self.__do_layout()
269
270         self.Bind(wx.EVT_BUTTON, self.OnPrec, self.button_back)
271         self.Bind(wx.EVT_BUTTON, self.OnSuivant, self.button_forw)
272         self.Bind(wx.EVT_BUTTON, self.OnValider, self.button_ok)
273         self.Bind(wx.EVT_BUTTON, self.OnSelectAll, self.button_selectall)
274         # end wxGlade
275         self.parent = parent
276         self.TEMPDIR = parent.TEMPDIR
277         self.num = 0
278
279     def __set_properties(self):
280         # begin wxGlade: ConfChi2.__set_properties
281         self.SetTitle(u"Sélection des variables")
282         self.list_box_2.Enable(False)
283         self.button_ok.Enable(False)        
284         self.button_back.Enable(False)
285         # end wxGlade
286
287     def __do_layout(self):
288         # begin wxGlade: ConfChi2.__do_layout
289         sizer_1 = wx.BoxSizer(wx.VERTICAL)
290         sizer_2 = wx.BoxSizer(wx.VERTICAL)
291         sizer_3 = wx.BoxSizer(wx.HORIZONTAL)
292         sizer_4 = wx.BoxSizer(wx.HORIZONTAL)
293         sizer_5 = wx.BoxSizer(wx.HORIZONTAL)
294         sizer_6 = wx.BoxSizer(wx.HORIZONTAL)
295         sizer_7 = wx.BoxSizer(wx.HORIZONTAL)
296         sizer_5.Add(self.text1, 1, wx.CENTER | wx.ALL, 0)
297         sizer_5.Add(self.text2, 1, wx.CENTER | wx.ALL, 0)
298         sizer_3.Add(self.list_box_1, 0, wx.EXPAND, 0)
299         sizer_3.Add(self.list_box_2, 0, wx.EXPAND, 0)
300         sizer_6.Add(self.button_selectall, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL, 0) 
301         sizer_7.Add(self.button_cancel, 0, wx.ALL, 0)
302         sizer_7.Add(self.button_pref, 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
303         sizer_7.Add(self.button_ok, 0, wx.wx.ALIGN_CENTER_HORIZONTAL, 0)
304         sizer_4.Add(self.button_back, 0, wx.ALL, 0)
305         sizer_4.Add(self.button_forw, 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
306         sizer_2.Add(sizer_5, 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
307         sizer_2.Add(sizer_3, 1, wx.EXPAND, 0)
308         sizer_2.Add(sizer_6, 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
309         sizer_2.Add(sizer_4, 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
310         sizer_2.Add(sizer_7, 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
311         sizer_1.Add(sizer_2, 1, wx.EXPAND, 4)
312         self.SetSizer(sizer_1)
313         sizer_1.Fit(self)
314         self.Layout()
315         # end wxGlade
316 #--------------FIXME-----------------------
317 #NETTOYAGE des variables inutiles
318     def OnSuivant(self, event): 
319         LISTACTIVE = self.list_box_1.GetSelections()
320         if len(LISTACTIVE) != len(self.LABELLISTTOT) and len(LISTACTIVE) >= 3: 
321             self.button_ok.Enable(True)
322         self.Box = 2
323         self.LISTHEADERINDICE = []
324         self.LISTNUMACTIVE = []
325         COMPT = 0
326         header = self.header[:]
327         for i in range(0, len(header)):
328             self.LISTHEADERINDICE.append(i)
329         for i in LISTACTIVE :
330             self.LISTNUMACTIVE.append(i)
331             header.pop(i - COMPT)
332             self.LISTHEADERINDICE.pop(i - COMPT)
333             COMPT += 1
334         self.LABELLIST = []
335         for i in header:
336             if len(i) > 60 :
337                 self.LABELLIST.append(i[0:60])
338             else:
339                 self.LABELLIST.append(i)
340         self.list_box_2.Clear()
341         for i in self.LABELLIST :
342             self.list_box_2.Append(i)
343                     
344         self.list_box_1.Enable(False)    
345         self.list_box_2.Enable(True)
346         self.button_forw.Enable(False)
347         self.button_back.Enable(True)
348
349     def OnValider(self, event):
350         LISTVARSUPSEL = self.list_box_2.GetSelections()
351         for i in LISTVARSUPSEL :
352             self.LISTVARSUP.append(self.LISTHEADERINDICE[i])
353         event.Skip()
354
355     def OnPrec(self, event):
356         self.list_box_1.Enable(True)
357         self.list_box_2.Enable(False)
358         self.button_forw.Enable(True)
359         self.button_back.Enable(False)   
360         self.button_ok.Enable(False)
361         self.Box = 1
362         event.Skip()
363
364     def OnSelectAll(self, event):
365         if self.Box == 1:
366             for i in range(len(self.LABELLISTTOT)):
367                 self.list_box_1.Select(i)
368         else:
369             for i in range(len(self.LABELLIST)):
370                 self.list_box_2.Select(i)
371
372 class PrefDialog ( wx.Dialog ):
373     
374     def __init__( self, parent ):
375         wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = u"Préférences", pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.DEFAULT_DIALOG_STYLE )
376         self.parent = parent
377         
378         self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
379         
380         bSizer1 = wx.BoxSizer( wx.VERTICAL )
381         
382         fgSizer1 = wx.FlexGridSizer( 0, 3, 0, 0 )
383         fgSizer1.SetFlexibleDirection( wx.BOTH )
384         fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
385         
386         self.m_staticText1 = wx.StaticText( self, wx.ID_ANY, u"Jouer un son à la fin des analyses", wx.DefaultPosition, wx.DefaultSize, 0 )
387         self.m_staticText1.Wrap( -1 )
388         fgSizer1.Add( self.m_staticText1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
389         
390         self.m_staticText2 = wx.StaticText( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
391         self.m_staticText2.Wrap( -1 )
392         fgSizer1.Add( self.m_staticText2, 0, wx.ALL, 5 )
393         
394         m_radioBox1Choices = [ u"oui", u"non" ]
395         self.m_radioBox1 = wx.RadioBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, m_radioBox1Choices, 1, wx.RA_SPECIFY_COLS )
396         self.m_radioBox1.SetSelection( 0 )
397         fgSizer1.Add( self.m_radioBox1, 0, wx.ALIGN_RIGHT|wx.ALL, 5 )
398
399         msg = u"""Vérifier au démarrage si une
400 nouvelle version est disponible"""
401         self.m_staticText3 = wx.StaticText( self, wx.ID_ANY, msg, wx.DefaultPosition, wx.DefaultSize, 0 )
402         self.m_staticText3.Wrap( -1 )
403         fgSizer1.Add( self.m_staticText3, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
404         
405         self.m_staticText4 = wx.StaticText( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
406         self.m_staticText4.Wrap( -1 )
407         fgSizer1.Add( self.m_staticText4, 0, wx.ALL, 5 )
408         
409         m_radioBox2Choices = [ u"oui", u"non" ]
410         self.m_radioBox2 = wx.RadioBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, m_radioBox2Choices, 1, wx.RA_SPECIFY_COLS )
411         self.m_radioBox2.SetSelection( 0 )
412         fgSizer1.Add( self.m_radioBox2, 0, wx.ALIGN_RIGHT|wx.ALL, 5 )
413         
414         msg = u"""Vérifier l'installation des
415 bibliothèques de R"""
416         self.m_staticText5 = wx.StaticText( self, wx.ID_ANY, msg, wx.DefaultPosition, wx.DefaultSize, 0 )
417         self.m_staticText5.Wrap( -1 )
418         fgSizer1.Add( self.m_staticText5, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
419         
420         self.m_staticText6 = wx.StaticText( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
421         self.m_staticText6.Wrap( -1 )
422         fgSizer1.Add( self.m_staticText6, 0, wx.ALL, 5 )
423         
424         self.m_button1 = wx.Button( self, wx.ID_ANY, u"Vérifier", wx.DefaultPosition, wx.DefaultSize, 0 )
425         fgSizer1.Add( self.m_button1, 0, wx.ALIGN_RIGHT|wx.ALL, 5 )
426         
427         bSizer1.Add( fgSizer1, 1, wx.EXPAND, 5 )
428         if sys.platform == 'win32' :
429             bSizer2 = wx.BoxSizer( wx.HORIZONTAL )
430             
431             msg = u"""Mémoire maximum allouée
432     à R (en Mo)"""
433             self.m_staticText7 = wx.StaticText( self, wx.ID_ANY, msg, wx.DefaultPosition, wx.DefaultSize, 0 )
434             self.m_staticText7.Wrap( -1 )
435             bSizer2.Add( self.m_staticText7, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
436             
437             self.m_checkBox1 = wx.CheckBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
438             bSizer2.Add( self.m_checkBox1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
439             
440             self.m_spinCtrl1 = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 32, 16000, 1535 )
441             bSizer2.Add( self.m_spinCtrl1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
442             
443             self.m_staticline7 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
444             bSizer2.Add( self.m_staticline7, 0, wx.EXPAND |wx.ALL, 5 )
445             
446             bSizer1.Add( bSizer2, 0, wx.EXPAND, 5 )
447             self.m_checkBox1.Bind( wx.EVT_CHECKBOX, self.oncheckmem )
448
449         bSizer3 = wx.BoxSizer( wx.HORIZONTAL )
450         bSizer4 = wx.BoxSizer( wx.HORIZONTAL )
451         self.text8 = wx.StaticText( self, wx.ID_ANY, u"Utiliser svdlibc", wx.DefaultPosition, wx.DefaultSize, 0 )
452         self.text8.Wrap( -1 )
453         fgSizer1.Add( self.text8, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
454         self.check_svdc = wx.CheckBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
455         bSizer4.Add( self.check_svdc, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
456         bSizer3.Add( bSizer4, 0, wx.EXPAND, 5 )
457         self.fbb = filebrowse.FileBrowseButton(self, -1, size=(250, -1), fileMode = 2, fileMask = '*')
458         bSizer3.Add( self.fbb, 0, wx.EXPAND, 5 )
459         self.fbb.SetLabel(u"Chemin : ")
460         fgSizer1.Add( wx.StaticText(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 ),  wx.ID_ANY, wx.ALL, 5)
461         fgSizer1.Add( bSizer3, 0,  wx.ALIGN_RIGHT|wx.ALL, 5 )
462
463         Rpath_text =  wx.StaticText( self, wx.ID_ANY, u"Chemin de R", wx.DefaultPosition, wx.DefaultSize, 0 )
464         Rpath_text.Wrap( -1 )
465         fgSizer1.Add( Rpath_text, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
466         fgSizer1.Add( wx.StaticText(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 ),  wx.ID_ANY, wx.ALL, 5)
467         self.Rpath_value = filebrowse.FileBrowseButton(self, -1, size=(350, -1), fileMode = 2, fileMask = '*')
468         self.Rpath_value.SetLabel(u'Chemin : ')
469         fgSizer1.Add( self.Rpath_value, 0, wx.ALIGN_RIGHT|wx.ALL, 5 )
470
471         mirror_text =  wx.StaticText( self, wx.ID_ANY, u"Miroir de R par défaut", wx.DefaultPosition, wx.DefaultSize, 0 )
472         mirror_text.Wrap( -1 )
473         fgSizer1.Add( mirror_text, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
474         fgSizer1.Add( wx.StaticText(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 ),  wx.ID_ANY, wx.ALL, 5)
475         self.mirror_value = wx.TextCtrl( self, wx.ID_ANY, u'http://cran.univ-lyon1.fr', wx.DefaultPosition, wx.Size( 300,30 ), 0 ) 
476         fgSizer1.Add( self.mirror_value, 0, wx.ALIGN_RIGHT|wx.ALL, 5 )
477
478
479         m_sdbSizer1 = wx.StdDialogButtonSizer()
480         self.m_sdbSizer1OK = wx.Button( self, wx.ID_OK )
481         m_sdbSizer1.AddButton( self.m_sdbSizer1OK )
482         self.m_sdbSizer1Cancel = wx.Button( self, wx.ID_CANCEL )
483         m_sdbSizer1.AddButton( self.m_sdbSizer1Cancel )
484         m_sdbSizer1.Realize()
485         bSizer1.Add( m_sdbSizer1, 0, wx.EXPAND, 5 )
486         
487         self.SetSizer( bSizer1 )
488         self.Layout()
489         bSizer1.Fit( self )
490         
491         self.Centre( wx.BOTH )
492         
493         # Connect Events
494         self.m_sdbSizer1OK.Bind( wx.EVT_BUTTON, self.OnValid )
495         self.m_button1.Bind( wx.EVT_BUTTON, parent.OnVerif )
496         self.check_svdc.Bind( wx.EVT_CHECKBOX, self.OnSVDC )
497         self.__set_properties()
498
499     def __set_properties(self):
500         self.SetTitle(u"Préférences")
501         if self.parent.pref.getboolean('iramuteq', 'sound'): val1 = 0
502         else : val1 = 1
503         self.m_radioBox1.SetSelection(val1)
504         if self.parent.pref.getboolean('iramuteq', 'checkupdate') : val2 = 0
505         else : val2 = 1
506         self.m_radioBox2.SetSelection(val2)
507         if sys.platform == 'win32' :
508             if self.parent.pref.getboolean('iramuteq', 'R_mem') :
509                 self.m_checkBox1.SetValue(True)
510                 self.m_spinCtrl1.Enable(True)
511                 self.m_spinCtrl1.SetValue(self.parent.pref.getint('iramuteq', 'R_max_mem'))
512             else :
513                 self.m_checkBox1.SetValue(False)
514                 self.m_spinCtrl1.Enable(False)
515         if self.parent.pref.getboolean('iramuteq', 'libsvdc') : 
516             self.check_svdc.SetValue(True)
517             self.fbb.SetValue(self.parent.pref.get('iramuteq', 'libsvdc_path'))
518         else :
519             self.check_svdc.SetValue(False)
520             self.fbb.SetValue(self.parent.pref.get('iramuteq', 'libsvdc_path'))
521             self.fbb.Enable(False)
522         self.Rpath_value.SetValue(self.parent.PathPath.get('PATHS', 'rpath'))
523         self.mirror_value.SetValue(self.parent.pref.get('iramuteq', 'rmirror'))
524         
525     def oncheckmem(self, evt):
526         if self.m_checkBox1.GetValue() :
527             self.m_spinCtrl1.Enable(True)
528         else :
529             self.m_spinCtrl1.Enable(False)
530
531     def OnSVDC(self, evt):
532         if self.check_svdc.GetValue() :
533             self.fbb.Enable(True)
534         else :
535             self.fbb.Enable(False)
536
537     def OnValid(self, event):
538         parent = self.parent
539         if self.m_radioBox1.GetSelection() == 0 : valsound = 'true'
540         else :  valsound = 'false'
541         parent.pref.set('iramuteq', 'sound', valsound)
542         if self.m_radioBox2.GetSelection() == 0 : valcheck = 'true'
543         else :  valcheck = 'false'
544         parent.pref.set('iramuteq', 'checkupdate', valcheck)
545         if sys.platform == 'win32' :
546             if self.m_checkBox1.GetValue() :
547                 parent.pref.set('iramuteq', 'R_mem', 'true')
548                 parent.pref.set('iramuteq', 'R_max_mem', str(self.m_spinCtrl1.GetValue()))
549             else :
550                 parent.pref.set('iramuteq', 'R_mem', 'false')
551         if self.check_svdc.GetValue() :
552             parent.pref.set('iramuteq', 'libsvdc', 'true')
553         else :
554             parent.pref.set('iramuteq', 'libsvdc', 'false')
555         parent.pref.set('iramuteq', 'libsvdc_path', self.fbb.GetValue())
556         self.parent.pref.set('iramuteq', 'rmirror', self.mirror_value.GetValue())
557         file = open(parent.ConfigPath['preferences'], 'w')
558         parent.pref.write(file)
559         file.close()
560         self.parent.PathPath.set('PATHS', 'rpath', self.Rpath_value.GetValue())
561         with open(self.parent.ConfigPath['path'], 'w') as f:
562             self.parent.PathPath.write(f)
563         self.Close()
564
565 class PrefGraph(wx.Dialog):
566     def __init__(self, parent, ID, paramgraph, title = '', size=wx.DefaultSize, pos=wx.DefaultPosition, style=wx.DEFAULT_DIALOG_STYLE):
567         pre = wx.PreDialog()
568         pre.SetExtraStyle(wx.DIALOG_EX_CONTEXTHELP)
569         pre.Create(parent, ID, title, pos, size, style)
570         self.PostCreate(pre)
571         self.parent = parent
572         self.paramgraph=paramgraph
573         self.labeltype = wx.StaticText(self, -1, u'Type de graph')
574         if self.paramgraph['clnb'] <= 3 :
575             choix = [u'2D']
576         else :
577             choix=[u'2D' ,u'3D']
578         self.choicetype = wx.Choice(self, -1, (100,50), choices=choix)
579         self.label_format = wx.StaticText(self, -1, u"Format de l'image")
580         self.choix_format =  wx.Choice(self, -1, (100,50), choices = ['png', 'svg'])        
581         self.label_1 = wx.StaticText(self, -1, u'Largeur')
582         self.spin1 = wx.SpinCtrl(self, -1, '',size = (100,30), min=100, max=5000)
583         self.label_2 = wx.StaticText(self, -1, u'Hauteur')
584         self.spin2 = wx.SpinCtrl(self, -1, '', size = (100,30), min=100, max=5000)
585         self.label_what = wx.StaticText(self, -1, u'Représentation')
586         self.choice1 = wx.Choice(self, -1, (100,50), choices=[u'coordonnées' ,u'corrélation'])
587         self.label_qui = wx.StaticText(self, -1, u'Variables')
588         self.choice2 = wx.Choice(self, -1, (100,50), choices=[u'actives' ,u'supplémentaires', u'étoilées', 'classes'])
589         self.label_3 = wx.StaticText(self, -1, u'Taille du texte')
590         self.spin3 = wx.SpinCtrl(self, -1, '', size = (100,30), min=1, max=20)
591         txt = u"""Prendre les x premiers points"""
592         self.label_4 = wx.StaticText(self, -1, txt)
593         self.check1 = wx.CheckBox(self, -1)
594         self.spin_nb = wx.SpinCtrl(self, -1, '', size = (100,30), min=2, max=1000)
595         txt = u"""Prendre les x premiers points par classe"""
596         self.label_chic = wx.StaticText(self, -1, txt)
597         self.check_chic = wx.CheckBox(self, -1)
598         self.spin_nbchic = wx.SpinCtrl(self, -1, '', size = (100,30), min=2, max=1000)        
599         txt = u"""Limiter le nombre de points 
600 par le chi2 de liaison aux classes"""
601         self.label_5 = wx.StaticText(self, -1, txt)
602         self.check2 = wx.CheckBox(self, -1)
603         self.spin_chi = wx.SpinCtrl(self, -1, '',size = (100,30),  min=2, max=1000)
604         self.label_6 = wx.StaticText(self, -1, u'Eliminer les recouvrements')
605         self.check3 = wx.CheckBox(self, -1)
606         txt = u"""Taille du texte proportionnel
607 à l'effectif de la forme"""
608         self.label_7 = wx.StaticText(self, -1, txt)
609         self.check4 = wx.CheckBox(self, -1)
610         self.label_min = wx.StaticText(self, -1, 'min')
611         self.spin_min = wx.SpinCtrl(self, -1, '',size = (100,30), min = 1, max = 100)
612         self.label_max = wx.StaticText(self, -1, 'max')
613         self.spin_max = wx.SpinCtrl(self, -1, '',size = (100,30), min = 1, max = 100)
614         txt = u"""Taille du texte proportionnel
615 au chi2 d'association de la forme"""
616         self.label_tchi = wx.StaticText(self, -1, txt)
617         self.check_tchi = wx.CheckBox(self, -1)
618         self.label_min_tchi = wx.StaticText(self, -1, 'min')
619         self.spin_min_tchi = wx.SpinCtrl(self, -1, '', size = (100,30), min = 1, max = 100)
620         self.label_max_tchi = wx.StaticText(self, -1, 'max')
621         self.spin_max_tchi = wx.SpinCtrl(self, -1, '', size = (100,30), min = 1, max = 100)
622         self.label_8 = wx.StaticText(self, -1, 'Facteur x :')
623         self.spin_f1 = wx.SpinCtrl(self, -1, '',size = (100,30), min=1, max=self.paramgraph['clnb']-1)
624         self.label_9 = wx.StaticText(self, -1, 'Facteur y :')
625         self.spin_f2 = wx.SpinCtrl(self, -1, '',size = (100,30), min=1, max=self.paramgraph['clnb']-1)
626         self.label_f3 = wx.StaticText(self, -1, 'Facteur z :')
627         self.spin_f3 = wx.SpinCtrl(self, -1, '',size = (100,30), min=1, max=self.paramgraph['clnb']-1)
628         self.label_sphere = wx.StaticText(self, -1, u"Transparence des sphères")
629         self.slider_sphere = wx.Slider(self, -1, 10, 1, 100, size = (255,-1), style = wx.SL_HORIZONTAL | wx.SL_AUTOTICKS | wx.SL_LABELS)
630
631         self.label_film = wx.StaticText(self, -1, 'Faire un film')
632         self.film = wx.CheckBox(self, -1)
633                
634         self.btnsizer = wx.StdDialogButtonSizer()
635         if wx.Platform != "__WXMSW__":
636             btn = wx.ContextHelpButton(self)
637             self.btnsizer.AddButton(btn)
638         btn = wx.Button(self, wx.ID_OK)
639         btn.SetHelpText("Ok")
640         btn.SetDefault()
641         self.btnsizer.AddButton(btn)
642         btn = wx.Button(self, wx.ID_CANCEL)
643         btn.SetHelpText("Annuler")
644         self.btnsizer.AddButton(btn)
645         self.btnsizer.Realize()
646         
647         self.Bind(wx.EVT_CHECKBOX, self.OnCheck1, self.check1)
648         self.Bind(wx.EVT_CHECKBOX, self.OnCheck2, self.check2)
649         self.Bind(wx.EVT_CHECKBOX, self.OnNorm, self.check4)
650         self.Bind(wx.EVT_CHECKBOX, self.OnCheckTchi, self.check_tchi)
651         self.Bind(wx.EVT_CHOICE, self.On3D, self.choicetype)
652         self.Bind(wx.EVT_CHOICE, self.OnPass, self.choice2)
653         self.Bind(wx.EVT_CHECKBOX, self.OnCheckChic, self.check_chic)
654         self.__set_properties()
655         self.OnNorm(wx.EVT_CHECKBOX)
656         self.OnCheckTchi(wx.EVT_CHECKBOX)
657         self.__do_layout()
658
659     def __set_properties(self):
660         self.choicetype.SetSelection(self.paramgraph['typegraph'])
661         if self.paramgraph['typegraph'] == 0 :
662             self.film.Enable(False)
663             self.spin_f3.Enable(False)
664             self.slider_sphere.Enable(False)
665         self.choix_format.SetSelection(self.paramgraph['svg'])
666         self.choice1.SetSelection(self.paramgraph['what'])
667         self.choice2.SetSelection(self.paramgraph['qui'])
668         self.spin_chi.SetValue(self.paramgraph['select_nb'])
669         self.spin_nb.SetValue(self.paramgraph['select_chi'])
670         self.spin1.SetValue(self.paramgraph['width'])
671         self.spin2.SetValue(self.paramgraph['height'])
672         self.spin3.SetValue(self.paramgraph['taillecar'])
673         self.spin_nb.SetValue(self.paramgraph['select_nb'])
674         self.spin_chi.SetValue(self.paramgraph['select_chi'])
675         self.spin_nbchic.SetValue(self.paramgraph['nbchic'])
676         self.check1.SetValue(self.paramgraph['do_select_nb'])
677         self.check2.SetValue(self.paramgraph['do_select_chi'])
678         self.check_chic.SetValue(self.paramgraph['do_select_chi_classe'])
679         self.check3.SetValue(self.paramgraph['over'])
680         if self.paramgraph['do_select_nb'] :
681             self.spin_nb.Enable(True)
682             self.spin_chi.Enable(False)
683             self.spin_nbchic.Enable(False)
684         elif self.paramgraph['do_select_chi_classe'] :
685             self.spin_nb.Enable(False)
686             self.spin_chi.Enable(False)
687             self.spin_nbchic.Enable(True)
688         elif self.paramgraph['do_select_chi'] :
689             self.spin_nb.Enable(False)
690             self.spin_chi.Enable(True)
691             self.spin_nbchic.Enable(False)
692         else :
693             self.spin_nb.Enable(False)
694             self.spin_chi.Enable(False)
695             self.spin_nbchic.Enable(False)
696
697             
698         self.check4.SetValue(self.paramgraph['cex_txt'])
699         self.spin_min.SetValue(self.paramgraph['txt_min'])
700         self.spin_max.SetValue(self.paramgraph['txt_max'])
701         self.check_tchi.SetValue(self.paramgraph['tchi'])
702         self.spin_min_tchi.SetValue(self.paramgraph['tchi_min'])
703         self.spin_max_tchi.SetValue(self.paramgraph['tchi_max'])
704
705         self.spin_f1.SetValue(self.paramgraph['facteur'][0])
706         self.spin_f2.SetValue(self.paramgraph['facteur'][1])
707         self.spin_f3.SetValue(self.paramgraph['facteur'][2])
708         self.slider_sphere.SetValue(self.paramgraph['alpha'])
709
710     def __do_layout(self):
711         sizer_2 = wx.BoxSizer(wx.VERTICAL)
712         fsizer = wx.FlexGridSizer(0,2,0,5)
713         grid_min = wx.FlexGridSizer(0, 2, 0, 0)
714         grid_max = wx.FlexGridSizer(0, 2, 0, 0)
715         grid_minmax = wx.FlexGridSizer(0, 2, 0, 0)
716         grid_min_tchi = wx.FlexGridSizer(0, 2, 0, 0)
717         grid_max_tchi = wx.FlexGridSizer(0, 2, 0, 0)
718         grid_minmax_tchi = wx.FlexGridSizer(0, 2, 0, 0)
719
720         sizer_3 = wx.BoxSizer(wx.VERTICAL)
721         
722         fsizer.Add(self.labeltype, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
723         fsizer.Add(self.choicetype, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
724         fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
725         fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
726
727         fsizer.Add(self.label_format, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
728         fsizer.Add(self.choix_format, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
729         fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
730         fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
731
732         fsizer.Add(self.label_what, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
733         fsizer.Add(self.choice1, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
734         fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
735         fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
736         
737         fsizer.Add(self.label_qui, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
738         fsizer.Add(self.choice2, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
739         fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
740         fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)              
741         
742         sizer_h1 = wx.BoxSizer(wx.HORIZONTAL)
743         sizer_h1.Add(self.label_1, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
744         sizer_h1.Add(self.spin1, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
745         fsizer.Add(sizer_h1, 0, wx.ALL, 5)
746         sizer_h2 = wx.BoxSizer(wx.HORIZONTAL)
747         sizer_h2.Add(self.label_2, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
748         sizer_h2.Add(self.spin2, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
749         fsizer.Add(sizer_h2, 0, wx.ALL, 5)
750         fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
751         fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
752         
753         fsizer.Add(self.label_3, 0, wx.ALL | wx.LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
754         fsizer.Add(self.spin3, 0, wx.ALL | wx.LEFT | wx.ALIGN_CENTER_VERTICAL, 5)        
755         fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
756         fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
757         
758         fsizer.Add(self.label_4, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
759         sizer_nb = wx.BoxSizer(wx.HORIZONTAL)
760         sizer_nb.Add(self.check1, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
761         sizer_nb.Add(self.spin_nb, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
762         fsizer.Add(sizer_nb, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
763         fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
764         fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
765         
766         fsizer.Add(self.label_chic, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
767         sizer_nbchic = wx.BoxSizer(wx.HORIZONTAL)
768         sizer_nbchic.Add(self.check_chic, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
769         sizer_nbchic.Add(self.spin_nbchic, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
770         fsizer.Add(sizer_nbchic, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
771         fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
772         fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
773
774         fsizer.Add(self.label_5, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
775         sizer_chi = wx.BoxSizer(wx.HORIZONTAL)
776         sizer_chi.Add(self.check2, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
777         sizer_chi.Add(self.spin_chi, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
778         fsizer.Add(sizer_chi, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
779         fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
780         fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
781         
782         fsizer.Add(self.label_6, 0,  wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL| wx.ADJUST_MINSIZE, 5)
783         fsizer.Add(self.check3, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 5)
784         fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
785         fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0) 
786         
787         sizer_2.Add(fsizer, 0, wx.EXPAND, 0)
788         
789         bsizer_1 = wx.FlexGridSizer(0,3,0,0)
790         bsizer_1.Add(self.label_7, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
791         bsizer_1.Add(self.check4, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL|wx.EXPAND, 5)
792         grid_min.Add(self.label_min, 0,wx.ALL |  wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
793         grid_min.Add(self.spin_min, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
794         grid_max.Add(self.label_max, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
795         grid_max.Add(self.spin_max, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
796         grid_minmax.Add(grid_min, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
797         grid_minmax.Add(grid_max, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
798
799         bsizer_1.Add(grid_minmax, 0, wx.ALL, 5)
800
801         bsizer_1.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
802         bsizer_1.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0) 
803         bsizer_1.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)        
804
805         bsizer_1.Add(self.label_tchi, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
806         bsizer_1.Add(self.check_tchi, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL|wx.EXPAND, 5)
807         grid_min_tchi.Add(self.label_min_tchi, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
808         grid_min_tchi.Add(self.spin_min_tchi, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
809         grid_max_tchi.Add(self.label_max_tchi, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
810         grid_max_tchi.Add(self.spin_max_tchi, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
811         grid_minmax_tchi.Add(grid_min_tchi, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
812         grid_minmax_tchi.Add(grid_max_tchi, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
813         
814         bsizer_1.Add(grid_minmax_tchi, 0,  wx.ALL, 5)
815         sizer_2.Add(bsizer_1, 0, wx.EXPAND, 5)
816         
817         sizer_2.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0) 
818         
819         sizer_f = wx.BoxSizer(wx.HORIZONTAL)
820         sizer_f.Add(self.label_8, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
821         sizer_f.Add(self.spin_f1, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
822         
823         sizer_f.Add(self.label_9, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
824         sizer_f.Add(self.spin_f2, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
825
826         sizer_f.Add(self.label_f3, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
827         sizer_f.Add(self.spin_f3, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
828         sizer_2.Add(sizer_f, 0, wx.EXPAND, 5)
829         
830         sizer_2.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 5)
831         
832         fsizer2 = wx.FlexGridSizer(0,2,0,0)
833         fsizer2.Add(self.label_sphere, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
834         fsizer2.Add(self.slider_sphere, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
835         fsizer2.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
836         fsizer2.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
837
838         fsizer2.Add(self.label_film, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
839         fsizer2.Add(self.film, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
840         sizer_2.Add(fsizer2, 0, wx.EXPAND, 5)
841         sizer_2.Add(self.btnsizer, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_CENTER_HORIZONTAL, 5)
842         self.SetSizer(sizer_2)
843         sizer_2.Fit(self)
844         self.Layout()
845         
846     def OnCheck1(self, event):
847         if self.check1.GetValue() :
848             self.check2.SetValue(False)
849             self.check_chic.SetValue(False)
850             self.spin_chi.Enable(False)
851             self.spin_nb.Enable(True)
852             self.spin_nbchic.Enable(False)
853         else : 
854             self.spin_nb.Enable(False)
855             
856     def OnCheck2(self, event):
857         if self.check2.GetValue() :
858             self.check1.SetValue(False)
859             self.check_chic.SetValue(False)
860             self.spin_chi.Enable(True)
861             self.spin_nb.Enable(False)
862             self.spin_nbchic.Enable(False)
863         else :
864            self.spin_chi.Enable(False) 
865
866     def OnCheckChic(self, event) :
867         if self.check_chic.GetValue() :
868             self.check1.SetValue(False)
869             self.check2.SetValue(False)
870             self.spin_chi.Enable(False)
871             self.spin_nb.Enable(False)
872             self.spin_nbchic.Enable(True)
873         else :
874             self.spin_nbchic.Enable(False)
875
876     def OnNorm(self, event):
877         if not self.check4.GetValue() :
878             self.spin_min.Disable()
879             self.spin_max.Disable()
880         else :
881             self.spin_min.Enable(True)
882             self.spin_max.Enable(True)
883             self.check_tchi.SetValue(False)
884             self.OnCheckTchi(wx.EVT_CHECKBOX)
885
886     def OnCheckTchi(self, evt) :
887         if not self.check_tchi.GetValue() :
888             self.spin_min_tchi.Disable()
889             self.spin_max_tchi.Disable()
890         else :
891             self.spin_min_tchi.Enable(True)
892             self.spin_max_tchi.Enable(True)
893             self.check4.SetValue(False)
894             self.OnNorm(wx.EVT_CHECKBOX)
895
896     def On3D(self, event) :
897         if event.GetString() == u'3D' :
898             self.film.Enable(True)
899             self.spin_f3.Enable(True)
900             self.slider_sphere.Enable(True)
901         else :
902             self.film.Enable(False)
903             self.spin_f3.Enable(False)
904             self.slider_sphere.Enable(False)
905     
906     def OnPass(self,evt) :
907         if evt.GetString() == u'classes' :
908             self.check4.SetValue(False)
909             self.check4.Enable(False)
910             self.OnNorm(wx.EVT_CHECKBOX)
911         else :
912             self.check4.Enable()
913             
914
915 class SelectColDial ( wx.Dialog ):
916     
917     def __init__( self, parent ):
918         wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = wx.EmptyString, pos = wx.DefaultPosition, size = wx.Size( 400,500 ), style = wx.DEFAULT_DIALOG_STYLE )
919         
920         self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
921         
922         self.bSizer2 = wx.BoxSizer( wx.VERTICAL )
923         
924         #self.m_checkList2 = wx.CheckListBox( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, ['r','t','y'], 0 ) 
925         #bSizer2.Add( self.m_checkList2, 2, wx.ALL|wx.EXPAND, 5 )
926         
927         self.m_sdbSizer2 = wx.StdDialogButtonSizer()
928         self.m_sdbSizer2OK = wx.Button( self, wx.ID_CANCEL)
929         self.butok = wx.Button( self, wx.ID_OK)
930         #m_sdbSizer2.AddButton( self.m_sdbSizer2OK )
931         #self.m_sdbSizer2Cancel = wx.Button( self, wx.ID_CANCEL )
932         #m_sdbSizer2.AddButton( self.m_sdbSizer2Cancel )
933         #m_sdbSizer2.Realize();
934         #self.bSizer2.Add( m_sdbSizer2, 0, wx.EXPAND, 5 )
935         
936         self.SetSizer( self.bSizer2 )
937         self.Layout()
938         
939         self.Centre( wx.BOTH )
940     
941     def __del__( self ):
942         pass
943
944 class PrefExport(wx.Dialog):
945     def __init__(self, parent, *args, **kwds):
946         kwds['style'] = wx.OK|wx.DEFAULT_DIALOG_STYLE 
947         wx.Dialog.__init__(self, *args, **kwds)
948         self.fileout = ""
949         self.parent = parent
950         sizer = wx.BoxSizer(wx.VERTICAL)
951         box = wx.BoxSizer(wx.HORIZONTAL)
952         box3 = wx.BoxSizer(wx.HORIZONTAL)
953         self.label_lem = wx.StaticText(self, -1, u"Corpus Lemmatisé")
954         box3.Add(self.label_lem, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
955         self.radio_lem = wx.RadioBox(self, -1, u"", choices=['oui', 'non'], majorDimension=0, style=wx.RA_SPECIFY_ROWS)
956         box3.Add(self.radio_lem, 0, wx.ALIGN_RIGHT, 5)
957         sizer.Add(box3, 0, wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5)
958         self.label_txt = wx.StaticText(self, -1, u"Exporter pour...")
959         box.Add(self.label_txt, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
960         self.radio_type = wx.RadioBox(self, -1, u"", choices=['IRaMuTeQ/ALCESTE', 'Lexico'], majorDimension=0, style=wx.RA_SPECIFY_ROWS)
961         box.Add(self.radio_type, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
962         sizer.Add(box, 0, wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5)
963         box2 = wx.BoxSizer(wx.HORIZONTAL)
964         self.txt2 = wx.StaticText(self, -1, u"Fichier en sortie")
965         box2.Add(self.txt2, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
966         self.fbb = filebrowse.FileBrowseButton(self, -1, size=(450, -1), fileMode = 2)
967         box2.Add(self.fbb, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
968         self.fbb.SetLabel("")
969         sizer.Add(box2, 0, wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5)
970
971         btnsizer = wx.StdDialogButtonSizer()
972         btn = wx.Button(self, wx.ID_CANCEL)
973         btnsizer.AddButton(btn)
974         btn_ok = wx.Button(self, wx.ID_OK)
975         btn_ok.SetDefault()
976         btnsizer.AddButton(btn_ok)
977         btnsizer.Realize()
978         sizer.Add(btnsizer, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL|wx.ALIGN_RIGHT, 5)
979         self.Bind(wx.EVT_BUTTON, self.check_file, btn_ok)
980         self.SetSizer(sizer)
981         sizer.Fit(self)        
982
983     def check_file(self, evt) :
984         if evt.GetId() == wx.ID_OK :
985             if os.path.exists(self.fbb.GetValue()):
986                 dlg = wx.MessageDialog(self, u"%s\nCe fichier existe, continuer quand même ?" % self.fbb.GetValue(), 'ATTENTION', wx.NO | wx.YES | wx.ICON_WARNING)
987                 dlg.CenterOnParent()
988                 if dlg.ShowModal() not in [wx.ID_NO, wx.ID_CANCEL]:
989                     self.EndModal(wx.ID_OK)
990             else :
991                  self.EndModal(wx.ID_OK)
992         else :
993             self.EndModal(wx.ID_CANCEL)
994
995 class PrefProfTypes(wx.Dialog):
996     def __init__(self, parent, *args, **kwds):
997         kwds['style'] = wx.OK|wx.DEFAULT_DIALOG_STYLE 
998         wx.Dialog.__init__(self, parent, *args, **kwds)
999         self.fileout = ""
1000         self.parent = parent
1001         sizer = wx.BoxSizer(wx.VERTICAL)
1002         box = wx.BoxSizer(wx.HORIZONTAL)
1003         box3 = wx.BoxSizer(wx.HORIZONTAL)
1004         self.label_txt = wx.StaticText(self, -1, u"Préférences")
1005         box.Add(self.label_txt, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
1006         self.radio_type = wx.RadioBox(self, -1, u"", choices=['comme ALCESTE', 'comme Lexico'], majorDimension=0, style=wx.RA_SPECIFY_ROWS)
1007         box.Add(self.radio_type, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
1008         sizer.Add(box, 0, wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5)
1009         box2 = wx.BoxSizer(wx.HORIZONTAL)
1010         self.txt2 = wx.StaticText(self, -1, u"Fichier en sortie")
1011         box2.Add(self.txt2, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
1012         self.fbb = filebrowse.FileBrowseButton(self, -1, size=(450, -1), fileMode = 2)
1013         box2.Add(self.fbb, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
1014         self.fbb.SetLabel("")
1015         sizer.Add(box2, 0, wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5)
1016
1017         btnsizer = wx.StdDialogButtonSizer()
1018         btn = wx.Button(self, wx.ID_CANCEL)
1019         btnsizer.AddButton(btn)
1020         btn_ok = wx.Button(self, wx.ID_OK)
1021         btn_ok.SetDefault()
1022         btnsizer.AddButton(btn_ok)
1023         btnsizer.Realize()
1024         sizer.Add(btnsizer, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL|wx.ALIGN_RIGHT, 5)
1025         #self.Bind(wx.EVT_BUTTON, self.check_file, btn_ok)
1026         self.SetSizer(sizer)
1027         sizer.Fit(self)
1028
1029 class PrefSimpleFile(wx.Dialog):
1030     def __init__(self, parent, *args, **kwds):
1031         kwds['style'] = wx.OK|wx.DEFAULT_DIALOG_STYLE 
1032         if 'mask' in kwds :
1033             self.mask = kwds['mask']
1034             del(kwds['mask'])
1035         else : self.mask = '*.*'
1036         wx.Dialog.__init__(self, *args, **kwds)
1037         self.fileout = ""
1038         self.parent = parent
1039         sizer = wx.BoxSizer(wx.VERTICAL)
1040         box2 = wx.BoxSizer(wx.HORIZONTAL)
1041         self.txt2 = wx.StaticText(self, -1, u"Fichier en sortie")
1042         box2.Add(self.txt2, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
1043         self.fbb = filebrowse.FileBrowseButton(self, -1, size=(450, -1), fileMode = 2, fileMask = self.mask)
1044         box2.Add(self.fbb, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
1045         self.fbb.SetLabel("")
1046         sizer.Add(box2, 0, wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5)
1047
1048         btnsizer = wx.StdDialogButtonSizer()
1049         btn = wx.Button(self, wx.ID_CANCEL)
1050         btnsizer.AddButton(btn)
1051         btn_ok = wx.Button(self, wx.ID_OK)
1052         btn_ok.SetDefault()
1053         btnsizer.AddButton(btn_ok)
1054         btnsizer.Realize()
1055         sizer.Add(btnsizer, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL|wx.ALIGN_RIGHT, 5)
1056         self.Bind(wx.EVT_BUTTON, self.check_file, btn_ok)
1057         self.SetSizer(sizer)
1058         sizer.Fit(self)        
1059
1060     def check_file(self, evt) :
1061         if evt.GetId() == wx.ID_OK :
1062             if os.path.exists(self.fbb.GetValue()):
1063                 dlg = wx.MessageDialog(self, u"%s\nCe fichier existe, continuer quand même ?" % self.fbb.GetValue(), 'ATTENTION', wx.NO | wx.YES | wx.ICON_WARNING)
1064                 dlg.CenterOnParent()
1065                 if dlg.ShowModal() not in [wx.ID_NO, wx.ID_CANCEL]:
1066                     self.EndModal(wx.ID_OK)
1067             else :
1068                  self.EndModal(wx.ID_OK)
1069         else :
1070             self.EndModal(wx.ID_CANCEL)
1071
1072
1073 class StatDialog(wx.Dialog):
1074     def __init__(self, parent, *args, **kwds):
1075         kwds['style'] = wx.DEFAULT_DIALOG_STYLE 
1076         wx.Dialog.__init__(self, *args, **kwds)
1077         self.fileout = ""
1078         self.parent = parent
1079         #box = wx.BoxSizer(wx.HORIZONTAL)
1080         self.label_lem = wx.StaticText(self, -1, u"Lemmatisation")
1081         self.radio_lem = wx.RadioBox(self, -1, u"", choices=['oui', 'non'], majorDimension=0, style=wx.RA_SPECIFY_ROWS)
1082         #sizer.Add(box, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT, 5)
1083         #box2 = wx.BoxSizer(wx.HORIZONTAL)
1084         #self.txt_exp = wx.StaticText(self, -1, u"Utiliser le Dict. des expressions")
1085         #self.exp = wx.RadioBox(self, -1, u"", choices=['oui', 'non'], majorDimension=0, style=wx.RA_SPECIFY_ROWS)
1086         #self.label_uce =  wx.StaticText(self, -1, u"Construire des UCE")
1087         #self.check_uce = wx.CheckBox(self, -1)
1088         #txt = """Nombre d'occurrences par uce"""
1089         #self.label_occuce = wx.StaticText(self, -1, txt)
1090         #self.spin_ctrl_4 = wx.SpinCtrl(self, -1, "",size = (100,30), min=10, max=1000, initial = 35)
1091         #txt = u"""Fréquence minimum d'une forme
1092 #analysée (0 = non utilisé)"""
1093         #self.label_8 = wx.StaticText(self, -1, txt)
1094         #self.spin_ctrl_5 = wx.SpinCtrl(self, -1, "",size = (100,30), min=0, max=1000, initial=0)
1095         #self.label_max_actives =  wx.StaticText(self, -1, u"Nombre maximum de formes analysées")
1096         #self.spin_max_actives = wx.SpinCtrl(self, -1, "",size = (100,30), min=20, max=10000, initial=1500)
1097         self.label_4 = wx.StaticText(self, -1, u"Configuration des clés d'analyse")
1098         self.button_5 = wx.Button(self, wx.ID_PREFERENCES, "")
1099
1100         #self.Bind(wx.EVT_CHECKBOX, self.OnCheckUce, self.check_uce)
1101         #self.Bind(wx.EVT_SPINCTRL, self.OnSpin, self.spin_ctrl_5)
1102         self.Bind(wx.EVT_BUTTON, self.OnKeys, self.button_5)
1103         self.__do_layout()
1104         self.__set_properties()
1105
1106     def __do_layout(self) :
1107         first = wx.BoxSizer(wx.VERTICAL)
1108         sizer = wx.FlexGridSizer(0,2,0,0)
1109         sizer.Add(self.label_lem, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
1110         sizer.Add(self.radio_lem, 0, wx.ALIGN_LEFT, 5)
1111         sizer.Add(wx.StaticLine(self),0, wx.ALIGN_LEFT, 5)
1112         sizer.Add(wx.StaticLine(self),0, wx.ALIGN_LEFT, 5)
1113         #sizer.Add(self.txt_exp, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
1114         #sizer.Add(self.exp, 0, wx.ALIGN_RIGHT, 5)
1115         #sizer.Add(self.label_uce, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
1116         #sizer.Add(self.check_uce, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
1117         #sizer.Add(self.label_occuce, 0,  wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
1118         #sizer.Add(self.spin_ctrl_4, 0,  wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
1119         #sizer.Add(self.label_8, 0,  wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
1120         #sizer.Add(self.spin_ctrl_5, 0,  wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
1121         #sizer.Add(self.label_max_actives, 0,  wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
1122         #sizer.Add(self.spin_max_actives, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
1123         sizer.Add(self.label_4, 0,  wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
1124         sizer.Add(self.button_5, 0,  wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
1125         sizer.Add(wx.StaticLine(self),0, wx.ALIGN_LEFT, 5)
1126         sizer.Add(wx.StaticLine(self),0, wx.ALIGN_LEFT, 5)
1127         #sizer.Add(box2, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT, 5)
1128         first.Add(sizer, 0, wx.ALL, 5)
1129         btnsizer = wx.StdDialogButtonSizer()
1130         btn = wx.Button(self, wx.ID_CANCEL)
1131         btnsizer.AddButton(btn)
1132         btn_ok = wx.Button(self, wx.ID_OK)
1133         btn_ok.SetDefault()
1134         btnsizer.AddButton(btn_ok)
1135         btnsizer.Realize()
1136         first.Add(btnsizer, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT, 5)
1137         self.SetSizer(first)
1138         first.Fit(self)
1139
1140     def __set_properties(self) :
1141         self.SetTitle(u'Préférences')
1142         #self.spin_ctrl_4.Enable(False)
1143         #self.spin_ctrl_5.Enable(False)
1144         #self.spin_max_actives.Enable(False)
1145
1146 #    def OnCheckUce(self, evt) :
1147 #        if self.check_uce.GetValue() :
1148 #            self.spin_ctrl_4.Enable(True)
1149 #            self.spin_ctrl_5.Enable(True)
1150 #            if self.spin_ctrl_5.GetValue() > 0 :
1151 #                self.spin_max_actives.Enable(False)
1152 #            else :
1153 #                self.spin_max_actives.Enable(True)
1154 #        else :
1155 #            self.spin_ctrl_4.Enable(False)
1156 #            self.spin_ctrl_5.Enable(False)
1157 #            self.spin_max_actives.Enable(False)
1158
1159 #    def OnSpin(self, evt) :
1160 #        if self.spin_ctrl_5.GetValue() > 0 :
1161 #            self.spin_max_actives.Enable(False)
1162 #        else :
1163 #            self.spin_max_actives.Enable(True)
1164
1165     def OnKeys(self, evt):
1166         dial = AlcOptFrame(self.parent, self)
1167         dial.CenterOnParent()
1168         val = dial.ShowModal()
1169
1170 class LexDialog( wx.Dialog ):
1171     
1172     def __init__( self, parent ):
1173         wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = wx.EmptyString, pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.DEFAULT_DIALOG_STYLE )
1174         
1175         self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
1176         
1177         bSizer2 = wx.BoxSizer( wx.VERTICAL )
1178         
1179         fgSizer2 = wx.FlexGridSizer( 0, 2, 0, 0 )
1180         fgSizer2.SetFlexibleDirection( wx.BOTH )
1181         fgSizer2.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
1182         
1183         self.m_staticText9 = wx.StaticText( self, wx.ID_ANY, u"Lemmatisation", wx.DefaultPosition, wx.DefaultSize, 0 )
1184         self.m_staticText9.Wrap( -1 )
1185         fgSizer2.Add( self.m_staticText9, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 3 )
1186         
1187         m_radioBox2Choices = [ u"oui", u"non" ]
1188         self.m_radioBox2 = wx.RadioBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, m_radioBox2Choices, 1, wx.RA_SPECIFY_COLS )
1189         self.m_radioBox2.SetSelection( 0 )
1190         fgSizer2.Add( self.m_radioBox2, 0, wx.ALIGN_RIGHT|wx.ALL, 3 )
1191         
1192 #        self.m_staticText10 = wx.StaticText( self, wx.ID_ANY, u"Utiliser le Dict. des expressions", wx.DefaultPosition, wx.DefaultSize, 0 )
1193 #        self.m_staticText10.Wrap( -1 )
1194 #        fgSizer2.Add( self.m_staticText10, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 3 )
1195 #        
1196 #        m_radioBox21Choices = [ u"oui", u"non" ]
1197 #        self.m_radioBox21 = wx.RadioBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, m_radioBox21Choices, 1, wx.RA_SPECIFY_COLS )
1198 #        self.m_radioBox21.SetSelection( 0 )
1199 #        fgSizer2.Add( self.m_radioBox21, 0, wx.ALIGN_RIGHT|wx.ALL, 3 )
1200 #        bSizer2.Add( fgSizer2, 1, wx.EXPAND, 5 )
1201         
1202         btnsizer = wx.StdDialogButtonSizer()
1203         btn = wx.Button(self, wx.ID_CANCEL)
1204         btnsizer.AddButton(btn)
1205         btn_ok = wx.Button( self, wx.ID_OK)
1206         btn_ok.SetDefault()
1207         btnsizer.AddButton(btn_ok)
1208         btnsizer.Realize()
1209
1210         bSizer2.Add(btnsizer, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT, 5)
1211         self.SetSizer( bSizer2 )
1212         self.Layout()
1213         bSizer2.Fit( self )
1214         self.Centre( wx.BOTH )
1215
1216 class PrefUCECarac(wx.Dialog):
1217     def __init__(self, parent, *args, **kwds):
1218         kwds['style'] = wx.DEFAULT_DIALOG_STYLE 
1219         kwds['title'] = u"UCE caractéristiques"
1220         wx.Dialog.__init__(self, *args, **kwds)
1221         self.parent = parent
1222         first = wx.BoxSizer(wx.VERTICAL)
1223         sizer = wx.FlexGridSizer(0,2,0,0)
1224         self.label_type = wx.StaticText(self, -1, u"Score de classement")
1225         sizer.Add(self.label_type, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
1226         self.radio_type = wx.RadioBox(self, -1, u"", choices=[u'absolu (somme des chi2 des formes marquées de l\'UCE)', u'relatif (moyenne des chi2 des formes marquées de l\'UCE)'], majorDimension=0, style=wx.RA_SPECIFY_ROWS)
1227         sizer.Add(self.radio_type, 0, wx.ALIGN_RIGHT, 5)
1228         self.txt_eff = wx.StaticText(self, -1, u"Nombre d\'UCE maximum")
1229         sizer.Add(self.txt_eff, 0, wx.ALIGN_CENTRE, 5)
1230         self.spin_eff = wx.SpinCtrl(self, -1, '', size = (100, 30), min = 1, max = 100000, initial = 50)
1231         sizer.Add(self.spin_eff, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
1232         first.Add(sizer, 0, wx.ALL, 5)
1233         btnsizer = wx.StdDialogButtonSizer()
1234         btn = wx.Button(self, wx.ID_CANCEL)
1235         btnsizer.AddButton(btn)
1236         btn_ok = wx.Button(self, wx.ID_OK)
1237         btn_ok.SetDefault()
1238         btnsizer.AddButton(btn_ok)
1239         btnsizer.Realize()
1240         first.Add(btnsizer, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT, 5)
1241         self.SetSizer(first)
1242         first.Fit(self)
1243
1244 class PrefSegProf(wx.Dialog) :
1245     def __init__( self, parent ):
1246         wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = u"Profils des segments répétés", pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.DEFAULT_DIALOG_STYLE )
1247         
1248         self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
1249         bSizer1 = wx.BoxSizer( wx.VERTICAL )
1250         txt = u"ATTENTION : le calcul des profils des segments répétés\npeut être très long sur les corpus importants"
1251         self.label = wx.StaticText( self, wx.ID_ANY, txt, wx.DefaultPosition, wx.DefaultSize, 0 ) 
1252         bSizer1.Add( self.label, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5 )
1253
1254         fgSizer1 = wx.FlexGridSizer( 0, 2, 0, 0 )
1255         fgSizer1.SetFlexibleDirection( wx.BOTH )
1256         fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
1257         
1258         self.m_staticText1 = wx.StaticText( self, wx.ID_ANY, u"Corpus lemmatisé", wx.DefaultPosition, wx.DefaultSize, 0 )
1259         self.m_staticText1.Wrap( -1 )
1260         fgSizer1.Add( self.m_staticText1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1261         
1262         box_lemChoices = [ u"oui", u"non" ]
1263         self.box_lem = wx.RadioBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, box_lemChoices, 1, wx.RA_SPECIFY_COLS )
1264         self.box_lem.SetSelection( 1 )
1265         fgSizer1.Add( self.box_lem, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1266         #self.box_lem.Enable(False)
1267         
1268         self.m_staticText3 = wx.StaticText( self, wx.ID_ANY, u"Taille minimum des segments", wx.DefaultPosition, wx.DefaultSize, 0 )
1269         self.m_staticText3.Wrap( -1 )
1270         fgSizer1.Add( self.m_staticText3, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1271         
1272         self.spin_min = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, (100,30), wx.SP_ARROW_KEYS, 2, 30, 2 )
1273         self.spin_min.SetValue(2)
1274         fgSizer1.Add( self.spin_min, 0, wx.ALL, 5 )
1275         
1276         self.m_staticText4 = wx.StaticText( self, wx.ID_ANY, u"Taille maximum des segments", wx.DefaultPosition, wx.DefaultSize, 0 )
1277         self.m_staticText4.Wrap( -1 )
1278         fgSizer1.Add( self.m_staticText4, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1279         
1280         self.spin_max = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, (100,30), wx.SP_ARROW_KEYS, 2, 30, 10 )
1281         self.spin_max.SetValue(10)
1282         fgSizer1.Add( self.spin_max, 0, wx.ALL, 5 )
1283         
1284         self.m_staticText5 = wx.StaticText( self, wx.ID_ANY, u"Effectif minimum d'un segment retenu", wx.DefaultPosition, wx.DefaultSize, 0 )
1285         self.m_staticText5.Wrap( -1 )
1286         fgSizer1.Add( self.m_staticText5, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1287         
1288         self.spin_eff = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, (100,30), wx.SP_ARROW_KEYS, 4, 1000, 4 )
1289         self.spin_eff.SetValue(4)
1290         fgSizer1.Add( self.spin_eff, 0, wx.ALL, 5 )
1291         
1292         bSizer1.Add( fgSizer1, 1, wx.EXPAND, 5 )
1293         btnsizer = wx.StdDialogButtonSizer()
1294         btn = wx.Button(self, wx.ID_CANCEL)
1295         btnsizer.AddButton(btn)
1296         btn_ok = wx.Button(self, wx.ID_OK)
1297         btn_ok.SetDefault()
1298         btnsizer.AddButton(btn_ok)
1299         btnsizer.Realize()
1300         bSizer1.Add(btnsizer, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT, 5)
1301
1302         self.SetSizer( bSizer1 )
1303         self.Layout()
1304         bSizer1.Fit( self )
1305         
1306         self.Centre( wx.BOTH )
1307
1308 class PrefQuestAlc ( wx.Dialog ):
1309     
1310     def __init__( self, parent, sim = False):
1311         wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = u'Classification', pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.DEFAULT_DIALOG_STYLE )
1312         
1313         self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
1314         
1315         #---------------------------------------------------------------
1316         #self.content = parent.content[:]
1317         self.header = parent.tableau.get_colnames()
1318         labels = [val for val in self.header]
1319         self.labels_tot = labels
1320         self.varsup = []
1321         self.sim = sim
1322         #---------------------------------------------------------------
1323         bSizer2 = wx.BoxSizer( wx.VERTICAL )
1324         
1325         fgSizer1 = wx.FlexGridSizer( 0, 2, 0, 0 )
1326         fgSizer1.SetFlexibleDirection( wx.BOTH )
1327         fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
1328
1329         if not self.sim :
1330             self.lab_format = wx.StaticText( self, wx.ID_ANY, u"Le corpus est formaté", wx.DefaultPosition, wx.DefaultSize, 0 )
1331             self.lab_format.Wrap( -1 )
1332             fgSizer1.Add( self.lab_format, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1333         
1334             m_radioBox1Choices = [ u"oui", u"non" ]
1335             self.m_radioBox1 = wx.RadioBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, m_radioBox1Choices, 1, wx.RA_SPECIFY_COLS )
1336             self.m_radioBox1.SetSelection( 0 )
1337             fgSizer1.Add( self.m_radioBox1, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1338         
1339         self.m_staticText3 = wx.StaticText( self, wx.ID_ANY, u"Variables actives (min = 3) :", wx.DefaultPosition, wx.DefaultSize, 0 )
1340         self.m_staticText3.Wrap( -1 )
1341         fgSizer1.Add( self.m_staticText3, 0, wx.ALL, 5 )
1342         
1343         self.m_staticText2 = wx.StaticText( self, wx.ID_ANY, u"Variables illustratives (min = 1):", wx.DefaultPosition, wx.DefaultSize, 0 )
1344         self.m_staticText2.Wrap( -1 )
1345         fgSizer1.Add( self.m_staticText2, 0, wx.ALL, 5 )
1346         
1347         self.ListActive = wx.ListBox( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, labels,  wx.LB_EXTENDED )
1348         self.ListActive.SetMinSize( wx.Size( 300,250 ) )
1349         
1350         fgSizer1.Add( self.ListActive, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL|wx.EXPAND, 5 )
1351         
1352         self.ListSup = wx.ListBox( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, labels, wx.LB_EXTENDED )
1353         self.ListSup.SetMinSize( wx.Size( 300,250 ) )
1354         
1355         fgSizer1.Add( self.ListSup, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL|wx.EXPAND, 5 )
1356         
1357         self.but_suiv = wx.Button( self, wx.ID_ANY, u"Suivant", wx.DefaultPosition, wx.DefaultSize, 0 )
1358         fgSizer1.Add( self.but_suiv, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1359         
1360         self.but_prec = wx.Button( self, wx.ID_ANY, u"Précédent", wx.DefaultPosition, wx.DefaultSize, 0 )
1361         fgSizer1.Add( self.but_prec, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1362         
1363         if not sim :
1364             self.lab_nbcl = wx.StaticText( self, wx.ID_ANY, u"Nombre de classes terminales de la phase 1", wx.DefaultPosition, wx.DefaultSize, 0 )
1365             self.lab_nbcl.Wrap( -1 )
1366             fgSizer1.Add( self.lab_nbcl, 0, wx.ALL, 5 )
1367             
1368             self.spin_nbcl = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 2, 100, 10 )
1369             self.spin_nbcl.SetValue(10)
1370             self.spin_nbcl.SetMinSize( wx.Size( 100,30 ) )
1371             
1372             fgSizer1.Add( self.spin_nbcl, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1373             
1374             self.lab_mincl = wx.StaticText( self, wx.ID_ANY, u"Effectif minimum d'une classe (2 = automatique)", wx.DefaultPosition, wx.DefaultSize, 0 )
1375             self.lab_mincl.Wrap( -1 )
1376             fgSizer1.Add( self.lab_mincl, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
1377             
1378             self.spin_mincl = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 2, 1000, 0 )
1379             self.spin_mincl.SetValue(2)
1380             self.spin_mincl.SetMinSize( wx.Size( 100,30 ) )
1381             
1382             fgSizer1.Add( self.spin_mincl, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1383             
1384         bSizer2.Add( fgSizer1, 1, wx.EXPAND, 5 )
1385         
1386         m_sdbSizer2 = wx.StdDialogButtonSizer()
1387         self.m_sdbSizer2OK = wx.Button( self, wx.ID_OK )
1388         m_sdbSizer2.AddButton( self.m_sdbSizer2OK )
1389         self.m_sdbSizer2Cancel = wx.Button( self, wx.ID_CANCEL )
1390         m_sdbSizer2.AddButton( self.m_sdbSizer2Cancel )
1391         m_sdbSizer2.Realize();
1392         bSizer2.Add( m_sdbSizer2, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT|wx.ALL, 5 )
1393         
1394         self.SetSizer( bSizer2 )
1395         self.Layout()
1396         bSizer2.Fit( self )
1397         
1398         self.Centre( wx.BOTH )
1399         
1400         if not self.sim :
1401             self.ListActive.Enable(False)
1402             self.ListSup.Enable(False)
1403             self.but_suiv.Enable(False)
1404             self.but_prec.Enable(False)
1405         else :
1406             self.ListSup.Enable(False)
1407             self.but_prec.Enable(False)
1408         
1409         # Connect Events
1410         if not self.sim :
1411             self.m_radioBox1.Bind( wx.EVT_RADIOBOX, self.onformat )
1412         self.but_suiv.Bind(wx.EVT_BUTTON, self.onsuivant)
1413         self.but_prec.Bind(wx.EVT_BUTTON, self.onprec)
1414         self.m_sdbSizer2OK.Bind(wx.EVT_BUTTON, self.onvalid)
1415
1416     def __del__( self ):
1417         pass
1418     
1419     # Virtual event handlers, overide them in your derived class
1420     def onformat( self, event ):
1421         if self.m_radioBox1.GetSelection() == 0 :
1422             self.ListActive.Enable(False)
1423             self.ListSup.Enable(False)
1424             self.but_suiv.Enable(False)
1425             self.m_sdbSizer2OK.Enable(True)
1426         else :
1427             self.ListActive.Enable(True)
1428             self.but_suiv.Enable(True)
1429             self.m_sdbSizer2OK.Enable(False)
1430         
1431     def onsuivant(self, evt) :
1432         actives = list(self.ListActive.GetSelections())
1433         actives.sort()
1434         if len(actives)>=3 and len(actives) != len(self.header) :
1435             self.hindices = []
1436             self.nactives = []
1437             compt = 0
1438             header = self.header[:]
1439             for i in range(0, len(header)):
1440                 self.hindices.append(i)
1441             for i in actives :
1442                 self.nactives.append(i)
1443                 header.pop(i - compt)
1444                 self.hindices.pop(i - compt)
1445                 compt += 1
1446             self.labels = [val for val in header]
1447             self.ListSup.Clear()
1448             for i in header :
1449                 self.ListSup.Append(i)
1450                         
1451             self.ListActive.Enable(False)    
1452             self.ListSup.Enable(True)
1453             self.but_suiv.Enable(False)
1454             self.but_prec.Enable(True)
1455             if not self.sim :
1456                 self.m_sdbSizer2OK.Enable(True)
1457
1458     def onprec(self, evt) :
1459         self.ListActive.Enable(True)    
1460         self.ListSup.Enable(False)
1461         self.but_suiv.Enable(True)
1462         self.but_prec.Enable(False)
1463         if not self.sim :
1464             self.m_sdbSizer2OK.Enable(False)
1465
1466     def onvalid(self, evt) :
1467         for i in self.ListSup.GetSelections() :
1468             self.varsup.append(self.hindices[i])
1469         if not self.sim :
1470             if len(self.varsup) >= 1 or self.m_radioBox1.GetSelection() == 0 :
1471                 evt.Skip()
1472         else :
1473             if len(self.varsup) >= 1 :
1474                 evt.Skip()
1475
1476 class FindInCluster(wx.Frame):
1477     def __init__(self, parent, id, result, style = wx.DEFAULT_FRAME_STYLE):
1478         # begin wxGlade: MyFrame.__init__
1479         wx.Frame.__init__(self, parent, id)
1480         self.spanel =  wx.ScrolledWindow(self, -1, style=wx.TAB_TRAVERSAL)
1481         self.sizer1 = wx.FlexGridSizer(len(result)+1,4,0,0)
1482         self.parent = parent
1483         self.formes = {}
1484         txt =  [u'forme',u'classe',u'chi2',u'voir']
1485         for val in txt :
1486             self.sizer1.Add( wx.StaticText(self.spanel, -1, val), 0, wx.ALL, 5)
1487         for val in txt :
1488             self.sizer1.Add(wx.StaticLine(self.spanel, -1), 0, wx.ALL, 5)
1489         for i,val in enumerate(result) :
1490             forme = val[0]
1491             cl = val[1]
1492             chi = val[2]
1493             pan = wx.Panel(self.spanel, -1, style=wx.SIMPLE_BORDER)
1494             siz = wx.BoxSizer(wx.VERTICAL)
1495             txt = wx.StaticText(pan, -1, forme)
1496             siz.Add(txt, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5)
1497             pan.SetSizer(siz)
1498             self.sizer1.Add(pan, 0, wx.ALL|wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 5)
1499             pan = wx.Panel(self.spanel, -1, style=wx.SIMPLE_BORDER)
1500             siz = wx.BoxSizer(wx.VERTICAL)
1501             txt = wx.StaticText(pan, -1, str(cl))
1502             siz.Add(txt, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5)
1503             pan.SetSizer(siz)
1504             self.sizer1.Add(pan, 0, wx.ALL|wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 5)
1505             pan = wx.Panel(self.spanel, -1, style=wx.SIMPLE_BORDER)
1506             siz = wx.BoxSizer(wx.VERTICAL)
1507             txt = wx.StaticText(pan, -1, str(chi))
1508             siz.Add(txt, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5)
1509             pan.SetSizer(siz)
1510             self.sizer1.Add(pan, 0, wx.ALL|wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 5)
1511             idbut = wx.NewId()
1512             self.formes[idbut] = [forme, cl]
1513             but = wx.Button(self.spanel, idbut, u"voir")
1514             self.sizer1.Add(but, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5)
1515             self.Bind(wx.EVT_BUTTON, self.showitem, but)
1516         self.button_1 = wx.Button(self, -1, "Fermer")
1517         self.Bind(wx.EVT_BUTTON, self.OnCloseMe, self.button_1)
1518         self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)
1519         self.__set_properties()
1520         self.__do_layout()
1521         # end wxGlade
1522     
1523     def __set_properties(self):
1524         self.SetTitle(u'Résultats')
1525         self.spanel.EnableScrolling(True,True)
1526         #self.panel_1.SetSize((1000,1000))
1527         self.spanel.SetScrollRate(20, 20)
1528         h = 60 * len(self.formes)
1529         if h > 600 :
1530             h = 600
1531         if h < 150 :
1532             h = 150
1533         self.SetSize(wx.Size(400,h))
1534
1535     def __do_layout(self):
1536         # begin wxGlade: MyFrame.__do_layout
1537         sizer_1 = wx.BoxSizer(wx.VERTICAL)
1538         sizer_2 = wx.BoxSizer(wx.VERTICAL)
1539         self.spanel.SetSizer(self.sizer1)
1540         sizer_1.Add(self.spanel, 4, wx.EXPAND, 0)
1541         sizer_1.Add(self.button_1, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ADJUST_MINSIZE, 0)
1542         #sizer_1.Add(sizer_2, 1, wx.EXPAND, 0)
1543         self.SetAutoLayout(True)
1544         self.SetSizer(sizer_1)
1545         self.Layout()
1546         # end wxGlade
1547
1548     def showitem(self, evt) :
1549         idb = evt.GetEventObject().GetId()
1550         nb = self.parent.nb
1551         profile = nb.GetPage(nb.GetSelection())
1552         cl = self.formes[idb][1] - 1
1553         forme = self.formes[idb][0]
1554         profile.ProfNB.SetSelection(cl)
1555         UnSelectList(profile.ProfNB.GetPage(cl))
1556         datas = dict([[profile.ProfNB.GetPage(cl).getColumnText(i,6),i] for i in range(profile.ProfNB.GetPage(cl).GetItemCount())])
1557         profile.ProfNB.GetPage(cl).SetItemState(datas[self.formes[idb][0]], wx.LIST_STATE_SELECTED, wx.LIST_STATE_SELECTED)
1558         profile.ProfNB.GetPage(cl).Focus(datas[forme])
1559         profile.ProfNB.GetPage(cl).SetFocus()
1560
1561     def OnCloseMe(self, evt) :
1562         self.Close(True)
1563
1564     def OnCloseWindow(self, evt):
1565         self.Destroy()
1566
1567 class SearchDial ( wx.Dialog ):
1568     
1569     def __init__( self, parent, listctrl, col, shown):
1570         wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = wx.EmptyString, pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.DEFAULT_DIALOG_STYLE )
1571         self.parent = parent
1572         self.listctrl = listctrl
1573         self.col = col
1574         self.shown = shown
1575         self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
1576         
1577         bSizer1 = wx.BoxSizer( wx.VERTICAL )
1578         
1579         self.search = wx.SearchCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.TE_PROCESS_ENTER )
1580         self.search.ShowSearchButton( True )
1581         self.search.ShowCancelButton( True )
1582         bSizer1.Add( self.search, 0, wx.ALL, 5 )
1583         sizer2 = wx.BoxSizer(wx.HORIZONTAL)
1584         self.backward = wx.Button(self, wx.ID_BACKWARD, u"Précédent")
1585         self.forward = wx.Button(self, wx.ID_FORWARD, u"Suivant")
1586         sizer2.Add(self.backward, 0, wx.ALL, 5)
1587         sizer2.Add(self.forward, 0, wx.ALL, 5)
1588         bSizer1.Add( sizer2, 0, wx.ALL, 5 )
1589
1590         self.SetSizer( bSizer1 )
1591         self.Layout()
1592         bSizer1.Fit( self )
1593         self.Bind(wx.EVT_SEARCHCTRL_SEARCH_BTN, self.OnSearch, self.search)
1594         self.Bind(wx.EVT_SEARCHCTRL_CANCEL_BTN, self.OnCancel, self.search)
1595         self.Bind(wx.EVT_TEXT_ENTER, self.OnSearch, self.search)
1596         self.Bind(wx.EVT_BUTTON, self.onforward, self.forward)
1597         self.Bind(wx.EVT_BUTTON, self.onbackward, self.backward)
1598         self.search.SetFocus()
1599         self.forward.Enable(False)
1600         self.backward.Enable(False)
1601
1602         self.Centre( wx.BOTH )
1603     
1604     def __del__( self ):
1605         pass
1606
1607     def OnSearch(self, evt):
1608         UnSelectList(self.listctrl)
1609         search_word = self.search.GetValue()
1610         if search_word.strip() != '' :
1611             formes = [self.listctrl.getColumnText(i, self.col) for i in range(self.listctrl.GetItemCount())]
1612             if search_word.endswith(u'*') :
1613                 search_word = search_word[0:-1]
1614                 result = [j for j, forme in enumerate(formes) if forme.startswith(search_word)]
1615             else :
1616                 result = [j for j, forme in enumerate(formes) if forme == search_word]
1617             if result == [] :
1618                 self.noresult()
1619             elif self.shown == True :
1620                 self.showitems(result)
1621             else :
1622                 self.showresult(result)
1623         else :
1624             self.Destroy()
1625
1626     
1627     def showitems(self, items) :
1628         if len(items) == 1 :
1629             self.listctrl.SetItemState(items[0], wx.LIST_STATE_SELECTED, wx.LIST_STATE_SELECTED)
1630             self.listctrl.Focus(items[0])
1631             self.listctrl.SetFocus()
1632             self.Destroy()
1633         else :
1634             for i in items :
1635                 self.listctrl.SetItemState(i, wx.LIST_STATE_SELECTED, wx.LIST_STATE_SELECTED)
1636             self.listctrl.Focus(items[0])
1637             self.listctrl.SetFocus()
1638             self.forward.Enable(True)
1639             self.backward.Enable(False)
1640             self.items = items
1641             self.forwitem = 1
1642             self.backitem = -1
1643     
1644     def showresult(self, result) :
1645         toshow = [self.listctrl.itemDataMap[int(self.listctrl.getColumnText(i,0))] for i in result]
1646         proflist = [[[line[1], i+1, val] for i, val in enumerate(line[2:]) if val>=2] for line in toshow]
1647         #FIXME: intervenir en aval en virant les forme avec chi<2
1648         if proflist != [[]] :
1649             proflist = [val for line in proflist for val in line if line !=[]]
1650             nb = self.parent.parent.nb
1651             profile = nb.GetPage(nb.GetSelection())
1652             first_forme = proflist[0]
1653             cl = first_forme[1] - 1
1654             profile.ProfNB.SetSelection(cl)
1655             profile.ProfNB.GetPage(cl).SetFocus()
1656             UnSelectList(profile.ProfNB.GetPage(cl))
1657             datas = dict([[profile.ProfNB.GetPage(cl).getColumnText(i,6),i] for i in range(profile.ProfNB.GetPage(cl).GetItemCount())])
1658             profile.ProfNB.GetPage(cl).SetItemState(datas[first_forme[0]], wx.LIST_STATE_SELECTED, wx.LIST_STATE_SELECTED)
1659             profile.ProfNB.GetPage(cl).Focus(datas[first_forme[0]])
1660             profile.ProfNB.GetPage(cl).SetFocus()
1661             if len(proflist) == 1 :
1662                 self.Destroy()
1663             else :
1664                 SearchResult = FindInCluster(self.parent.parent, -1, proflist)
1665                 SearchResult.Show()
1666                 self.Destroy()
1667         else :
1668             self.noresult()
1669
1670     def onforward(self, evt) :
1671         self.listctrl.Focus(self.items[self.forwitem])
1672         self.listctrl.SetFocus()
1673         self.forwitem += 1
1674         if self.forwitem == len(self.items) :
1675             self.forward.Enable(False)
1676             self.backward.Enable(True)
1677             self.backitem += 1
1678         else :
1679             self.backitem += 1
1680             self.backward.Enable(True)
1681
1682     def onbackward(self, evt) :
1683         self.listctrl.Focus(self.items[self.backitem])
1684         self.listctrl.SetFocus()
1685         self.backitem -= 1
1686         if self.backitem == -1 :
1687             self.forwitem -= 1
1688             self.forward.Enable(True)
1689             self.backward.Enable(False)
1690         else :
1691             self.forwitem -= 1
1692             self.forward.Enable(True)
1693
1694     def noresult(self) :
1695         msg = u"Forme absente"
1696         dial = wx.MessageDialog(self, 'Forme absente','Forme absente', wx.OK | wx.ICON_INFORMATION)
1697         dial.CenterOnParent()
1698         dial.ShowModal()
1699         dial.Destroy()
1700
1701     def OnCancel(self, evt) :
1702         self.search.Clear()
1703
1704 def UnSelectList(liste) :
1705     print liste
1706     if liste.GetFirstSelected() != -1 :
1707         last = liste.GetFirstSelected()
1708         liste.Select(liste.GetFirstSelected(), False)
1709         while liste.GetNextSelected(last) != -1 :
1710              last = liste.GetNextSelected(last)
1711              liste.Select(liste.GetFirstSelected(),False)
1712
1713
1714 class OptLexi(wx.Dialog):
1715     def __init__(self, *args, **kwds):
1716         # begin wxGlade: MyDialog.__init__
1717         kwds["style"] = wx.DEFAULT_DIALOG_STYLE
1718         wx.Dialog.__init__(self, *args, **kwds)
1719         self.listet = None
1720         self.variables = None
1721         #self.labellem =  wx.StaticText(self, -1, u"Lemmatisation : ")
1722         #self.checklem = wx.CheckBox(self, -1)
1723         self.label_var =  wx.StaticText(self, -1, u"Sélection par :")
1724         self.choice = wx.Choice(self, -1, (100,50), choices = [u'variables', u'modalités'])
1725         self.label1 =  wx.StaticText(self, -1, u"Choix")
1726         self.list_box_1 = wx.ListBox(self, -1, choices=[],  size = wx.Size( 150,200 ), style=wx.LB_EXTENDED | wx.LB_HSCROLL)
1727         self.button_2 = wx.Button(self, wx.ID_CANCEL, "")
1728         self.button_1 = wx.Button(self, wx.ID_OK, "")
1729         self.label_indice =  wx.StaticText(self, -1, u"indice")
1730         self.choice_indice =  wx.Choice(self, -1, (100,50), choices = [u'loi hypergéométique', u'chi2'])
1731         self.label = wx.StaticText(self, -1, u"effectif minimum")
1732         self.spin = wx.SpinCtrl(self, -1, min = 1, max = 10000)
1733         self.Bind(wx.EVT_CHOICE, self.onselect, self.choice)
1734         self.__set_properties()
1735         self.__do_layout()
1736         # end wxGlade
1737
1738     def __set_properties(self):
1739         # begin wxGlade: MyDialog.__set_properties
1740         self.SetTitle("Choix des variables")
1741         self.spin.SetValue(10)
1742         self.choice.SetSelection(0)
1743         #self.SetMinSize(wx.Size(300, 400))
1744         # end wxGlade
1745
1746     def __do_layout(self):
1747         # begin wxGlade: MyDialog.__do_layout
1748         sizer_1 = wx.BoxSizer(wx.VERTICAL)
1749         sizer_2 = wx.FlexGridSizer(0,2,0,0)
1750         sizer_3 = wx.BoxSizer(wx.HORIZONTAL)
1751         #sizer_2.Add(self.labellem, 0, wx.ALIGN_CENTER_VERTICAL, 3)
1752         #sizer_2.Add(self.checklem, 0, wx.ALIGN_CENTER_VERTICAL, 3)
1753         sizer_2.Add(self.label_var, 0, wx.ALIGN_CENTER_VERTICAL, 3)
1754         sizer_2.Add(self.choice, 0, wx.ALIGN_CENTER_VERTICAL, 3)
1755         sizer_2.Add(self.label1, 0, wx.ALIGN_CENTER_VERTICAL, 3)
1756         sizer_2.Add(self.list_box_1, 0, wx.ALIGN_RIGHT, 3)
1757         sizer_3.Add(self.button_2, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 3)
1758         sizer_3.Add(self.button_1, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 3)
1759         sizer_2.Add(self.label_indice, 0, wx.ALIGN_CENTER_VERTICAL, 3)
1760         sizer_2.Add(self.choice_indice, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 3)
1761         sizer_2.Add(self.label, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 3)
1762         sizer_2.Add(self.spin, 0, wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 3)
1763         sizer_1.Add(sizer_2, 0, wx.ALIGN_CENTER_HORIZONTAL, 3)
1764         sizer_1.Add(sizer_3, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_RIGHT, 3)
1765         self.SetSizer(sizer_1)
1766         sizer_1.Fit(self)
1767         self.Layout()
1768         self.Centre()
1769
1770     def onselect(self, evt):
1771         self.list_box_1.Clear()
1772         if self.choice.GetSelection() == 0 :
1773             for var in self.variables :
1774                 self.list_box_1.Append(var)
1775         else :
1776             for et in self.listet :
1777                 self.list_box_1.Append(et)
1778
1779
1780 class PrefDendro ( wx.Dialog ):
1781     
1782     def __init__( self, parent, param ):
1783         wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = u"Dendrogramme", pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.DEFAULT_DIALOG_STYLE )
1784         self.param = param
1785         self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
1786         
1787         fgSizer1 = wx.FlexGridSizer( 0, 2, 0, 0 )
1788         fgSizer1.SetFlexibleDirection( wx.BOTH )
1789         fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
1790         
1791         self.m_staticText1 = wx.StaticText( self, wx.ID_ANY, u"Taille de l'image", wx.DefaultPosition, wx.DefaultSize, 0 )
1792         self.m_staticText1.Wrap( -1 )
1793         fgSizer1.Add( self.m_staticText1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1794         
1795         bSizer2 = wx.BoxSizer( wx.VERTICAL )
1796         
1797         bSizer3 = wx.BoxSizer( wx.HORIZONTAL )
1798         
1799         self.m_staticText2 = wx.StaticText( self, wx.ID_ANY, u"Hauteur", wx.DefaultPosition, wx.DefaultSize, 0 )
1800         self.m_staticText2.Wrap( -1 )
1801         bSizer3.Add( self.m_staticText2, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1802         
1803         self.m_spinCtrl1 = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 50, 10000, 600 )
1804         bSizer3.Add( self.m_spinCtrl1, 0, wx.ALL, 5 )
1805         
1806         bSizer2.Add( bSizer3, 1, wx.EXPAND, 5 )
1807         
1808         bSizer31 = wx.BoxSizer( wx.HORIZONTAL )
1809         
1810         self.m_staticText3 = wx.StaticText( self, wx.ID_ANY, u"Largeur", wx.DefaultPosition, wx.DefaultSize, 0 )
1811         self.m_staticText3.Wrap( -1 )
1812         bSizer31.Add( self.m_staticText3, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1813         
1814         self.m_spinCtrl2 = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 50, 10000, 600 )
1815         bSizer31.Add( self.m_spinCtrl2, 0, wx.ALL, 5 )
1816         
1817         bSizer2.Add( bSizer31, 1, wx.EXPAND, 5 )
1818         
1819         fgSizer1.Add( bSizer2, 1, wx.EXPAND, 5 )
1820         
1821         self.m_staticline1 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1822         fgSizer1.Add( self.m_staticline1, 0, wx.EXPAND |wx.ALL, 5 )
1823         
1824         self.m_staticline2 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1825         fgSizer1.Add( self.m_staticline2, 0, wx.EXPAND |wx.ALL, 5 )
1826         
1827         self.m_staticText4 = wx.StaticText( self, wx.ID_ANY, u"Type de dendrogramme", wx.DefaultPosition, wx.DefaultSize, 0 )
1828         self.m_staticText4.Wrap( -1 )
1829         fgSizer1.Add( self.m_staticText4, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1830         
1831         m_choice1Choices = [ u"phylogram", u"cladogram", u"fan", u"unrooted", u"radial" ]
1832         self.m_choice1 = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, m_choice1Choices, 0 )
1833         self.m_choice1.SetSelection( 0 )
1834         fgSizer1.Add( self.m_choice1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT|wx.ALL, 5 )
1835         
1836         self.m_staticline3 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1837         fgSizer1.Add( self.m_staticline3, 0, wx.EXPAND |wx.ALL, 5 )
1838         
1839         self.m_staticline4 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1840         fgSizer1.Add( self.m_staticline4, 0, wx.EXPAND |wx.ALL, 5 )
1841         
1842         self.m_staticText5 = wx.StaticText( self, wx.ID_ANY, u"Couleur ou noir et blanc", wx.DefaultPosition, wx.DefaultSize, 0 )
1843         self.m_staticText5.Wrap( -1 )
1844         fgSizer1.Add( self.m_staticText5, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1845         
1846         m_radioBox1Choices = [ u"couleur", u"noir et blanc" ]
1847         self.m_radioBox1 = wx.RadioBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, m_radioBox1Choices, 1, wx.RA_SPECIFY_COLS )
1848         self.m_radioBox1.SetSelection( 0 )
1849         fgSizer1.Add( self.m_radioBox1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT|wx.ALL, 5 )
1850         
1851         self.m_staticline5 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1852         fgSizer1.Add( self.m_staticline5, 0, wx.EXPAND |wx.ALL, 5 )
1853         
1854         self.m_staticline6 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1855         fgSizer1.Add( self.m_staticline6, 0, wx.EXPAND |wx.ALL, 5 )
1856         
1857         bSizer4 = wx.BoxSizer( wx.HORIZONTAL )
1858         
1859         self.m_staticText6 = wx.StaticText( self, wx.ID_ANY, u"Ajouter la taille des classes", wx.DefaultPosition, wx.DefaultSize, 0 )
1860         self.m_staticText6.Wrap( -1 )
1861         bSizer4.Add( self.m_staticText6, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1862         
1863         self.m_checkBox1 = wx.CheckBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
1864         self.m_checkBox1.SetValue(True) 
1865         bSizer4.Add( self.m_checkBox1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1866         
1867         fgSizer1.Add( bSizer4, 1, wx.EXPAND, 5 )
1868         
1869         m_radioBox2Choices = [ u"camemberts", u"barres" ]
1870         self.m_radioBox2 = wx.RadioBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, m_radioBox2Choices, 1, wx.RA_SPECIFY_COLS )
1871         self.m_radioBox2.SetSelection( 0 )
1872         fgSizer1.Add( self.m_radioBox2, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT|wx.ALL, 5 )
1873         
1874         self.m_staticline7 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1875         fgSizer1.Add( self.m_staticline7, 0, wx.EXPAND |wx.ALL, 5 )
1876         
1877         self.m_staticline8 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1878         fgSizer1.Add( self.m_staticline8, 0, wx.EXPAND |wx.ALL, 5 )
1879         
1880         
1881         fgSizer1.AddSpacer( ( 0, 0), 1, wx.EXPAND, 5 )
1882         
1883         m_sdbSizer2 = wx.StdDialogButtonSizer()
1884         self.m_sdbSizer2OK = wx.Button( self, wx.ID_OK )
1885         m_sdbSizer2.AddButton( self.m_sdbSizer2OK )
1886         self.m_sdbSizer2Cancel = wx.Button( self, wx.ID_CANCEL )
1887         m_sdbSizer2.AddButton( self.m_sdbSizer2Cancel )
1888         m_sdbSizer2.Realize();
1889         fgSizer1.Add( m_sdbSizer2, 1, wx.EXPAND, 5 )
1890         
1891         self.__set_properties()
1892         self.SetSizer( fgSizer1 )
1893         self.Layout()
1894         fgSizer1.Fit( self )
1895         
1896         self.Centre( wx.BOTH )
1897
1898     def __set_properties(self):
1899         self.m_spinCtrl2.SetValue(self.param['width'])
1900         self.m_spinCtrl1.SetValue(self.param['height'])
1901         self.m_choice1.SetSelection(self.param['type_dendro'])
1902         self.m_radioBox1.SetSelection(self.param['color_nb'])
1903         self.m_checkBox1.SetValue(self.param['taille_classe'])
1904         self.m_radioBox2.SetSelection(self.param['type_tclasse'])
1905     
1906     def __del__( self ):
1907         pass
1908
1909
1910 class PrefWordCloud ( wx.Dialog ):
1911     
1912     def __init__( self, parent ):
1913         wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = u"Préférences wordcloud", pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.DEFAULT_DIALOG_STYLE )
1914         
1915         self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
1916         
1917         fgSizer1 = wx.FlexGridSizer( 0, 2, 0, 0 )
1918         fgSizer1.SetFlexibleDirection( wx.BOTH )
1919         fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
1920         
1921         #self.m_staticText1 = wx.StaticText( self, wx.ID_ANY, u"Sélectionner les formes", wx.DefaultPosition, wx.DefaultSize, 0 )
1922         #self.m_staticText1.Wrap( -1 )
1923         #fgSizer1.Add( self.m_staticText1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
1924         
1925         #self.but_selectcol = wx.Button( self, wx.ID_ANY, u"Sélectionner", wx.DefaultPosition, wx.DefaultSize, 0 )
1926         #fgSizer1.Add( self.but_selectcol, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1927         
1928         #self.m_staticline1 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1929         #fgSizer1.Add( self.m_staticline1, 0, wx.EXPAND |wx.ALL, 5 )
1930         
1931         #self.m_staticline2 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1932         #fgSizer1.Add( self.m_staticline2, 0, wx.EXPAND |wx.ALL, 5 )
1933         
1934         bSizer1 = wx.BoxSizer( wx.HORIZONTAL )
1935         
1936         self.m_staticText3 = wx.StaticText( self, wx.ID_ANY, u"Hauteur", wx.DefaultPosition, wx.DefaultSize, 0 )
1937         self.m_staticText3.Wrap( -1 )
1938         bSizer1.Add( self.m_staticText3, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
1939         
1940         self.spin_H = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size( 100,30 ), wx.SP_ARROW_KEYS, 0, 10000, 600 )
1941         bSizer1.Add( self.spin_H, 0, wx.ALL, 5 )
1942         
1943         fgSizer1.Add( bSizer1, 1, wx.EXPAND, 5 )
1944         
1945         bSizer3 = wx.BoxSizer( wx.HORIZONTAL )
1946         
1947         self.m_staticText4 = wx.StaticText( self, wx.ID_ANY, u"Largeur", wx.DefaultPosition, wx.DefaultSize, 0 )
1948         self.m_staticText4.Wrap( -1 )
1949         bSizer3.Add( self.m_staticText4, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
1950         
1951         self.spin_L = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size( 100,30 ), wx.SP_ARROW_KEYS, 0, 10000, 600 )
1952         bSizer3.Add( self.spin_L, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1953         
1954         fgSizer1.Add( bSizer3, 1, wx.EXPAND, 5 )
1955         
1956         self.m_staticline3 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1957         fgSizer1.Add( self.m_staticline3, 0, wx.EXPAND |wx.ALL, 5 )
1958         
1959         self.m_staticline4 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1960         fgSizer1.Add( self.m_staticline4, 0, wx.EXPAND |wx.ALL, 5 )
1961         
1962         self.m_staticText5 = wx.StaticText( self, wx.ID_ANY, u"Nombre maximum de formes", wx.DefaultPosition, wx.DefaultSize, 0 )
1963         self.m_staticText5.Wrap( -1 )
1964         fgSizer1.Add( self.m_staticText5, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
1965         
1966         self.spin_maxword = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 0, 10000, 600 )
1967         fgSizer1.Add( self.spin_maxword, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1968         
1969         self.m_staticline5 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1970         fgSizer1.Add( self.m_staticline5, 0, wx.EXPAND |wx.ALL, 5 )
1971         
1972         self.m_staticline6 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1973         fgSizer1.Add( self.m_staticline6, 0, wx.EXPAND |wx.ALL, 5 )
1974         
1975         self.typeformes = wx.StaticText( self, wx.ID_ANY, u"formes retenues", wx.DefaultPosition, wx.DefaultSize, 0 )
1976         self.typeformes.Wrap( -1 )
1977         fgSizer1.Add( self.typeformes, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1978         
1979         typeformeschoiceChoices = [ u"actives", u"supplémentaires", u"actives et supplémentaires" ]
1980         self.typeformeschoice = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, typeformeschoiceChoices, 0 )
1981         self.typeformeschoice.SetSelection( 0 )
1982         fgSizer1.Add( self.typeformeschoice, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1983         
1984         self.m_staticline11 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1985         fgSizer1.Add( self.m_staticline11, 0, wx.EXPAND |wx.ALL, 5 )
1986         
1987         self.m_staticline12 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1988         fgSizer1.Add( self.m_staticline12, 0, wx.EXPAND |wx.ALL, 5 )        
1989         
1990         self.m_staticText6 = wx.StaticText( self, wx.ID_ANY, u"Taille du texte", wx.DefaultPosition, wx.DefaultSize, 0 )
1991         self.m_staticText6.Wrap( -1 )
1992         fgSizer1.Add( self.m_staticText6, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
1993         
1994         bSizer4 = wx.BoxSizer( wx.VERTICAL )
1995         
1996         bSizer5 = wx.BoxSizer( wx.HORIZONTAL )
1997         
1998         self.m_staticText7 = wx.StaticText( self, wx.ID_ANY, u"Min", wx.DefaultPosition, wx.DefaultSize, 0 )
1999         self.m_staticText7.Wrap( -1 )
2000         bSizer5.Add( self.m_staticText7, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2001         
2002         self.spin_mincex = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 0, 1000, 5 )
2003         bSizer5.Add( self.spin_mincex, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT|wx.ALL, 5 )
2004         
2005         bSizer4.Add( bSizer5, 1, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.EXPAND, 5 )
2006         
2007         bSizer6 = wx.BoxSizer( wx.HORIZONTAL )
2008         
2009         self.m_staticText8 = wx.StaticText( self, wx.ID_ANY, u"Max", wx.DefaultPosition, wx.DefaultSize, 0 )
2010         self.m_staticText8.Wrap( -1 )
2011         bSizer6.Add( self.m_staticText8, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2012         
2013         self.spin_maxcex = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 0, 1000, 50 )
2014         bSizer6.Add( self.spin_maxcex, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2015         
2016         bSizer4.Add( bSizer6, 1, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.EXPAND, 5 )
2017         
2018         fgSizer1.Add( bSizer4, 1, wx.EXPAND, 5 )
2019         
2020         self.m_staticline7 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
2021         fgSizer1.Add( self.m_staticline7, 0, wx.EXPAND |wx.ALL, 5 )
2022         
2023         self.m_staticline8 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
2024         fgSizer1.Add( self.m_staticline8, 0, wx.EXPAND |wx.ALL, 5 )
2025         
2026         bSizer61 = wx.BoxSizer( wx.HORIZONTAL )
2027         
2028         self.m_staticText81 = wx.StaticText( self, wx.ID_ANY, u"Couleur du texte", wx.DefaultPosition, wx.DefaultSize, 0 )
2029         self.m_staticText81.Wrap( -1 )
2030         bSizer61.Add( self.m_staticText81, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2031         
2032         self.color_text = wx.ColourPickerCtrl( self, wx.ID_ANY, wx.BLACK, wx.DefaultPosition, wx.DefaultSize, wx.CLRP_DEFAULT_STYLE )
2033         bSizer61.Add( self.color_text, 0, wx.ALL, 5 )
2034         
2035         fgSizer1.Add( bSizer61, 1, wx.EXPAND, 5 )
2036         
2037         bSizer7 = wx.BoxSizer( wx.HORIZONTAL )
2038         
2039         self.m_staticText9 = wx.StaticText( self, wx.ID_ANY, u"Couleur du fond", wx.DefaultPosition, wx.DefaultSize, 0 )
2040         self.m_staticText9.Wrap( -1 )
2041         bSizer7.Add( self.m_staticText9, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2042         
2043         self.color_bg = wx.ColourPickerCtrl( self, wx.ID_ANY, (255,255,255), wx.DefaultPosition, wx.DefaultSize, wx.CLRP_DEFAULT_STYLE )
2044         bSizer7.Add( self.color_bg, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2045         
2046         fgSizer1.Add( bSizer7, 1, wx.EXPAND, 5 )
2047         
2048         self.m_staticline9 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
2049         fgSizer1.Add( self.m_staticline9, 0, wx.EXPAND |wx.ALL, 5 )
2050         
2051         self.m_staticline10 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
2052         fgSizer1.Add( self.m_staticline10, 0, wx.EXPAND |wx.ALL, 5 )
2053
2054         fgSizer1.AddSpacer( ( 0, 0), 1, wx.EXPAND, 5 )
2055         
2056         m_sdbSizer1 = wx.StdDialogButtonSizer()
2057         self.m_sdbSizer1OK = wx.Button( self, wx.ID_OK )
2058         m_sdbSizer1.AddButton( self.m_sdbSizer1OK )
2059         self.m_sdbSizer1Cancel = wx.Button( self, wx.ID_CANCEL )
2060         m_sdbSizer1.AddButton( self.m_sdbSizer1Cancel )
2061         m_sdbSizer1.Realize();
2062         fgSizer1.Add( m_sdbSizer1, 1, wx.EXPAND, 5 )
2063         
2064         self.SetSizer( fgSizer1 )
2065         self.Layout()
2066         fgSizer1.Fit( self )
2067         
2068         self.Centre( wx.BOTH )
2069     
2070     def __del__( self ):
2071         pass
2072     
2073 class PrefChi(sc.SizedDialog):
2074     def __init__(self, parent, ID, optionchi, title):
2075
2076         sc.SizedDialog.__init__(self, None, -1, u"Paramètres", 
2077                         style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER)
2078         pane = self.GetContentsPane()
2079         pane.SetSizerType("form")
2080         pane.SetSizerProps(border=("all",5))
2081         self.parent = parent
2082         self.optionchi = optionchi
2083         
2084
2085         self.label_obs = wx.StaticText(pane, -1, u'valeurs observée')
2086         self.check1 = wx.CheckBox(pane, -1)
2087  
2088         self.label_theo = wx.StaticText(pane, -1, u'valeurs théoriques')
2089         self.check2 = wx.CheckBox(pane, -1)
2090
2091         self.label_resi = wx.StaticText(pane, -1, u'residuals')
2092         self.check3 = wx.CheckBox(pane, -1)
2093
2094         self.label_contrib = wx.StaticText(pane, -1, u'contributions a posteriori')
2095         self.check4 = wx.CheckBox(pane, -1)
2096 #        self.label_graph = wx.StaticText(pane, -1, u'graphique')
2097 #        self.check8 = wx.CheckBox(pane, -1)
2098         self.label_pourcent = wx.StaticText(pane, -1, u'pourcentage total')
2099         self.check5 = wx.CheckBox(pane, -1)
2100
2101         self.label_prl = wx.StaticText(pane, -1, u'pourcentages en ligne')
2102         self.check6 = wx.CheckBox(pane, -1)
2103
2104         self.label_prc = wx.StaticText(pane, -1, u'pourcentages en colonne')
2105         self.check7 = wx.CheckBox(pane, -1)
2106
2107         self.label_graph = wx.StaticText(pane, -1, u'graphique')
2108         self.check8 = wx.CheckBox(pane, -1)
2109         
2110         self.label_graphbw = wx.StaticText(pane, -1, u'graphique en noir et blanc')
2111         self.checkbw = wx.CheckBox(pane, -1)
2112
2113         self.SetButtonSizer(self.CreateStdDialogButtonSizer(wx.OK | wx.CANCEL))
2114
2115         self.__set_properties()
2116         self.Fit()
2117         self.SetMinSize(self.GetSize())
2118
2119     def __set_properties(self):
2120         self.check1.SetValue(self.optionchi['valobs'])
2121         self.check2.SetValue(self.optionchi['valtheo'])
2122         self.check3.SetValue(self.optionchi['resi'])
2123         self.check4.SetValue(self.optionchi['contrib'])
2124         self.check5.SetValue(self.optionchi['pourcent'])
2125         self.check6.SetValue(self.optionchi['pourcentl'])
2126         self.check7.SetValue(self.optionchi['pourcentc'])
2127         self.check8.SetValue(self.optionchi['graph'])
2128         self.checkbw.SetValue(self.optionchi['bw'])
2129
2130 class ChiDialog(wx.Dialog):
2131     def __init__(
2132             self, parent, ID, title, optionchi, size=wx.DefaultSize, pos=wx.DefaultPosition, 
2133             style=wx.DEFAULT_DIALOG_STYLE
2134             ):
2135
2136         pre = wx.PreDialog()
2137         pre.SetExtraStyle(wx.DIALOG_EX_CONTEXTHELP)
2138         pre.Create(parent, ID, title, pos, size, style)
2139
2140         self.PostCreate(pre)
2141         self.parent = parent 
2142         self.optionchi = optionchi
2143         self.chiopt = False
2144         #self.Filename=parent.filename
2145         #self.content=parent.content[:]
2146         self.headers=parent.tableau.get_colnames()
2147         LABELLIST=[]
2148         
2149         for i in self.headers:
2150             if len(i)>60 :
2151                 LABELLIST.append(i[0:60])
2152             else:
2153                 LABELLIST.append(i)
2154         
2155         self.ListOK=[]
2156         self.LabelListOK=LABELLIST
2157  
2158         self.list_box_1 = wx.ListBox(self, -1, choices=self.LabelListOK, style=wx.LB_EXTENDED|wx.LB_HSCROLL)
2159         self.list_box_2 = wx.ListBox(self, -1, choices=self.LabelListOK, style=wx.LB_EXTENDED|wx.LB_HSCROLL)
2160         self.button_1 = wx.Button(self, wx.ID_OK)
2161         self.button_cancel = wx.Button(self, wx.ID_CANCEL)
2162         self.button_pref = wx.Button(self, wx.ID_PREFERENCES)
2163         self.__set_properties()
2164         self.__do_layout()
2165
2166         self.Bind(wx.EVT_LISTBOX, self.Select1, self.list_box_1)
2167         self.Bind(wx.EVT_BUTTON, self.onparam, self.button_pref)
2168         # end wxGlade
2169 #-------------------------------
2170     def __set_properties(self):
2171         # begin wxGlade: ConfChi2.__set_properties
2172         self.SetTitle(u"Sélection des variables")
2173
2174     def __do_layout(self):
2175         # begin wxGlade: ConfChi2.__do_layout
2176         sizer_1 = wx.BoxSizer(wx.VERTICAL)
2177         sizer_2 = wx.BoxSizer(wx.VERTICAL)
2178         sizer_3 = wx.BoxSizer(wx.HORIZONTAL)
2179         sizer_4 = wx.BoxSizer(wx.HORIZONTAL)
2180         sizer_3.Add(self.list_box_1, 0, wx.EXPAND, 0)
2181         sizer_3.Add(self.list_box_2, 0, wx.EXPAND|wx.ALIGN_CENTER_HORIZONTAL, 0)
2182         sizer_2.Add(sizer_3, 1, wx.EXPAND, 0)
2183         sizer_4.Add(self.button_cancel, 0, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL, 0)
2184         sizer_4.Add(self.button_pref, 0, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL, 0)
2185         sizer_4.Add(self.button_1, 0, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL, 0)
2186         sizer_2.Add(sizer_4, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL, 0)
2187         sizer_1.Add(sizer_2, 1, wx.EXPAND, 0)
2188         self.SetSizer(sizer_1)
2189         sizer_1.Fit(self)
2190         self.Layout()
2191         # end wxGlade
2192
2193     def Select1(self, event): # wxGlade: ConfChi2.<event_handler>
2194         event.Skip()
2195     
2196     
2197     def onparam(self,event):
2198         self.dial = PrefChi(self.parent, -1, self.optionchi, '')
2199         self.dial.CenterOnParent()
2200         self.chiopt = self.dial.ShowModal()
2201
2202 class CorpusPref ( wx.Dialog ):
2203     
2204     def __init__( self, parent, parametres ):
2205         wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = u"Préférences", pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.DEFAULT_DIALOG_STYLE )
2206         self.parent = parent 
2207         langues_n = [u'français', u'english', u'german (expérimentale)', u'italian (expérimentale)', u'swedish (exp.)', u'portuguese (exp.)', 'greek', 'other...']
2208         self.langues = [u'french', u'english', u'german', 'italian', 'swedish', u'portuguese', 'greek', 'other']
2209         self.encodages = [enc[0].lower() for enc in encodages]
2210
2211         ucimark = [u'****', u'0000']
2212         ucemethod = [u'charactères', u'occurrences', u'paragraphe']
2213
2214         self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
2215         
2216         bSizer1 = wx.BoxSizer( wx.VERTICAL )
2217         
2218         self.m_notebook1 = wx.Notebook( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, 0 )
2219         self.m_panel1 = wx.Panel( self.m_notebook1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
2220         fgSizer1 = wx.FlexGridSizer( 0, 2, 0, 0 )
2221         fgSizer1.SetFlexibleDirection( wx.BOTH )
2222         fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
2223         
2224         self.m_staticText7 = wx.StaticText( self.m_panel1, wx.ID_ANY, u"Corpus", wx.DefaultPosition, wx.DefaultSize, 0 )
2225         self.m_staticText7.Wrap( -1 )
2226         fgSizer1.Add( self.m_staticText7, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2227         
2228         self.txtpath = wx.StaticText( self.m_panel1, wx.ID_ANY, u"path", wx.DefaultPosition, wx.DefaultSize, 0 )
2229         self.txtpath.Wrap( -1 )
2230         fgSizer1.Add( self.txtpath, 0, wx.ALL, 5 )
2231         
2232         self.m_staticText1 = wx.StaticText( self.m_panel1, wx.ID_ANY, u"Encodage", wx.DefaultPosition, wx.DefaultSize, 0 )
2233         self.m_staticText1.Wrap( -1 )
2234         fgSizer1.Add( self.m_staticText1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2235         
2236         encodage_choicesChoices = [' - '.join(encodage) for encodage in encodages]
2237         self.encodage_choices = wx.Choice( self.m_panel1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, encodage_choicesChoices, 0 )
2238         self.encodage_choices.SetSelection( 0 )
2239         fgSizer1.Add( self.encodage_choices, 0, wx.ALL, 5 )
2240         
2241         self.m_staticText2 = wx.StaticText( self.m_panel1, wx.ID_ANY, u"Langue", wx.DefaultPosition, wx.DefaultSize, 0 )
2242         self.m_staticText2.Wrap( -1 )
2243         fgSizer1.Add( self.m_staticText2, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2244         
2245         lang_choicesChoices = langues_n
2246         self.lang_choices = wx.Choice( self.m_panel1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, lang_choicesChoices, 0 )
2247         self.lang_choices.SetSelection( 0 )
2248         fgSizer1.Add( self.lang_choices, 0, wx.ALL, 5 )
2249
2250         self.m_staticText3 = wx.StaticText( self.m_panel1, wx.ID_ANY, u"Répertoire en sortie", wx.DefaultPosition, wx.DefaultSize, 0 )
2251         self.m_staticText3.Wrap( -1 )
2252         fgSizer1.Add( self.m_staticText3, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2253         
2254         
2255         fgSizer41 = wx.FlexGridSizer( 0, 2, 0, 0 )
2256         fgSizer41.SetFlexibleDirection( wx.BOTH )
2257         fgSizer41.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
2258         
2259         self.repout_choices = wx.TextCtrl( self.m_panel1, wx.ID_ANY, u"MyLabel", wx.DefaultPosition, wx.DefaultSize, 0 )
2260         self.repout_choices.SetMinSize( wx.Size( 400,-1 ) )
2261         fgSizer41.Add( self.repout_choices, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2262         
2263         self.m_button1 = wx.Button( self.m_panel1, wx.ID_ANY, u"Modifier...", wx.DefaultPosition, wx.DefaultSize, 0 )
2264         fgSizer41.Add( self.m_button1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2265         
2266         fgSizer1.Add( fgSizer41, 1, wx.EXPAND, 5 )        
2267
2268         self.m_staticText12 = wx.StaticText( self.m_panel1, wx.ID_ANY, u"Marqueur d'UCI", wx.DefaultPosition, wx.DefaultSize, 0 )
2269         self.m_staticText12.Wrap( -1 )
2270         fgSizer1.Add( self.m_staticText12, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2271         
2272         ucimark_choicesChoices = ucimark
2273         self.ucimark_choices = wx.Choice( self.m_panel1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, ucimark_choicesChoices, 0 )
2274         self.ucimark_choices.SetSelection( 0 )
2275         fgSizer1.Add( self.ucimark_choices, 0, wx.ALL, 5 )
2276         
2277         self.m_staticText6 = wx.StaticText( self.m_panel1, wx.ID_ANY, u"Utiliser le dictionnaire des expressions", wx.DefaultPosition, wx.DefaultSize, 0 )
2278         self.m_staticText6.Wrap( -1 )
2279         fgSizer1.Add( self.m_staticText6, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2280         
2281         self.check_expressions = wx.CheckBox( self.m_panel1, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
2282         self.check_expressions.SetValue(True) 
2283         fgSizer1.Add( self.check_expressions, 0, wx.ALL, 5 )
2284         
2285         self.m_staticText9 = wx.StaticText( self.m_panel1, wx.ID_ANY, u"Construire des UCE", wx.DefaultPosition, wx.DefaultSize, 0 )
2286         self.m_staticText9.Wrap( -1 )
2287         fgSizer1.Add( self.m_staticText9, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2288         
2289         self.check_makeuce = wx.CheckBox( self.m_panel1, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
2290         self.check_makeuce.SetValue(True) 
2291         fgSizer1.Add( self.check_makeuce, 0, wx.ALL, 5 )
2292         
2293         self.m_staticText10 = wx.StaticText( self.m_panel1, wx.ID_ANY, u"Mode de construction des UCE", wx.DefaultPosition, wx.DefaultSize, 0 )
2294         self.m_staticText10.Wrap( -1 )
2295         fgSizer1.Add( self.m_staticText10, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2296         
2297         uce_modeChoices = ucemethod
2298         self.uce_mode = wx.Choice( self.m_panel1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, uce_modeChoices, 0 )
2299         self.uce_mode.SetSelection( 0 )
2300         fgSizer1.Add( self.uce_mode, 0, wx.ALL, 5 )
2301         
2302         self.m_staticText13 = wx.StaticText( self.m_panel1, wx.ID_ANY, u"Taille des UCE", wx.DefaultPosition, wx.DefaultSize, 0 )
2303         self.m_staticText13.Wrap( -1 )
2304         fgSizer1.Add( self.m_staticText13, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2305         
2306         self.uce_size = wx.SpinCtrl( self.m_panel1, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 1, 1000000, 40 )
2307         fgSizer1.Add( self.uce_size, 0, wx.ALL, 5 )
2308         
2309         
2310         self.m_panel1.SetSizer( fgSizer1 )
2311         self.m_panel1.Layout()
2312         fgSizer1.Fit( self.m_panel1 )
2313         self.m_notebook1.AddPage( self.m_panel1, u"Générale", True )
2314         self.m_panel2 = wx.Panel( self.m_notebook1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
2315         fgSizer3 = wx.FlexGridSizer( 0, 2, 0, 0 )
2316         fgSizer3.SetFlexibleDirection( wx.BOTH )
2317         fgSizer3.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
2318         
2319         self.m_staticText4 = wx.StaticText( self.m_panel2, wx.ID_ANY, u"Passer le corpus en minuscule", wx.DefaultPosition, wx.DefaultSize, 0 )
2320         self.m_staticText4.Wrap( -1 )
2321         fgSizer3.Add( self.m_staticText4, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2322         
2323         self.check_lower = wx.CheckBox( self.m_panel2, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
2324         self.check_lower.SetValue(True) 
2325         fgSizer3.Add( self.check_lower, 0, wx.ALL, 5 )
2326         
2327         self.m_staticText5 = wx.StaticText( self.m_panel2, wx.ID_ANY, u"Retirez les caractères en dehors cette liste", wx.DefaultPosition, wx.DefaultSize, 0 )
2328         self.m_staticText5.Wrap( -1 )
2329         fgSizer3.Add( self.m_staticText5, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2330         
2331         fgSizer4 = wx.FlexGridSizer( 0, 2, 0, 0 )
2332         fgSizer4.SetFlexibleDirection( wx.BOTH )
2333         fgSizer4.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
2334         
2335         self.check_charact = wx.CheckBox( self.m_panel2, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
2336         self.check_charact.SetValue(True) 
2337         fgSizer4.Add( self.check_charact, 0, wx.ALL, 5 )
2338         
2339         self.txt_charact = wx.TextCtrl( self.m_panel2, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
2340         self.txt_charact.SetMinSize( wx.Size( 400,-1 ) )
2341         
2342         fgSizer4.Add( self.txt_charact, 0, wx.ALL|wx.EXPAND, 5 )
2343         
2344         
2345         fgSizer3.Add( fgSizer4, 1, wx.ALIGN_CENTER_VERTICAL|wx.EXPAND, 5 )
2346         
2347         self.m_staticText14 = wx.StaticText( self.m_panel2, wx.ID_ANY, u"Remplacer les apostrophes par des espaces", wx.DefaultPosition, wx.DefaultSize, 0 )
2348         self.m_staticText14.Wrap( -1 )
2349         fgSizer3.Add( self.m_staticText14, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2350         
2351         self.check_apos = wx.CheckBox( self.m_panel2, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
2352         self.check_apos.SetValue(True) 
2353         fgSizer3.Add( self.check_apos, 0, wx.ALL, 5 )
2354         
2355         self.m_staticText15 = wx.StaticText( self.m_panel2, wx.ID_ANY, u"Remplacer les tirets par des espaces", wx.DefaultPosition, wx.DefaultSize, 0 )
2356         self.m_staticText15.Wrap( -1 )
2357         fgSizer3.Add( self.m_staticText15, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2358         
2359         self.check_tirets = wx.CheckBox( self.m_panel2, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
2360         self.check_tirets.SetValue(True) 
2361         fgSizer3.Add( self.check_tirets, 0, wx.ALL, 5 )
2362         
2363         self.m_staticText17 = wx.StaticText( self.m_panel2, wx.ID_ANY, u"Conserver la ponctuation", wx.DefaultPosition, wx.DefaultSize, 0 )
2364         self.m_staticText17.Wrap( -1 )
2365         fgSizer3.Add( self.m_staticText17, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2366         
2367         self.check_ponct = wx.CheckBox( self.m_panel2, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
2368         fgSizer3.Add( self.check_ponct, 0, wx.ALL, 5 )
2369
2370         self.m_staticText16 = wx.StaticText( self.m_panel2, wx.ID_ANY, u"Pas d'espace entre deux formes", wx.DefaultPosition, wx.DefaultSize, 0 )
2371         self.m_staticText16.Wrap( -1 )
2372         fgSizer3.Add( self.m_staticText16, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2373         
2374         self.check_tolist = wx.CheckBox( self.m_panel2, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
2375         fgSizer3.Add( self.check_tolist, 0, wx.ALL, 5 )
2376         
2377         
2378         self.m_panel2.SetSizer( fgSizer3 )
2379         self.m_panel2.Layout()
2380         fgSizer3.Fit( self.m_panel2 )
2381         self.m_notebook1.AddPage( self.m_panel2, u"Nettoyage", False )
2382         
2383         bSizer1.Add( self.m_notebook1, 1, wx.EXPAND |wx.ALL, 5 )
2384         
2385         m_sdbSizer1 = wx.StdDialogButtonSizer()
2386         self.m_sdbSizer1OK = wx.Button( self, wx.ID_OK )
2387         m_sdbSizer1.AddButton( self.m_sdbSizer1OK )
2388         self.m_sdbSizer1Cancel = wx.Button( self, wx.ID_CANCEL )
2389         m_sdbSizer1.AddButton( self.m_sdbSizer1Cancel )
2390         m_sdbSizer1.Realize();
2391         
2392         bSizer1.Add( m_sdbSizer1, 0, wx.EXPAND, 5 )
2393        
2394
2395         self.Bind(wx.EVT_BUTTON, self.OnChangeDir, self.m_button1)
2396         self.setparametres(parametres) 
2397         self.SetSizer( bSizer1 )
2398         self.Layout()
2399         bSizer1.Fit( self )
2400         
2401         self.Centre( wx.BOTH )
2402
2403     def OnChangeDir(self, evt) :
2404         dlg = wx.DirDialog(self.parent, u"Choisissez un répertoire", style = wx.DD_DEFAULT_STYLE)
2405         if dlg.ShowModal() == wx.ID_OK :
2406             self.repout_choices.SetValue(dlg.GetPath())
2407     
2408     def __del__( self ):
2409         pass
2410
2411     def setparametres(self, parametres) :
2412         if  locale.getpreferredencoding().lower() == 'mac-roman' :
2413             enc = self.encodages.index('macroman')
2414         else :
2415             enc = self.encodages.index(locale.getpreferredencoding().lower())
2416         self.encodage_choices.SetSelection(enc)
2417         self.lang_choices.SetSelection(0)
2418         self.repout_choices.SetValue(parametres['pathout'])
2419         self.ucimark_choices.SetSelection(parametres['ucimark'])
2420         self.check_expressions.SetValue(parametres['expressions'])
2421         self.check_makeuce.SetValue(parametres['douce'])
2422         self.uce_mode.SetSelection(parametres['ucemethod'])
2423         self.uce_size.SetValue(parametres['ucesize'])
2424         self.check_lower.SetValue(parametres['lower'])
2425         #self.check_charact.SetValue(parametres['charact'])
2426         self.txt_charact.SetValue(parametres['keep_caract'])
2427         self.check_apos.SetValue(parametres['apos'])
2428         self.check_tirets.SetValue(parametres['tiret'])
2429         self.check_tolist.SetValue(parametres['tolist'])
2430         self.check_ponct.SetValue(parametres['keep_ponct'])
2431
2432     def doparametres(self) :
2433         parametres = {}
2434         parametres['encoding'] = encodages[self.encodage_choices.GetSelection()][0]
2435         parametres['lang'] = self.langues[self.lang_choices.GetSelection()]
2436         parametres['pathout'] = self.repout_choices.GetValue()
2437         parametres['ucimark'] = self.ucimark_choices.GetSelection()
2438         parametres['expressions'] = self.check_expressions.GetValue()
2439         parametres['douce'] =  self.check_makeuce.GetValue()
2440         parametres['ucemethod'] = self.uce_mode.GetSelection()
2441         parametres['ucesize'] = self.uce_size.GetValue()
2442         parametres['lower'] = self.check_lower.GetValue()
2443         parametres['charact'] = self.check_charact.GetValue()
2444         parametres['keep_caract'] = self.txt_charact.GetValue()
2445         parametres['apos'] = self.check_apos.GetValue()
2446         parametres['tiret'] = self.check_tirets.GetValue()
2447         parametres['tolist'] = self.check_tolist.GetValue()
2448         parametres['keep_ponct'] = self.check_ponct.GetValue()
2449         for val in parametres :
2450             if isinstance(parametres[val], bool) :
2451                 if parametres[val] :
2452                     parametres[val] = 1
2453                 else :
2454                     parametres[val] = 0
2455         return parametres
2456
2457 class message(wx.Dialog):
2458     def __init__(self, parent, title, size, save = True):
2459         wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = title, pos = wx.DefaultPosition, size = size, style = wx.DEFAULT_DIALOG_STYLE )
2460         self.save = save    
2461         self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
2462
2463         self.html = ""
2464         self.HtmlPage=wx.html.HtmlWindow(self, -1)
2465         self.HtmlPage.SetMinSize( size )
2466         if "gtk2" in wx.PlatformInfo:
2467             self.HtmlPage.SetStandardFonts()
2468         self.HtmlPage.SetFonts('Courier','Courier')
2469
2470         self.button_1 = wx.Button(self, wx.ID_CANCEL)
2471
2472         self.Bind(wx.EVT_BUTTON, self.OnCloseMe, self.button_1)
2473         if self.save :
2474             self.button_2 = wx.Button(self, wx.ID_SAVE)
2475             self.Bind(wx.EVT_BUTTON, self.OnSavePage, self.button_2)
2476         self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)
2477         self.__do_layout()
2478
2479     def __do_layout(self):
2480         sizer_2 = wx.BoxSizer(wx.VERTICAL)
2481         sizer_2.Add(self.HtmlPage, 0, wx.EXPAND|wx.ADJUST_MINSIZE, 0)
2482         m_sdbSizer1 = wx.StdDialogButtonSizer()
2483         m_sdbSizer1.AddButton(  self.button_1 )
2484         if self.save :
2485             m_sdbSizer1.AddButton(  self.button_2 )
2486         m_sdbSizer1.Realize()
2487         sizer_2.Add(m_sdbSizer1, 1, wx.EXPAND, 5)
2488         self.SetSizer(sizer_2)
2489         self.Layout()
2490         sizer_2.Fit( self )
2491
2492     def OnSavePage(self, evt) :
2493         dlg = wx.FileDialog(
2494             self, message="Enregistrer sous...", defaultDir=os.getcwd(),
2495             defaultFile="concordancier.html", wildcard="html|*.html", style=wx.SAVE | wx.OVERWRITE_PROMPT
2496             )
2497         dlg.SetFilterIndex(2)
2498         dlg.CenterOnParent()
2499         if dlg.ShowModal() == wx.ID_OK:
2500             path = dlg.GetPath()
2501             with open(path, 'w') as f :
2502                 f.write(self.html)
2503
2504     def OnCloseMe(self, event):
2505         self.Close(True)
2506
2507     def OnCloseWindow(self, event):
2508         self.Destroy()
2509
2510 class ExtractDialog ( wx.Dialog ):
2511     
2512     def __init__( self, parent, option ):
2513         wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = wx.EmptyString, pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.DEFAULT_DIALOG_STYLE )
2514
2515         self.option = option
2516         
2517         self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
2518         
2519         fgSizer1 = wx.FlexGridSizer( 0, 2, 0, 0 )
2520         fgSizer1.SetFlexibleDirection( wx.BOTH )
2521         fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
2522         
2523         self.m_staticText1 = wx.StaticText( self, wx.ID_ANY, u"Corpus", wx.DefaultPosition, wx.DefaultSize, 0 )
2524         self.m_staticText1.Wrap( -1 )
2525         fgSizer1.Add( self.m_staticText1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2526         
2527         self.corpusfile = wx.FilePickerCtrl( self, wx.ID_ANY, wx.EmptyString, u"Select a file", u"*.txt", wx.DefaultPosition, wx.Size( -1,-1 ), wx.FLP_DEFAULT_STYLE|wx.FLP_FILE_MUST_EXIST|wx.FLP_OPEN )
2528         self.corpusfile.SetMinSize( wx.Size( 500,-1 ) )
2529         
2530         fgSizer1.Add( self.corpusfile, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL|wx.EXPAND, 5 )
2531         
2532         self.m_staticText2 = wx.StaticText( self, wx.ID_ANY, u"Encodage", wx.DefaultPosition, wx.DefaultSize, 0 )
2533         self.m_staticText2.Wrap( -1 )
2534         fgSizer1.Add( self.m_staticText2, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2535         
2536         encodageChoices = [' - '.join(encodage) for encodage in encodages]
2537         self.encodage = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, encodageChoices, 0 )
2538         self.encodage.SetSelection( 0 )
2539         self.encodage.SetMinSize( wx.Size( 200,-1 ) )
2540         
2541         fgSizer1.Add( self.encodage, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL|wx.EXPAND, 5 )
2542         
2543         if option == 'splitvar' :
2544             self.m_staticText3 = wx.StaticText( self, wx.ID_ANY, u"Variable (avec * mais sans le _ )", wx.DefaultPosition, wx.DefaultSize, 0 )
2545             self.m_staticText3.Wrap( -1 )
2546             fgSizer1.Add( self.m_staticText3, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2547             
2548             self.txtvar = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
2549             self.txtvar.SetMinSize( wx.Size( 200,-1 ) )
2550             
2551             fgSizer1.Add( self.txtvar, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL|wx.EXPAND, 5 )
2552         
2553         if option == 'mods' :
2554             self.m_staticText4 = wx.StaticText( self, wx.ID_ANY, u"Modalités (une par ligne, avec * )", wx.DefaultPosition, wx.DefaultSize, 0 )
2555             self.m_staticText4.Wrap( -1 )
2556             fgSizer1.Add( self.m_staticText4, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2557             
2558             self.txtmods = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.TE_MULTILINE )
2559             self.txtmods.SetMinSize( wx.Size( 200,150 ) )
2560             
2561             fgSizer1.Add( self.txtmods, 0, wx.ALL|wx.EXPAND, 5 )
2562             
2563             self.m_staticText5 = wx.StaticText( self, wx.ID_ANY, u"Format de l'extraction", wx.DefaultPosition, wx.DefaultSize, 0 )
2564             self.m_staticText5.Wrap( -1 )
2565             fgSizer1.Add( self.m_staticText5, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2566             
2567             extractformatChoices = [ u"Un seul fichier", u"Un fichier par modalité" ]
2568             self.extractformat = wx.RadioBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, extractformatChoices, 1, wx.RA_SPECIFY_COLS )
2569             self.extractformat.SetSelection( 0 )
2570             fgSizer1.Add( self.extractformat, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2571             
2572         
2573         fgSizer1.AddSpacer( ( 0, 0), 1, wx.EXPAND, 5 )
2574         
2575         m_sdbSizer1 = wx.StdDialogButtonSizer()
2576         self.m_sdbSizer1OK = wx.Button( self, wx.ID_OK )
2577         m_sdbSizer1.AddButton( self.m_sdbSizer1OK )
2578         self.m_sdbSizer1Cancel = wx.Button( self, wx.ID_CANCEL )
2579         m_sdbSizer1.AddButton( self.m_sdbSizer1Cancel )
2580         m_sdbSizer1.Realize();
2581         
2582         fgSizer1.Add( m_sdbSizer1, 1, wx.EXPAND, 5 )
2583         
2584         
2585         self.SetSizer( fgSizer1 )
2586         self.Layout()
2587         fgSizer1.Fit( self )
2588         
2589         self.Centre( wx.BOTH )
2590
2591     def make_param(self) :
2592         parametres = {}
2593         le = [enc[0].lower() for enc in encodages]
2594         parametres['filein'] = self.corpusfile.GetPath()
2595         encodage = le[self.encodage.GetSelection()]
2596         parametres['encodein'] = encodage
2597         if self.option == 'splitvar' :
2598             parametres['var'] = self.txtvar.GetValue()
2599         if self.option == 'mods' :
2600             parametres['mods'] = self.txtmods.GetValue().splitlines()
2601             if self.extractformat.GetSelection() == 0 :
2602                 parametres['onefile'] = True
2603             else :
2604                 parametres['onefile'] = False
2605         parametres['encodeout'] = locale.getpreferredencoding()
2606         print parametres
2607         return parametres
2608     
2609     def __del__( self ):
2610         pass
2611
2612 class FreqDialog(wx.Dialog):
2613     def __init__(self, parent, ID, listcol, title, size) :
2614         wx.Dialog.__init__(self, parent, ID, title, size=size, pos=wx.DefaultPosition,style=wx.DEFAULT_DIALOG_STYLE | wx.CANCEL | wx.OK )
2615         pre = wx.PreDialog()
2616         pre.SetExtraStyle(wx.DIALOG_EX_CONTEXTHELP)
2617         pre.Create(parent, ID, title, wx.DefaultPosition, size, wx.DEFAULT_DIALOG_STYLE | wx.CANCEL | wx.OK)
2618         self.PostCreate(pre)
2619         self.parent = parent 
2620         sizer = wx.BoxSizer(wx.VERTICAL)
2621         #self.content = parent.content
2622         self.header = listcol
2623         #LABELLIST = []
2624         #for i in self.header:
2625         #    forme = i
2626         #    if len(forme) > 60 :
2627         #        LABELLIST.append(i[0:60])
2628         #    else:
2629         #        LABELLIST.append(i)
2630         self.list_box_1 = wx.ListBox(self, -1, choices=self.header, style=wx.LB_EXTENDED | wx.LB_HSCROLL)
2631         sizer.Add(self.list_box_1, 0, 5)
2632         
2633         btnsizer = wx.BoxSizer(wx.HORIZONTAL)
2634         
2635         btn = wx.Button(self, wx.ID_CANCEL)
2636         btn.SetHelpText("Annuler")
2637         btnsizer.Add(btn)
2638         
2639         btn = wx.Button(self, wx.ID_OK)
2640         btn.SetHelpText("Valider")
2641         btn.SetDefault()
2642         btnsizer.Add(btn)
2643         
2644         sizer.Add(btnsizer, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_CENTER_HORIZONTAL, 5)
2645         self.SetSizer(sizer)
2646         sizer.Fit(self)
2647         self.SetTitle(u"Sélection")
2648   
2649         # end wxGlade
2650