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