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