3805c465fac618c8280f3eaba6f20b9c557c3beb
[iramuteq] / dialog.py
1 #!/bin/env python
2 # -*- coding: utf-8 -*-
3 #Author: Pierre Ratinaud
4 #Copyright (c) 2008-2009 Pierre Ratinaud
5 #License: 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 from functions import DoConf
12 import os
13 import sys
14 from KeyFrame import AlcOptFrame
15 #---------------------------------------------------------------------------
16 provider = wx.SimpleHelpProvider()
17 wx.HelpProvider_Set(provider)
18
19 #---------------------------------------------------------------------------
20
21
22 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']]
23
24 class FileOptionDialog(wx.Dialog):
25     def __init__(
26             self, parent, ID, title, sep=False, sheet = False, size=wx.DefaultSize, pos=wx.DefaultPosition,
27             style=wx.DEFAULT_DIALOG_STYLE
28             ):
29
30         pre = wx.PreDialog()
31         pre.SetExtraStyle(wx.DIALOG_EX_CONTEXTHELP)
32         pre.Create(parent, ID, title, pos, size, style)
33
34         self.PostCreate(pre)
35
36         sizer = wx.BoxSizer(wx.VERTICAL)
37         grid_sizer = wx.FlexGridSizer(0, 2, 2, 2)
38 ##############################
39
40         label = wx.StaticText(self, -1, _(u"First line is header").decode('utf8'))
41         label.SetHelpText(_(u"First line is header").decode('utf8'))
42         grid_sizer.Add(label, 0, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
43         on = [ _(u"yes").decode('utf8'), _(u"no").decode('utf8') ]
44         self.radio_box_1 = wx.RadioBox(self, -1, u"", choices=on, majorDimension=0, style=wx.RA_SPECIFY_ROWS)
45         self.radio_box_1.SetHelpText(_(u"First line is header").decode('utf8'))
46         grid_sizer.Add(self.radio_box_1, 1, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
47
48 ##############################
49
50         label = wx.StaticText(self, -1, _(u"First column is an id").decode('utf8'))
51         label.SetHelpText(_(u"First column is an id").decode('utf8'))
52         grid_sizer.Add(label, 0, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
53         on = [ _(u"yes").decode('utf8'), _(u"no").decode('utf8') ]
54         self.radio_box_2 = wx.RadioBox(self, -1, u"", choices=on, majorDimension=0, style=wx.RA_SPECIFY_ROWS)
55         self.radio_box_2.SetHelpText(_(u"First column is an id").decode('utf8'))
56         grid_sizer.Add(self.radio_box_2, 1, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
57
58 ##############################
59         if sep:
60             label = wx.StaticText(self, -1, _(u"Column separator").decode('utf8'))
61             label.SetHelpText(_(u"Column separator").decode('utf8'))
62             grid_sizer.Add(label, 0, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
63             self.colsep = [";", "tabulation", ","]
64             self.choice3 = wx.Choice(self, -1, (100, 50), choices=self.colsep)
65             self.choice3.SetHelpText(_(u"Column separator").decode('utf8'))
66             grid_sizer.Add(self.choice3, 1, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
67     
68     ##############################
69     
70             label = wx.StaticText(self, -1, _(u"Text separator").decode('utf8'))
71             label.SetHelpText(_(u"Text separator").decode('utf8'))
72             grid_sizer.Add(label, 0, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
73             self.txtsep = ["\"", "'"]
74             self.choice4 = wx.Choice(self, -1, (100, 50), choices=self.txtsep)
75             self.choice4.SetHelpText(_(u"Text separator").decode('utf8'))
76             grid_sizer.Add(self.choice4, 1, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
77             self.choice3.SetSelection(0)
78             self.choice4.SetSelection(0)
79             self.text = wx.StaticText(self, -1, _(u"Character set").decode('utf8'))
80             grid_sizer.Add(self.text, 1, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
81             self.le = [enc[0].lower() for enc in encodages] 
82             self.list_encodages = wx.Choice(self, -1, (25, 30), choices=[' - '.join(encodage) for encodage in encodages])
83             if locale.getpreferredencoding().lower() == 'mac-roman' :
84                 enc = self.le.index('macroman')
85             else :
86                 try :
87                     enc = self.le.index(sys.getdefaultencoding().lower())
88                 except ValueError:
89                     enc = self.le.index('utf-8')
90             self.list_encodages.SetSelection(enc)
91             grid_sizer.Add(self.list_encodages, 1, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
92         elif sheet :
93             label = wx.StaticText(self, -1, u"Feuille ")
94             grid_sizer.Add(label, 0, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
95             self.spin1 = wx.SpinCtrl(self, -1, '',size = (100,30), min=1, max=500)
96             grid_sizer.Add(self.spin1, 1, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
97         
98         sizer.Add(grid_sizer, 0, wx.GROW | wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5)
99
100
101         line = wx.StaticLine(self, -1, size=(20, -1), style=wx.LI_HORIZONTAL)
102         sizer.Add(line, 0, wx.GROW | wx.ALIGN_CENTER_VERTICAL | wx.RIGHT | wx.TOP, 5)
103
104         btnsizer = wx.StdDialogButtonSizer()
105         
106         if wx.Platform != "__WXMSW__":
107             btn = wx.ContextHelpButton(self)
108             btnsizer.AddButton(btn)
109         
110         btn = wx.Button(self, wx.ID_OK)
111         btn.SetDefault()
112         btnsizer.AddButton(btn)
113
114         btn = wx.Button(self, wx.ID_CANCEL)
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         self.list_box_1 = wx.ListBox(self, -1, choices=LIST_CLASSE_OK, style=wx.LB_SINGLE | wx.LB_HSCROLL)
156         self.list_box_1.SetHelpText("Here's some help text for field #1")
157         box.Add(self.list_box_1, 1, wx.ALIGN_CENTRE | wx.ALL, 5)
158
159         sizer.Add(box, 0, wx.GROW | wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5)
160
161
162 ###############################
163         line = wx.StaticLine(self, -1, size=(20, -1), style=wx.LI_HORIZONTAL)
164         sizer.Add(line, 0, wx.GROW | wx.ALIGN_CENTER_VERTICAL | wx.RIGHT | wx.TOP, 5)
165
166         btnsizer = wx.StdDialogButtonSizer()
167         
168         if wx.Platform != "__WXMSW__":
169             btn = wx.ContextHelpButton(self)
170             btnsizer.AddButton(btn)
171         
172         btn = wx.Button(self, wx.ID_OK)
173         btn.SetDefault()
174         btnsizer.AddButton(btn)
175
176         btn = wx.Button(self, wx.ID_CANCEL)
177         btnsizer.AddButton(btn)
178         btnsizer.Realize()
179
180         sizer.Add(btnsizer, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5)
181
182         self.SetSizer(sizer)
183         sizer.Fit(self)
184
185 class CHDDialog(wx.Dialog):
186     def __init__(
187             self, parent, ID, title, size=wx.DefaultSize, pos=wx.DefaultPosition,
188             style=wx.DEFAULT_DIALOG_STYLE | wx.CANCEL
189             ):
190         pre = wx.PreDialog()
191         pre.SetExtraStyle(wx.DIALOG_EX_CONTEXTHELP)
192         pre.Create(parent, ID, title, pos, size, style)
193
194         self.PostCreate(pre)
195        
196         self.colsep = parent.colsep
197         self.Box = 1
198         self.content = parent.content[:]
199         self.header = parent.header[:]
200         LABELLIST = []
201         for i in self.header:
202             if len(i) > 60 :
203                 LABELLIST.append(i[0:60])
204             else:
205                 LABELLIST.append(i)
206         self.LABELLISTTOT = LABELLIST
207         self.LISTVARSUP = []
208 #----------------------------------------------------------------------------------------------------
209         self.text1 = wx.StaticText(self, -1, u"Variables Actives (au moins 3)")
210         self.text2 = wx.StaticText(self, -1, u"Variables Supplémentaires (au moins 1)")
211         self.list_box_1 = wx.ListBox(self, -1, choices=LABELLIST, style=wx.LB_EXTENDED | wx.LB_HSCROLL)
212         self.list_box_2 = wx.ListBox(self, -1, choices=LABELLIST, style=wx.LB_EXTENDED | wx.LB_HSCROLL)
213         self.button_cancel = wx.Button(self, wx.ID_CANCEL)
214         self.button_back = wx.Button(self, wx.ID_BACKWARD)
215         self.button_forw = wx.Button(self, wx.ID_FORWARD)
216         self.button_ok = wx.Button(self, wx.ID_OK)
217         self.button_pref = wx.Button(self, wx.ID_PROPERTIES)
218         self.button_selectall = wx.Button(self, wx.NewId(), u"Sélectionner tout")
219         self.__set_properties()
220         self.__do_layout()
221
222         self.Bind(wx.EVT_BUTTON, self.OnPrec, self.button_back)
223         self.Bind(wx.EVT_BUTTON, self.OnSuivant, self.button_forw)
224         self.Bind(wx.EVT_BUTTON, self.OnValider, self.button_ok)
225         self.Bind(wx.EVT_BUTTON, self.OnSelectAll, self.button_selectall)
226         # end wxGlade
227         self.parent = parent
228         self.TEMPDIR = parent.TEMPDIR
229         self.num = 0
230
231     def __set_properties(self):
232         # begin wxGlade: ConfChi2.__set_properties
233         self.SetTitle(u"Sélection des variables")
234         self.list_box_2.Enable(False)
235         self.button_ok.Enable(False)        
236         self.button_back.Enable(False)
237         # end wxGlade
238
239     def __do_layout(self):
240         # begin wxGlade: ConfChi2.__do_layout
241         sizer_1 = wx.BoxSizer(wx.VERTICAL)
242         sizer_2 = wx.BoxSizer(wx.VERTICAL)
243         sizer_3 = wx.BoxSizer(wx.HORIZONTAL)
244         sizer_4 = wx.BoxSizer(wx.HORIZONTAL)
245         sizer_5 = wx.BoxSizer(wx.HORIZONTAL)
246         sizer_6 = wx.BoxSizer(wx.HORIZONTAL)
247         sizer_7 = wx.BoxSizer(wx.HORIZONTAL)
248         sizer_5.Add(self.text1, 1, wx.CENTER | wx.ALL, 0)
249         sizer_5.Add(self.text2, 1, wx.CENTER | wx.ALL, 0)
250         sizer_3.Add(self.list_box_1, 0, wx.EXPAND, 0)
251         sizer_3.Add(self.list_box_2, 0, wx.EXPAND, 0)
252         sizer_6.Add(self.button_selectall, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL, 0) 
253         sizer_7.Add(self.button_cancel, 0, wx.ALL, 0)
254         sizer_7.Add(self.button_pref, 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
255         sizer_7.Add(self.button_ok, 0, wx.wx.ALIGN_CENTER_HORIZONTAL, 0)
256         sizer_4.Add(self.button_back, 0, wx.ALL, 0)
257         sizer_4.Add(self.button_forw, 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
258         sizer_2.Add(sizer_5, 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
259         sizer_2.Add(sizer_3, 1, wx.EXPAND, 0)
260         sizer_2.Add(sizer_6, 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
261         sizer_2.Add(sizer_4, 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
262         sizer_2.Add(sizer_7, 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
263         sizer_1.Add(sizer_2, 1, wx.EXPAND, 4)
264         self.SetSizer(sizer_1)
265         sizer_1.Fit(self)
266         self.Layout()
267         # end wxGlade
268 #--------------FIXME-----------------------
269 #NETTOYAGE des variables inutiles
270     def OnSuivant(self, event): 
271         LISTACTIVE = self.list_box_1.GetSelections()
272         if len(LISTACTIVE) != len(self.LABELLISTTOT) and len(LISTACTIVE) >= 3: 
273             self.button_ok.Enable(True)
274         self.Box = 2
275         self.LISTHEADERINDICE = []
276         self.LISTNUMACTIVE = []
277         COMPT = 0
278         header = self.header[:]
279         for i in range(0, len(header)):
280             self.LISTHEADERINDICE.append(i)
281         for i in LISTACTIVE :
282             self.LISTNUMACTIVE.append(i)
283             header.pop(i - COMPT)
284             self.LISTHEADERINDICE.pop(i - COMPT)
285             COMPT += 1
286         self.LABELLIST = []
287         for i in header:
288             if len(i) > 60 :
289                 self.LABELLIST.append(i[0:60])
290             else:
291                 self.LABELLIST.append(i)
292         self.list_box_2.Clear()
293         for i in self.LABELLIST :
294             self.list_box_2.Append(i)
295                     
296         self.list_box_1.Enable(False)    
297         self.list_box_2.Enable(True)
298         self.button_forw.Enable(False)
299         self.button_back.Enable(True)
300
301     def OnValider(self, event):
302         LISTVARSUPSEL = self.list_box_2.GetSelections()
303         for i in LISTVARSUPSEL :
304             self.LISTVARSUP.append(self.LISTHEADERINDICE[i])
305         event.Skip()
306
307     def OnPrec(self, event):
308         self.list_box_1.Enable(True)
309         self.list_box_2.Enable(False)
310         self.button_forw.Enable(True)
311         self.button_back.Enable(False)   
312         self.button_ok.Enable(False)
313         self.Box = 1
314         event.Skip()
315
316     def OnSelectAll(self, event):
317         if self.Box == 1:
318             for i in range(len(self.LABELLISTTOT)):
319                 self.list_box_1.Select(i)
320         else:
321             for i in range(len(self.LABELLIST)):
322                 self.list_box_2.Select(i)
323
324 class PrefDialog ( wx.Dialog ):
325     
326     def __init__( self, parent ):
327         wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = _(u"Settings").decode('utf8'), pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.DEFAULT_DIALOG_STYLE )
328         self.parent = parent
329         
330         self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
331         
332         bSizer1 = wx.BoxSizer( wx.VERTICAL )
333         
334         fgSizer1 = wx.FlexGridSizer( 0, 3, 0, 0 )
335         fgSizer1.SetFlexibleDirection( wx.BOTH )
336         fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
337         
338         self.m_staticText1 = wx.StaticText( self, wx.ID_ANY, _(u"Play a sound at the end of analysis").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
339         self.m_staticText1.Wrap( -1 )
340         fgSizer1.Add( self.m_staticText1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
341         
342         self.m_staticText2 = wx.StaticText( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
343         self.m_staticText2.Wrap( -1 )
344         fgSizer1.Add( self.m_staticText2, 0, wx.ALL, 5 )
345         
346         m_radioBox1Choices = [ _(u"yes").decode('utf8'), _(u"no").decode('utf8') ]
347         self.m_radioBox1 = wx.RadioBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, m_radioBox1Choices, 1, wx.RA_SPECIFY_COLS )
348         self.m_radioBox1.SetSelection( 0 )
349         fgSizer1.Add( self.m_radioBox1, 0, wx.ALIGN_RIGHT|wx.ALL, 5 )
350
351         msg = _(u"""Check for new 
352 releases at startup""").decode('utf8')
353         self.m_staticText3 = wx.StaticText( self, wx.ID_ANY, msg, wx.DefaultPosition, wx.DefaultSize, 0 )
354         self.m_staticText3.Wrap( -1 )
355         fgSizer1.Add( self.m_staticText3, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
356         
357         self.m_staticText4 = wx.StaticText( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
358         self.m_staticText4.Wrap( -1 )
359         fgSizer1.Add( self.m_staticText4, 0, wx.ALL, 5 )
360         
361         m_radioBox2Choices = [ _(u"yes").decode('utf8'), _(u"no").decode('utf8') ]
362         self.m_radioBox2 = wx.RadioBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, m_radioBox2Choices, 1, wx.RA_SPECIFY_COLS )
363         self.m_radioBox2.SetSelection( 0 )
364         fgSizer1.Add( self.m_radioBox2, 0, wx.ALIGN_RIGHT|wx.ALL, 5 )
365
366         msg = _(u"Interface language").decode('utf8')
367         self.m_staticText45 = wx.StaticText( self, wx.ID_ANY, msg, wx.DefaultPosition, wx.DefaultSize, 0 )
368         self.m_staticText45.Wrap( -1 )
369         fgSizer1.Add( self.m_staticText45, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
370         
371         self.m_staticText46 = wx.StaticText( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
372         self.m_staticText46.Wrap( -1 )
373         fgSizer1.Add( self.m_staticText46, 0, wx.ALL, 5 )
374         
375         self.listlangues = [ u"french", u"english", u"spanish", u"portuguese", u"italian" ]
376         self.langues = wx.Choice( self, wx.ID_ANY, (200, -1), choices = self.listlangues)
377         #self.langues.SetSelection( 0 )
378         fgSizer1.Add( self.langues, 0, wx.ALIGN_RIGHT|wx.ALL, 5 )
379         
380         msg = _(u"""Check installation 
381 of R packages""").decode('utf8')
382         self.m_staticText5 = wx.StaticText( self, wx.ID_ANY, msg, wx.DefaultPosition, wx.DefaultSize, 0 )
383         self.m_staticText5.Wrap( -1 )
384         fgSizer1.Add( self.m_staticText5, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
385         
386         self.m_staticText6 = wx.StaticText( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
387         self.m_staticText6.Wrap( -1 )
388         fgSizer1.Add( self.m_staticText6, 0, wx.ALL, 5 )
389         
390         self.m_button1 = wx.Button( self, wx.ID_ANY, _(u"Check").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
391         fgSizer1.Add( self.m_button1, 0, wx.ALIGN_RIGHT|wx.ALL, 5 )
392         
393         bSizer1.Add( fgSizer1, 1, wx.EXPAND, 5 )
394         if sys.platform == 'win32' :
395             bSizer2 = wx.BoxSizer( wx.HORIZONTAL )
396             
397             msg = _(u"""Maximum 
398 memory for R""").decode('utf8')
399             self.m_staticText7 = wx.StaticText( self, wx.ID_ANY, msg, wx.DefaultPosition, wx.DefaultSize, 0 )
400             self.m_staticText7.Wrap( -1 )
401             bSizer2.Add( self.m_staticText7, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
402             
403             self.m_checkBox1 = wx.CheckBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
404             bSizer2.Add( self.m_checkBox1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
405             
406             self.m_spinCtrl1 = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 32, 16000, 1535 )
407             bSizer2.Add( self.m_spinCtrl1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
408             
409             self.m_staticline7 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
410             bSizer2.Add( self.m_staticline7, 0, wx.EXPAND |wx.ALL, 5 )
411             
412             bSizer1.Add( bSizer2, 0, wx.EXPAND, 5 )
413             self.m_checkBox1.Bind( wx.EVT_CHECKBOX, self.oncheckmem )
414
415         bSizer3 = wx.BoxSizer( wx.HORIZONTAL )
416         bSizer4 = wx.BoxSizer( wx.HORIZONTAL )
417         self.text8 = wx.StaticText( self, wx.ID_ANY, _(u"Use svdlibc").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
418         self.text8.Wrap( -1 )
419         fgSizer1.Add( self.text8, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
420         self.check_svdc = wx.CheckBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
421         bSizer4.Add( self.check_svdc, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
422         bSizer3.Add( bSizer4, 0, wx.EXPAND, 5 )
423         self.fbb = filebrowse.FileBrowseButton(self, -1, size=(250, -1), fileMode = 2, fileMask = '*')
424         bSizer3.Add( self.fbb, 0, wx.EXPAND, 5 )
425         self.fbb.SetLabel(_(u"Path : ").decode('utf8'))
426         fgSizer1.Add( wx.StaticText(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 ),  wx.ID_ANY, wx.ALL, 5)
427         fgSizer1.Add( bSizer3, 0,  wx.ALIGN_RIGHT|wx.ALL, 5 )
428
429         Rpath_text =  wx.StaticText( self, wx.ID_ANY, _(u"R path").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
430         Rpath_text.Wrap( -1 )
431         fgSizer1.Add( Rpath_text, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
432         fgSizer1.Add( wx.StaticText(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 ),  wx.ID_ANY, wx.ALL, 5)
433         self.Rpath_value = filebrowse.FileBrowseButton(self, -1, size=(350, -1), fileMode = 2, fileMask = '*')
434         self.Rpath_value.SetLabel(_(u"Path : ").decode('utf8'))
435         fgSizer1.Add( self.Rpath_value, 0, wx.ALIGN_RIGHT|wx.ALL, 5 )
436
437         mirror_text =  wx.StaticText( self, wx.ID_ANY, _(u"Default R mirror").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
438         mirror_text.Wrap( -1 )
439         fgSizer1.Add( mirror_text, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
440         fgSizer1.Add( wx.StaticText(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 ),  wx.ID_ANY, wx.ALL, 5)
441         self.mirror_value = wx.TextCtrl( self, wx.ID_ANY, u'http://cran.univ-lyon1.fr', wx.DefaultPosition, wx.Size( 300,30 ), 0 ) 
442         fgSizer1.Add( self.mirror_value, 0, wx.ALIGN_RIGHT|wx.ALL, 5 )
443
444
445         m_sdbSizer1 = wx.StdDialogButtonSizer()
446         self.m_sdbSizer1OK = wx.Button( self, wx.ID_OK )
447         m_sdbSizer1.AddButton( self.m_sdbSizer1OK )
448         self.m_sdbSizer1Cancel = wx.Button( self, wx.ID_CANCEL )
449         m_sdbSizer1.AddButton( self.m_sdbSizer1Cancel )
450         m_sdbSizer1.Realize()
451         bSizer1.Add( m_sdbSizer1, 0, wx.EXPAND, 5 )
452         
453         self.SetSizer( bSizer1 )
454         self.Layout()
455         bSizer1.Fit( self )
456         
457         self.Centre( wx.BOTH )
458         
459         # Connect Events
460         self.m_sdbSizer1OK.Bind( wx.EVT_BUTTON, self.OnValid )
461         self.m_button1.Bind( wx.EVT_BUTTON, parent.OnVerif )
462         self.check_svdc.Bind( wx.EVT_CHECKBOX, self.OnSVDC )
463         self.__set_properties()
464
465     def __set_properties(self):
466         self.SetTitle(_(u"Settings").decode('utf8'))
467         if self.parent.pref.getboolean('iramuteq', 'sound'): val1 = 0
468         else : val1 = 1
469         self.m_radioBox1.SetSelection(val1)
470         if self.parent.pref.getboolean('iramuteq', 'checkupdate') : val2 = 0
471         else : val2 = 1
472         self.m_radioBox2.SetSelection(val2)
473         self.langues.SetSelection(self.listlangues.index(self.parent.pref.get('iramuteq', 'guilanguage')))
474         if sys.platform == 'win32' :
475             if self.parent.pref.getboolean('iramuteq', 'R_mem') :
476                 self.m_checkBox1.SetValue(True)
477                 self.m_spinCtrl1.Enable(True)
478                 self.m_spinCtrl1.SetValue(self.parent.pref.getint('iramuteq', 'R_max_mem'))
479             else :
480                 self.m_checkBox1.SetValue(False)
481                 self.m_spinCtrl1.Enable(False)
482         if self.parent.pref.getboolean('iramuteq', 'libsvdc') : 
483             self.check_svdc.SetValue(True)
484             self.fbb.SetValue(self.parent.pref.get('iramuteq', 'libsvdc_path'))
485         else :
486             self.check_svdc.SetValue(False)
487             self.fbb.SetValue(self.parent.pref.get('iramuteq', 'libsvdc_path'))
488             self.fbb.Enable(False)
489         self.Rpath_value.SetValue(self.parent.PathPath.get('PATHS', 'rpath'))
490         self.mirror_value.SetValue(self.parent.pref.get('iramuteq', 'rmirror'))
491         
492     def oncheckmem(self, evt):
493         if self.m_checkBox1.GetValue() :
494             self.m_spinCtrl1.Enable(True)
495         else :
496             self.m_spinCtrl1.Enable(False)
497
498     def OnSVDC(self, evt):
499         if self.check_svdc.GetValue() :
500             self.fbb.Enable(True)
501         else :
502             self.fbb.Enable(False)
503
504     def OnValid(self, event):
505         parent = self.parent
506         if self.m_radioBox1.GetSelection() == 0 : valsound = 'true'
507         else :  valsound = 'false'
508         parent.pref.set('iramuteq', 'sound', valsound)
509         if self.m_radioBox2.GetSelection() == 0 : valcheck = 'true'
510         else :  valcheck = 'false'
511         parent.pref.set('iramuteq', 'checkupdate', valcheck)
512         parent.pref.set('iramuteq', 'guilanguage', self.listlangues[self.langues.GetSelection()])
513         if sys.platform == 'win32' :
514             if self.m_checkBox1.GetValue() :
515                 parent.pref.set('iramuteq', 'R_mem', 'true')
516                 parent.pref.set('iramuteq', 'R_max_mem', str(self.m_spinCtrl1.GetValue()))
517             else :
518                 parent.pref.set('iramuteq', 'R_mem', 'false')
519         if self.check_svdc.GetValue() :
520             parent.pref.set('iramuteq', 'libsvdc', 'true')
521         else :
522             parent.pref.set('iramuteq', 'libsvdc', 'false')
523         parent.pref.set('iramuteq', 'libsvdc_path', self.fbb.GetValue())
524         self.parent.pref.set('iramuteq', 'rmirror', self.mirror_value.GetValue())
525         file = open(parent.ConfigPath['preferences'], 'w')
526         parent.pref.write(file)
527         file.close()
528         self.parent.PathPath.set('PATHS', 'rpath', self.Rpath_value.GetValue())
529         with open(self.parent.ConfigPath['path'], 'w') as f:
530             self.parent.PathPath.write(f)
531         self.Close()
532
533 class PrefGraph(wx.Dialog):
534     def __init__(self, parent, ID, paramgraph, title = '', size=wx.DefaultSize, pos=wx.DefaultPosition, style=wx.DEFAULT_DIALOG_STYLE):
535         pre = wx.PreDialog()
536         pre.SetExtraStyle(wx.DIALOG_EX_CONTEXTHELP)
537         pre.Create(parent, ID, title, pos, size, style)
538         self.PostCreate(pre)
539         self.parent = parent
540         self.paramgraph=paramgraph
541         self.labeltype = wx.StaticText(self, -1, _(u"Graphic type").decode('utf8'))
542         if self.paramgraph['clnb'] <= 3 :
543             choix = [u'2D', 'web 2D']
544         else :
545             choix=[u'2D' ,u'3D', 'web 2D', 'web 3D']
546         self.choicetype = wx.Choice(self, -1, (100,50), choices=choix)
547         self.label_format = wx.StaticText(self, -1, _(u"Picture format").decode('utf8'))
548         self.choix_format =  wx.Choice(self, -1, (100,50), choices = ['png', 'svg'])        
549         self.label_1 = wx.StaticText(self, -1, _(u"width").decode('utf8'))
550         self.spin1 = wx.SpinCtrl(self, -1, '',size = (100,30), min=100, max=5000)
551         self.label_2 = wx.StaticText(self, -1, _(u"height").decode('utf8'))
552         self.spin2 = wx.SpinCtrl(self, -1, '', size = (100,30), min=100, max=5000)
553         self.label_what = wx.StaticText(self, -1, _(u"Representation").decode('utf8'))
554         self.choice1 = wx.Choice(self, -1, (100,50), choices=[_(u"coordinates").decode('utf8'),_(u"correlations").decode('utf8')])
555         self.label_qui = wx.StaticText(self, -1, u'Variables')
556         self.choice2 = wx.Choice(self, -1, (100,50), choices=[_(u"actives").decode('utf8') ,_(u"supplementaries").decode('utf8'), _(u"stars").decode('utf8'), _(u"clusters").decode('utf8')])
557         self.label_3 = wx.StaticText(self, -1, _(u"Text size").decode('utf8'))
558         self.spin3 = wx.SpinCtrl(self, -1, '', size = (100,30), min=1, max=20)
559         txt = _(u"Take the x first points").decode('utf8')
560         self.label_4 = wx.StaticText(self, -1, txt)
561         self.check1 = wx.CheckBox(self, -1)
562         self.spin_nb = wx.SpinCtrl(self, -1, '', size = (100,30), min=2, max=1000)
563         txt = _(u"Take the x first points by cluster").decode('utf8')
564         self.label_chic = wx.StaticText(self, -1, txt)
565         self.check_chic = wx.CheckBox(self, -1)
566         self.spin_nbchic = wx.SpinCtrl(self, -1, '', size = (100,30), min=2, max=1000)        
567         txt = _(u"Limit points by cluster chi2").decode('utf8')
568         self.label_5 = wx.StaticText(self, -1, txt)
569         self.check2 = wx.CheckBox(self, -1)
570         self.spin_chi = wx.SpinCtrl(self, -1, '',size = (100,30),  min=2, max=1000)
571         self.label_6 = wx.StaticText(self, -1, _(u"Avoid overlay").decode('utf8'))
572         self.check3 = wx.CheckBox(self, -1)
573         txt = _(u"Text size proportional to frequency").decode('utf8')
574         self.label_7 = wx.StaticText(self, -1, txt)
575         self.check4 = wx.CheckBox(self, -1)
576         self.label_min = wx.StaticText(self, -1, 'min')
577         self.spin_min = wx.SpinCtrl(self, -1, '',size = (100,30), min = 1, max = 100)
578         self.label_max = wx.StaticText(self, -1, 'max')
579         self.spin_max = wx.SpinCtrl(self, -1, '',size = (100,30), min = 1, max = 100)
580         txt = _(u"Text size proportional to chi2").decode('utf8')
581         self.label_tchi = wx.StaticText(self, -1, txt)
582         self.check_tchi = wx.CheckBox(self, -1)
583         self.label_min_tchi = wx.StaticText(self, -1, 'min')
584         self.spin_min_tchi = wx.SpinCtrl(self, -1, '', size = (100,30), min = 1, max = 100)
585         self.label_max_tchi = wx.StaticText(self, -1, 'max')
586         self.spin_max_tchi = wx.SpinCtrl(self, -1, '', size = (100,30), min = 1, max = 100)
587         self.label_8 = wx.StaticText(self, -1, _(u"Factor x : ").decode('utf8'))
588         self.spin_f1 = wx.SpinCtrl(self, -1, '',size = (100,30), min=1, max=self.paramgraph['clnb']-1)
589         self.label_9 = wx.StaticText(self, -1, _(u"Factor y : ").decode('utf8'))
590         self.spin_f2 = wx.SpinCtrl(self, -1, '',size = (100,30), min=1, max=self.paramgraph['clnb']-1)
591         self.label_f3 = wx.StaticText(self, -1, _(u"Factor z : ").decode('utf8'))
592         self.spin_f3 = wx.SpinCtrl(self, -1, '',size = (100,30), min=1, max=self.paramgraph['clnb']-1)
593         self.label_sphere = wx.StaticText(self, -1, _(u"Sphere transparency").decode('utf8'))
594         self.slider_sphere = wx.Slider(self, -1, 10, 1, 100, size = (255,-1), style = wx.SL_HORIZONTAL | wx.SL_AUTOTICKS | wx.SL_LABELS)
595
596         self.label_film = wx.StaticText(self, -1, _(u"Make a movie").decode('utf8'))
597         self.film = wx.CheckBox(self, -1)
598                
599         self.btnsizer = wx.StdDialogButtonSizer()
600         if wx.Platform != "__WXMSW__":
601             btn = wx.ContextHelpButton(self)
602             self.btnsizer.AddButton(btn)
603         btn = wx.Button(self, wx.ID_OK)
604         btn.SetDefault()
605         self.btnsizer.AddButton(btn)
606         btn = wx.Button(self, wx.ID_CANCEL)
607         self.btnsizer.AddButton(btn)
608         self.btnsizer.Realize()
609         
610         self.Bind(wx.EVT_CHECKBOX, self.OnCheck1, self.check1)
611         self.Bind(wx.EVT_CHECKBOX, self.OnCheck2, self.check2)
612         self.Bind(wx.EVT_CHECKBOX, self.OnNorm, self.check4)
613         self.Bind(wx.EVT_CHECKBOX, self.OnCheckTchi, self.check_tchi)
614         self.Bind(wx.EVT_CHOICE, self.On3D, self.choicetype)
615         self.Bind(wx.EVT_CHOICE, self.OnPass, self.choice2)
616         self.Bind(wx.EVT_CHECKBOX, self.OnCheckChic, self.check_chic)
617         self.__set_properties()
618         self.OnNorm(wx.EVT_CHECKBOX)
619         self.OnCheckTchi(wx.EVT_CHECKBOX)
620         self.__do_layout()
621
622     def __set_properties(self):
623         self.choicetype.SetSelection(self.paramgraph['typegraph'])
624         if self.paramgraph['typegraph'] == 0  or self.paramgraph['typegraph'] == 2:
625             self.film.Enable(False)
626             self.spin_f3.Enable(False)
627             self.slider_sphere.Enable(False)
628         self.choix_format.SetSelection(self.paramgraph['svg'])
629         self.choice1.SetSelection(self.paramgraph['what'])
630         self.choice2.SetSelection(self.paramgraph['qui'])
631         self.spin_chi.SetValue(self.paramgraph['select_nb'])
632         self.spin_nb.SetValue(self.paramgraph['select_chi'])
633         self.spin1.SetValue(self.paramgraph['width'])
634         self.spin2.SetValue(self.paramgraph['height'])
635         self.spin3.SetValue(self.paramgraph['taillecar'])
636         self.spin_nb.SetValue(self.paramgraph['select_nb'])
637         self.spin_chi.SetValue(self.paramgraph['select_chi'])
638         self.spin_nbchic.SetValue(self.paramgraph['nbchic'])
639         self.check1.SetValue(self.paramgraph['do_select_nb'])
640         self.check2.SetValue(self.paramgraph['do_select_chi'])
641         self.check_chic.SetValue(self.paramgraph['do_select_chi_classe'])
642         self.check3.SetValue(self.paramgraph['over'])
643         if self.paramgraph['do_select_nb'] :
644             self.spin_nb.Enable(True)
645             self.spin_chi.Enable(False)
646             self.spin_nbchic.Enable(False)
647         elif self.paramgraph['do_select_chi_classe'] :
648             self.spin_nb.Enable(False)
649             self.spin_chi.Enable(False)
650             self.spin_nbchic.Enable(True)
651         elif self.paramgraph['do_select_chi'] :
652             self.spin_nb.Enable(False)
653             self.spin_chi.Enable(True)
654             self.spin_nbchic.Enable(False)
655         else :
656             self.spin_nb.Enable(False)
657             self.spin_chi.Enable(False)
658             self.spin_nbchic.Enable(False)
659
660             
661         self.check4.SetValue(self.paramgraph['cex_txt'])
662         self.spin_min.SetValue(self.paramgraph['txt_min'])
663         self.spin_max.SetValue(self.paramgraph['txt_max'])
664         self.check_tchi.SetValue(self.paramgraph['tchi'])
665         self.spin_min_tchi.SetValue(self.paramgraph['tchi_min'])
666         self.spin_max_tchi.SetValue(self.paramgraph['tchi_max'])
667
668         self.spin_f1.SetValue(self.paramgraph['facteur'][0])
669         self.spin_f2.SetValue(self.paramgraph['facteur'][1])
670         self.spin_f3.SetValue(self.paramgraph['facteur'][2])
671         self.slider_sphere.SetValue(self.paramgraph['alpha'])
672
673     def __do_layout(self):
674         sizer_2 = wx.BoxSizer(wx.VERTICAL)
675         fsizer = wx.FlexGridSizer(0,2,0,5)
676         grid_min = wx.FlexGridSizer(0, 2, 0, 0)
677         grid_max = wx.FlexGridSizer(0, 2, 0, 0)
678         grid_minmax = wx.FlexGridSizer(0, 2, 0, 0)
679         grid_min_tchi = wx.FlexGridSizer(0, 2, 0, 0)
680         grid_max_tchi = wx.FlexGridSizer(0, 2, 0, 0)
681         grid_minmax_tchi = wx.FlexGridSizer(0, 2, 0, 0)
682
683         sizer_3 = wx.BoxSizer(wx.VERTICAL)
684         
685         fsizer.Add(self.labeltype, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
686         fsizer.Add(self.choicetype, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
687         fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
688         fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
689
690         fsizer.Add(self.label_format, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
691         fsizer.Add(self.choix_format, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
692         fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
693         fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
694
695         fsizer.Add(self.label_what, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
696         fsizer.Add(self.choice1, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
697         fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
698         fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
699         
700         fsizer.Add(self.label_qui, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
701         fsizer.Add(self.choice2, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
702         fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
703         fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)              
704         
705         sizer_h1 = wx.BoxSizer(wx.HORIZONTAL)
706         sizer_h1.Add(self.label_1, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
707         sizer_h1.Add(self.spin1, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
708         fsizer.Add(sizer_h1, 0, wx.ALL, 5)
709         sizer_h2 = wx.BoxSizer(wx.HORIZONTAL)
710         sizer_h2.Add(self.label_2, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
711         sizer_h2.Add(self.spin2, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
712         fsizer.Add(sizer_h2, 0, wx.ALL, 5)
713         fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
714         fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
715         
716         fsizer.Add(self.label_3, 0, wx.ALL | wx.LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
717         fsizer.Add(self.spin3, 0, wx.ALL | wx.LEFT | wx.ALIGN_CENTER_VERTICAL, 5)        
718         fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
719         fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
720         
721         fsizer.Add(self.label_4, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
722         sizer_nb = wx.BoxSizer(wx.HORIZONTAL)
723         sizer_nb.Add(self.check1, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
724         sizer_nb.Add(self.spin_nb, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
725         fsizer.Add(sizer_nb, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
726         fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
727         fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
728         
729         fsizer.Add(self.label_chic, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
730         sizer_nbchic = wx.BoxSizer(wx.HORIZONTAL)
731         sizer_nbchic.Add(self.check_chic, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
732         sizer_nbchic.Add(self.spin_nbchic, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
733         fsizer.Add(sizer_nbchic, 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_5, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
738         sizer_chi = wx.BoxSizer(wx.HORIZONTAL)
739         sizer_chi.Add(self.check2, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
740         sizer_chi.Add(self.spin_chi, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
741         fsizer.Add(sizer_chi, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
742         fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
743         fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
744         
745         fsizer.Add(self.label_6, 0,  wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL| wx.ADJUST_MINSIZE, 5)
746         fsizer.Add(self.check3, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 5)
747         fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
748         fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0) 
749         
750         sizer_2.Add(fsizer, 0, wx.EXPAND, 0)
751         
752         bsizer_1 = wx.FlexGridSizer(0,3,0,0)
753         bsizer_1.Add(self.label_7, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
754         bsizer_1.Add(self.check4, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL|wx.EXPAND, 5)
755         grid_min.Add(self.label_min, 0,wx.ALL |  wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
756         grid_min.Add(self.spin_min, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
757         grid_max.Add(self.label_max, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
758         grid_max.Add(self.spin_max, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
759         grid_minmax.Add(grid_min, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
760         grid_minmax.Add(grid_max, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
761
762         bsizer_1.Add(grid_minmax, 0, wx.ALL, 5)
763
764         bsizer_1.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
765         bsizer_1.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0) 
766         bsizer_1.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)        
767
768         bsizer_1.Add(self.label_tchi, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
769         bsizer_1.Add(self.check_tchi, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL|wx.EXPAND, 5)
770         grid_min_tchi.Add(self.label_min_tchi, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
771         grid_min_tchi.Add(self.spin_min_tchi, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
772         grid_max_tchi.Add(self.label_max_tchi, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
773         grid_max_tchi.Add(self.spin_max_tchi, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
774         grid_minmax_tchi.Add(grid_min_tchi, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
775         grid_minmax_tchi.Add(grid_max_tchi, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
776         
777         bsizer_1.Add(grid_minmax_tchi, 0,  wx.ALL, 5)
778         sizer_2.Add(bsizer_1, 0, wx.EXPAND, 5)
779         
780         sizer_2.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0) 
781         
782         sizer_f = wx.BoxSizer(wx.HORIZONTAL)
783         sizer_f.Add(self.label_8, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
784         sizer_f.Add(self.spin_f1, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
785         
786         sizer_f.Add(self.label_9, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
787         sizer_f.Add(self.spin_f2, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
788
789         sizer_f.Add(self.label_f3, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
790         sizer_f.Add(self.spin_f3, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
791         sizer_2.Add(sizer_f, 0, wx.EXPAND, 5)
792         
793         sizer_2.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 5)
794         
795         fsizer2 = wx.FlexGridSizer(0,2,0,0)
796         fsizer2.Add(self.label_sphere, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
797         fsizer2.Add(self.slider_sphere, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
798         fsizer2.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
799         fsizer2.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
800
801         fsizer2.Add(self.label_film, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
802         fsizer2.Add(self.film, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
803         sizer_2.Add(fsizer2, 0, wx.EXPAND, 5)
804         sizer_2.Add(self.btnsizer, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_CENTER_HORIZONTAL, 5)
805         self.SetSizer(sizer_2)
806         sizer_2.Fit(self)
807         self.Layout()
808         
809     def OnCheck1(self, event):
810         if self.check1.GetValue() :
811             self.check2.SetValue(False)
812             self.check_chic.SetValue(False)
813             self.spin_chi.Enable(False)
814             self.spin_nb.Enable(True)
815             self.spin_nbchic.Enable(False)
816         else : 
817             self.spin_nb.Enable(False)
818             
819     def OnCheck2(self, event):
820         if self.check2.GetValue() :
821             self.check1.SetValue(False)
822             self.check_chic.SetValue(False)
823             self.spin_chi.Enable(True)
824             self.spin_nb.Enable(False)
825             self.spin_nbchic.Enable(False)
826         else :
827             self.spin_chi.Enable(False) 
828
829     def OnCheckChic(self, event) :
830         if self.check_chic.GetValue() :
831             self.check1.SetValue(False)
832             self.check2.SetValue(False)
833             self.spin_chi.Enable(False)
834             self.spin_nb.Enable(False)
835             self.spin_nbchic.Enable(True)
836         else :
837             self.spin_nbchic.Enable(False)
838
839     def OnNorm(self, event):
840         if not self.check4.GetValue() :
841             self.spin_min.Disable()
842             self.spin_max.Disable()
843         else :
844             self.spin_min.Enable(True)
845             self.spin_max.Enable(True)
846             self.check_tchi.SetValue(False)
847             self.OnCheckTchi(wx.EVT_CHECKBOX)
848
849     def OnCheckTchi(self, evt) :
850         if not self.check_tchi.GetValue() :
851             self.spin_min_tchi.Disable()
852             self.spin_max_tchi.Disable()
853         else :
854             self.spin_min_tchi.Enable(True)
855             self.spin_max_tchi.Enable(True)
856             self.check4.SetValue(False)
857             self.OnNorm(wx.EVT_CHECKBOX)
858
859     def On3D(self, event) :
860         if event.GetString() == u'3D' :
861             self.film.Enable(True)
862             self.spin_f3.Enable(True)
863             self.slider_sphere.Enable(True)
864         else :
865             self.film.Enable(False)
866             self.spin_f3.Enable(False)
867             self.slider_sphere.Enable(False)
868     
869     def OnPass(self,evt) :
870         if evt.GetString() == _(u"clusters").decode('utf8') :
871             self.check4.SetValue(False)
872             self.check4.Enable(False)
873             self.OnNorm(wx.EVT_CHECKBOX)
874         else :
875             self.check4.Enable()
876             
877
878 class SelectColDial ( wx.Dialog ):
879     
880     def __init__( self, parent ):
881         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 )
882         
883         self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
884         
885         self.bSizer2 = wx.BoxSizer( wx.VERTICAL )
886         
887         #self.m_checkList2 = wx.CheckListBox( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, ['r','t','y'], 0 ) 
888         #bSizer2.Add( self.m_checkList2, 2, wx.ALL|wx.EXPAND, 5 )
889         
890         self.m_sdbSizer2 = wx.StdDialogButtonSizer()
891         self.m_sdbSizer2OK = wx.Button( self, wx.ID_CANCEL)
892         self.butok = wx.Button( self, wx.ID_OK)
893         #m_sdbSizer2.AddButton( self.m_sdbSizer2OK )
894         #self.m_sdbSizer2Cancel = wx.Button( self, wx.ID_CANCEL )
895         #m_sdbSizer2.AddButton( self.m_sdbSizer2Cancel )
896         #m_sdbSizer2.Realize();
897         #self.bSizer2.Add( m_sdbSizer2, 0, wx.EXPAND, 5 )
898         
899         self.SetSizer( self.bSizer2 )
900         self.Layout()
901         
902         self.Centre( wx.BOTH )
903     
904     def __del__( self ):
905         pass
906
907 class PrefExport(wx.Dialog):
908     def __init__(self, parent, *args, **kwds):
909         kwds['style'] = wx.OK|wx.DEFAULT_DIALOG_STYLE 
910         wx.Dialog.__init__(self, *args, **kwds)
911         self.fileout = ""
912         self.parent = parent
913         sizer = wx.BoxSizer(wx.VERTICAL)
914         box = wx.BoxSizer(wx.HORIZONTAL)
915         box3 = wx.BoxSizer(wx.HORIZONTAL)
916         self.label_lem = wx.StaticText(self, -1, _(u"Lemmatised corpora").decode('utf8'))
917         box3.Add(self.label_lem, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
918         self.radio_lem = wx.RadioBox(self, -1, u"", choices= [ _(u"yes").decode('utf8'), _(u"no").decode('utf8') ], majorDimension=0, style=wx.RA_SPECIFY_ROWS)
919         box3.Add(self.radio_lem, 0, wx.ALIGN_RIGHT, 5)
920         sizer.Add(box3, 0, wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5)
921         self.label_txt = wx.StaticText(self, -1, _(u"Export for ...").decode('utf8'))
922         box.Add(self.label_txt, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
923         self.radio_type = wx.RadioBox(self, -1, u"", choices=['IRaMuTeQ/ALCESTE', 'Lexico'], majorDimension=0, style=wx.RA_SPECIFY_ROWS)
924         box.Add(self.radio_type, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
925         sizer.Add(box, 0, wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5)
926         box2 = wx.BoxSizer(wx.HORIZONTAL)
927         self.txt2 = wx.StaticText(self, -1, _(u"Output file").decode('utf8'))
928         box2.Add(self.txt2, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
929         self.fbb = filebrowse.FileBrowseButton(self, -1, size=(450, -1), fileMode = 2)
930         box2.Add(self.fbb, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
931         self.fbb.SetLabel("")
932         sizer.Add(box2, 0, wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5)
933
934         btnsizer = wx.StdDialogButtonSizer()
935         btn = wx.Button(self, wx.ID_CANCEL)
936         btnsizer.AddButton(btn)
937         btn_ok = wx.Button(self, wx.ID_OK)
938         btn_ok.SetDefault()
939         btnsizer.AddButton(btn_ok)
940         btnsizer.Realize()
941         sizer.Add(btnsizer, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL|wx.ALIGN_RIGHT, 5)
942         self.Bind(wx.EVT_BUTTON, self.check_file, btn_ok)
943         self.SetSizer(sizer)
944         sizer.Fit(self)        
945
946     def check_file(self, evt) :
947         if evt.GetId() == wx.ID_OK :
948             if os.path.exists(self.fbb.GetValue()):
949                 dlg = wx.MessageDialog(self, '\n'.join([u"%s" % self.fbb.GetValue(), _(u"This file already exists. Continue anyway ?").decode('utf8')]), _(u"Attention").decode('utf8'), wx.NO | wx.YES | wx.ICON_WARNING)
950                 dlg.CenterOnParent()
951                 if dlg.ShowModal() not in [wx.ID_NO, wx.ID_CANCEL]:
952                     self.EndModal(wx.ID_OK)
953             else :
954                 self.EndModal(wx.ID_OK)
955         else :
956             self.EndModal(wx.ID_CANCEL)
957
958 class PrefProfTypes(wx.Dialog):
959     def __init__(self, parent, *args, **kwds):
960         kwds['style'] = wx.OK|wx.DEFAULT_DIALOG_STYLE 
961         wx.Dialog.__init__(self, parent, *args, **kwds)
962         self.fileout = ""
963         self.parent = parent
964         sizer = wx.BoxSizer(wx.VERTICAL)
965         box = wx.BoxSizer(wx.HORIZONTAL)
966         box3 = wx.BoxSizer(wx.HORIZONTAL)
967         self.label_txt = wx.StaticText(self, -1, _(u"Settings").decode('utf8'))
968         box.Add(self.label_txt, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
969         self.radio_type = wx.RadioBox(self, -1, u"", choices=[_(u"Like ALCESTE").decode('utf8'), _(u"Like Lexico").decode('utf8')], majorDimension=0, style=wx.RA_SPECIFY_ROWS)
970         box.Add(self.radio_type, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
971         sizer.Add(box, 0, wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5)
972         box2 = wx.BoxSizer(wx.HORIZONTAL)
973         self.txt2 = wx.StaticText(self, -1, _(u"Output file").decode('utf8'))
974         box2.Add(self.txt2, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
975         self.fbb = filebrowse.FileBrowseButton(self, -1, size=(450, -1), fileMode = 2)
976         box2.Add(self.fbb, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
977         self.fbb.SetLabel("")
978         sizer.Add(box2, 0, wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5)
979
980         btnsizer = wx.StdDialogButtonSizer()
981         btn = wx.Button(self, wx.ID_CANCEL)
982         btnsizer.AddButton(btn)
983         btn_ok = wx.Button(self, wx.ID_OK)
984         btn_ok.SetDefault()
985         btnsizer.AddButton(btn_ok)
986         btnsizer.Realize()
987         sizer.Add(btnsizer, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL|wx.ALIGN_RIGHT, 5)
988         #self.Bind(wx.EVT_BUTTON, self.check_file, btn_ok)
989         self.SetSizer(sizer)
990         sizer.Fit(self)
991
992 class PrefSimpleFile(wx.Dialog):
993     def __init__(self, parent, *args, **kwds):
994         kwds['style'] = wx.OK|wx.DEFAULT_DIALOG_STYLE 
995         if 'mask' in kwds :
996             self.mask = kwds['mask']
997             del(kwds['mask'])
998         else : self.mask = '*.*'
999         wx.Dialog.__init__(self, *args, **kwds)
1000         self.fileout = ""
1001         self.parent = parent
1002         sizer = wx.BoxSizer(wx.VERTICAL)
1003         box2 = wx.BoxSizer(wx.HORIZONTAL)
1004         self.txt2 = wx.StaticText(self, -1, _(u"Output file").decode('utf8'))
1005         box2.Add(self.txt2, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
1006         self.fbb = filebrowse.FileBrowseButton(self, -1, size=(450, -1), fileMode = 2, fileMask = self.mask)
1007         box2.Add(self.fbb, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
1008         self.fbb.SetLabel("")
1009         sizer.Add(box2, 0, wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5)
1010
1011         btnsizer = wx.StdDialogButtonSizer()
1012         btn = wx.Button(self, wx.ID_CANCEL)
1013         btnsizer.AddButton(btn)
1014         btn_ok = wx.Button(self, wx.ID_OK)
1015         btn_ok.SetDefault()
1016         btnsizer.AddButton(btn_ok)
1017         btnsizer.Realize()
1018         sizer.Add(btnsizer, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL|wx.ALIGN_RIGHT, 5)
1019         self.Bind(wx.EVT_BUTTON, self.check_file, btn_ok)
1020         self.SetSizer(sizer)
1021         sizer.Fit(self)        
1022
1023     def check_file(self, evt) :
1024         if evt.GetId() == wx.ID_OK :
1025             if os.path.exists(self.fbb.GetValue()):
1026                 dlg = wx.MessageDialog(self, '\n'.join([u"%s" % self.fbb.GetValue(), _(u"This file already exists. Continue anyway ?").decode('utf8')]), _(u"Attention").decode('utf8'), wx.NO | wx.YES | wx.ICON_WARNING)
1027                 dlg.CenterOnParent()
1028                 if dlg.ShowModal() not in [wx.ID_NO, wx.ID_CANCEL]:
1029                     self.EndModal(wx.ID_OK)
1030             else :
1031                 self.EndModal(wx.ID_OK)
1032         else :
1033             self.EndModal(wx.ID_CANCEL)
1034
1035 class StatDialog ( wx.Dialog ):
1036     
1037     def __init__( self, parent, keys ):
1038         wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = u"Settings", pos = wx.DefaultPosition, size = wx.Size( -1,-1 ), style = wx.DEFAULT_DIALOG_STYLE )
1039         
1040         self.fileout = ""
1041         self.parent = parent
1042         self.keys = keys
1043         self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
1044         
1045         bSizer1 = wx.BoxSizer( wx.VERTICAL )
1046         
1047         gSizer1 = wx.GridSizer( 0, 2, 0, 0 )
1048         
1049         self.m_staticText1 = wx.StaticText( self, wx.ID_ANY, u"Lemmatization", wx.DefaultPosition, wx.DefaultSize, 0 )
1050         self.m_staticText1.Wrap( -1 )
1051         gSizer1.Add( self.m_staticText1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1052         
1053         radio_lemChoices = [ u"yes", u"no" ]
1054         self.radio_lem = wx.RadioBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, radio_lemChoices, 1, wx.RA_SPECIFY_COLS )
1055         self.radio_lem.SetSelection( 0 )
1056         gSizer1.Add( self.radio_lem, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
1057         
1058         self.m_staticText2 = wx.StaticText( self, wx.ID_ANY, u"Keys properties", wx.DefaultPosition, wx.DefaultSize, 0 )
1059         self.m_staticText2.Wrap( -1 )
1060         gSizer1.Add( self.m_staticText2, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1061         
1062         self.button_5 = wx.Button( self, wx.ID_PREFERENCES, u"properties", wx.DefaultPosition, wx.DefaultSize, 0 )
1063         gSizer1.Add( self.button_5, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
1064         
1065         self.m_staticText3 = wx.StaticText( self, wx.ID_ANY, u"Dictionary", wx.DefaultPosition, wx.DefaultSize, 0 )
1066         self.m_staticText3.Wrap( -1 )
1067         gSizer1.Add( self.m_staticText3, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1068         
1069         radio_dictchoiceChoices = [ u"indexation", u"other" ]
1070         self.radio_dictchoice = wx.RadioBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, radio_dictchoiceChoices, 1, wx.RA_SPECIFY_COLS )
1071         self.radio_dictchoice.SetSelection( 0 )
1072         gSizer1.Add( self.radio_dictchoice, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
1073         
1074         
1075         bSizer1.Add( gSizer1, 1, wx.EXPAND, 5 )
1076         
1077         self.dictpath = filebrowse.FileBrowseButton(self, -1, size=(350, -1),  labelText = _(u"Path").decode('utf8'), fileMode = 2, fileMask = '*')
1078         bSizer1.Add( self.dictpath, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1079         self.dictpath.Enable(False)
1080
1081         m_sdbSizer1 = wx.StdDialogButtonSizer()
1082         self.m_sdbSizer1OK = wx.Button( self, wx.ID_OK )
1083         m_sdbSizer1.AddButton( self.m_sdbSizer1OK )
1084         self.m_sdbSizer1Cancel = wx.Button( self, wx.ID_CANCEL )
1085         m_sdbSizer1.AddButton( self.m_sdbSizer1Cancel )
1086         m_sdbSizer1.Realize();
1087         
1088         bSizer1.Add( m_sdbSizer1, 0, wx.EXPAND, 5 )
1089         
1090         
1091         self.SetSizer( bSizer1 )
1092         self.Layout()
1093         bSizer1.Fit( self )
1094         
1095         self.Centre( wx.BOTH )
1096         
1097         # Connect Events
1098         self.button_5.Bind( wx.EVT_BUTTON, self.OnKeys )
1099         self.radio_dictchoice.Bind( wx.EVT_RADIOBOX, self.OnOther )
1100     
1101     def __del__( self ):
1102         pass
1103     
1104     
1105     # Virtual event handlers, overide them in your derived class
1106     def OnKeys( self, event ):
1107         dial = AlcOptFrame(self, self.parent)
1108         dial.CenterOnParent()
1109         dial.ShowModal()
1110         for i in range(0,len(dial.listlabel)):
1111             dial.keys[dial.listcle[i]] = dial.listspin[i].GetValue()
1112         DoConf().makeoptions(['KEY'], [dial.keys], outfile = self.parent.ConfigPath['key'])
1113         dial.Destroy()
1114     
1115     def OnOther( self, event ):
1116         if self.radio_dictchoice.GetSelection() :
1117             self.dictpath.Enable(True)
1118         else :
1119             self.dictpath.Enable(False)
1120
1121 # class StatDialog(wx.Dialog):
1122 #     def __init__(self, parent, *args, **kwds):
1123 #         kwds['style'] = wx.DEFAULT_DIALOG_STYLE 
1124 #         wx.Dialog.__init__(self, *args, **kwds)
1125 #         self.fileout = ""
1126 #         self.parent = parent
1127 #         self.label_lem = wx.StaticText(self, -1, _(u"Lemmatization").decode('utf8'))
1128 #         self.radio_lem = wx.RadioBox(self, -1, u"", choices=[_(u'oui').decode('utf8'), _(u'non').decode('utf8')], majorDimension=0, style=wx.RA_SPECIFY_ROWS)
1129 #         #txt = u"""Fréquence minimum d'une forme
1130 # #analysée (0 = non utilisé)"""
1131 #         #self.label_8 = wx.StaticText(self, -1, txt)
1132 #         #self.spin_ctrl_5 = wx.SpinCtrl(self, -1, "",size = (100,30), min=0, max=1000, initial=0)
1133 #         #self.label_max_actives =  wx.StaticText(self, -1, u"Nombre maximum de formes analysées")
1134 #         #self.spin_max_actives = wx.SpinCtrl(self, -1, "",size = (100,30), min=20, max=10000, initial=1500)
1135 #         self.label_4 = wx.StaticText(self, -1, _(u"Keys settings").decode('utf8'))
1136 #         self.button_5 = wx.Button(self, wx.ID_PREFERENCES, "")
1137 #         self.labeldictchoice = wx.StaticText(self, -1, _(u"Dictionary").decode('utf8'))
1138 #         self.radio_dictchoice = wx.RadioBox(self, -1, u"", choices=[_(u'indexation').decode('utf8'), _(u'other').decode('utf8')], majorDimension=0, style=wx.RA_SPECIFY_ROWS)
1139 #         #self.labeldictpath = wx.StaticText(self, -1, _(u"Path").decode('utf8'))
1140 #         self.dictpath = filebrowse.FileBrowseButton(self, -1, size=(350, -1),  labelText = _(u"Path").decode('utf8'), fileMode = 2, fileMask = '*')
1141 #         self.dictpath.Enable(False)
1142 #         #self.Bind(wx.EVT_CHECKBOX, self.OnCheckUce, self.check_uce)
1143 #         #self.Bind(wx.EVT_SPINCTRL, self.OnSpin, self.spin_ctrl_5)
1144 #         self.Bind(wx.EVT_BUTTON, self.OnKeys, self.button_5)
1145 #         self.Bind(wx.EVT_RADIOBOX, self.OnOther, self.radio_dictchoice)
1146 #         self.__do_layout()
1147 #         self.__set_properties()
1148
1149 #     def __do_layout(self) :
1150 #         first = wx.BoxSizer(wx.VERTICAL)
1151 #         sizer = wx.FlexGridSizer(0,2,0,0)
1152 #         sizer.Add(self.label_lem, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
1153 #         sizer.Add(self.radio_lem, 0, wx.ALIGN_LEFT, 5)
1154 #         sizer.Add(wx.StaticLine(self),0, wx.ALIGN_LEFT, 5)
1155 #         sizer.Add(wx.StaticLine(self),0, wx.ALIGN_LEFT, 5)
1156 #         #sizer.Add(self.txt_exp, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
1157 #         #sizer.Add(self.exp, 0, wx.ALIGN_RIGHT, 5)
1158 #         #sizer.Add(self.label_uce, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
1159 #         #sizer.Add(self.check_uce, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
1160 #         #sizer.Add(self.label_occuce, 0,  wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
1161 #         #sizer.Add(self.spin_ctrl_4, 0,  wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
1162 #         #sizer.Add(self.label_8, 0,  wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
1163 #         #sizer.Add(self.spin_ctrl_5, 0,  wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
1164 #         #sizer.Add(self.label_max_actives, 0,  wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
1165 #         #sizer.Add(self.spin_max_actives, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
1166 #         sizer.Add(self.label_4, 0,  wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
1167 #         sizer.Add(self.button_5, 0,  wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
1168 #         sizer.Add(wx.StaticLine(self),0, wx.ALIGN_LEFT, 5)
1169 #         sizer.Add(wx.StaticLine(self),0, wx.ALIGN_LEFT, 5)
1170 #         sizer.Add(self.labeldictchoice, 0,  wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
1171 #         sizer.Add(self.radio_dictchoice, 0,  wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
1172 #         sizer.Add(wx.StaticLine(self),0, wx.ALIGN_LEFT, 5)
1173 #         sizer.Add(wx.StaticLine(self),0, wx.ALIGN_LEFT, 5)
1174 #         #sizer.Add(self.labeldictpath, 0,  wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
1175 #         sizer.Add(self.dictpath, 0,  wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
1176 #         sizer.Add(wx.StaticLine(self),0, wx.ALIGN_LEFT, 5)
1177 #         sizer.Add(wx.StaticLine(self),0, wx.ALIGN_LEFT, 5)      
1178 #         #sizer.Add(box2, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT, 5)
1179 #         first.Add(sizer, 0, wx.ALL, 5)
1180 #         btnsizer = wx.StdDialogButtonSizer()
1181 #         btn = wx.Button(self, wx.ID_CANCEL)
1182 #         btnsizer.AddButton(btn)
1183 #         btn_ok = wx.Button(self, wx.ID_OK)
1184 #         btn_ok.SetDefault()
1185 #         btnsizer.AddButton(btn_ok)
1186 #         btnsizer.Realize()
1187 #         first.Add(btnsizer, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT, 5)
1188 #         self.SetSizer(first)
1189 #         first.Fit(self)
1190
1191 #     def __set_properties(self) :
1192 #         self.SetTitle(_(u"Settings").decode('utf8'))
1193
1194 #     def OnKeys(self, evt):
1195 #         dial = AlcOptFrame(self, self.parent.parent)
1196 #         dial.CenterOnParent()
1197 #         dial.ShowModal()
1198 #         for i in range(0,len(dial.listlabel)):
1199 #             dial.keys[dial.listcle[i]] = dial.listspin[i].GetValue()
1200 #         DoConf().makeoptions(['KEY'], [dial.keys], outfile = self.parent.parent.ConfigPath['key'])
1201 #         dial.Destroy()
1202 #     
1203 #     def OnOther(self, evt):
1204 #         if self.radio_dictchoice.GetSelection() :
1205 #             self.dictpath.Enable(True)
1206 #         else :
1207 #             self.dictpath.Enable(False)
1208
1209 class PrefUCECarac(wx.Dialog):
1210     def __init__(self, parent, *args, **kwds):
1211         kwds['style'] = wx.DEFAULT_DIALOG_STYLE 
1212         kwds['title'] = _(u"Characteristic text segments").decode('utf8')
1213         wx.Dialog.__init__(self, *args, **kwds)
1214         self.parent = parent
1215         first = wx.BoxSizer(wx.VERTICAL)
1216         sizer = wx.FlexGridSizer(0,2,0,0)
1217         self.label_type = wx.StaticText(self, -1, _(u"Ranking score").decode('utf8'))
1218         sizer.Add(self.label_type, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
1219         self.radio_type = wx.RadioBox(self, -1, u"", choices=[_(u"absolute (sum of chi2 of marked forms in segment)").decode('utf8'), _(u"relative (mean of chi2 of marked forms in segment)").decode('utf8')], majorDimension=0, style=wx.RA_SPECIFY_ROWS)
1220         sizer.Add(self.radio_type, 0, wx.ALIGN_RIGHT, 5)
1221         self.txt_eff = wx.StaticText(self, -1, _(u"Maximum number of text segments").decode('utf8'))
1222         sizer.Add(self.txt_eff, 0, wx.ALIGN_CENTRE, 5)
1223         self.spin_eff = wx.SpinCtrl(self, -1, '', size = (100, 30), min = 1, max = 100000, initial = 50)
1224         self.spin_eff.SetValue(50)
1225         sizer.Add(self.spin_eff, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
1226         first.Add(sizer, 0, wx.ALL, 5)
1227         btnsizer = wx.StdDialogButtonSizer()
1228         btn = wx.Button(self, wx.ID_CANCEL)
1229         btnsizer.AddButton(btn)
1230         btn_ok = wx.Button(self, wx.ID_OK)
1231         btn_ok.SetDefault()
1232         btnsizer.AddButton(btn_ok)
1233         btnsizer.Realize()
1234         first.Add(btnsizer, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT, 5)
1235         self.SetSizer(first)
1236         first.Fit(self)
1237
1238 class PrefSegProf(wx.Dialog) :
1239     def __init__( self, parent ):
1240         wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = _(u"Repeated segments profiles").decode('utf8'), pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.DEFAULT_DIALOG_STYLE )
1241         
1242         self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
1243         bSizer1 = wx.BoxSizer( wx.VERTICAL )
1244         txt = _(u"Be carefull : computation of repeated segments profiles can be very long on large corpora").decode('utf8')
1245         self.label = wx.StaticText( self, wx.ID_ANY, txt, wx.DefaultPosition, wx.DefaultSize, 0 ) 
1246         bSizer1.Add( self.label, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5 )
1247
1248         fgSizer1 = wx.FlexGridSizer( 0, 2, 0, 0 )
1249         fgSizer1.SetFlexibleDirection( wx.BOTH )
1250         fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
1251         
1252         self.m_staticText1 = wx.StaticText( self, wx.ID_ANY, _(u"Lemmatised corpora").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
1253         self.m_staticText1.Wrap( -1 )
1254         fgSizer1.Add( self.m_staticText1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1255         
1256         box_lemChoices = [ _(u"yes").decode('utf8'), _(u"no").decode('utf8') ]
1257         self.box_lem = wx.RadioBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, box_lemChoices, 1, wx.RA_SPECIFY_COLS )
1258         self.box_lem.SetSelection( 1 )
1259         fgSizer1.Add( self.box_lem, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1260         #self.box_lem.Enable(False)
1261         
1262         self.m_staticText3 = wx.StaticText( self, wx.ID_ANY, _(u"Minimum size of segments").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
1263         self.m_staticText3.Wrap( -1 )
1264         fgSizer1.Add( self.m_staticText3, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1265         
1266         self.spin_min = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, (100,30), wx.SP_ARROW_KEYS, 2, 30, 2 )
1267         self.spin_min.SetValue(2)
1268         fgSizer1.Add( self.spin_min, 0, wx.ALL, 5 )
1269         
1270         self.m_staticText4 = wx.StaticText( self, wx.ID_ANY, _(u"Minimum size of segments").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
1271         self.m_staticText4.Wrap( -1 )
1272         fgSizer1.Add( self.m_staticText4, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1273         
1274         self.spin_max = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, (100,30), wx.SP_ARROW_KEYS, 2, 30, 10 )
1275         self.spin_max.SetValue(10)
1276         fgSizer1.Add( self.spin_max, 0, wx.ALL, 5 )
1277         
1278         self.m_staticText5 = wx.StaticText( self, wx.ID_ANY, _(u"Minimum frequency of segments").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
1279         self.m_staticText5.Wrap( -1 )
1280         fgSizer1.Add( self.m_staticText5, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1281         
1282         self.spin_eff = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, (100,30), wx.SP_ARROW_KEYS, 4, 1000, 4 )
1283         self.spin_eff.SetValue(4)
1284         fgSizer1.Add( self.spin_eff, 0, wx.ALL, 5 )
1285         
1286         bSizer1.Add( fgSizer1, 1, wx.EXPAND, 5 )
1287         btnsizer = wx.StdDialogButtonSizer()
1288         btn = wx.Button(self, wx.ID_CANCEL)
1289         btnsizer.AddButton(btn)
1290         btn_ok = wx.Button(self, wx.ID_OK)
1291         btn_ok.SetDefault()
1292         btnsizer.AddButton(btn_ok)
1293         btnsizer.Realize()
1294         bSizer1.Add(btnsizer, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT, 5)
1295
1296         self.SetSizer( bSizer1 )
1297         self.Layout()
1298         bSizer1.Fit( self )
1299         
1300         self.Centre( wx.BOTH )
1301
1302 class PrefQuestAlc ( wx.Dialog ):
1303     
1304     def __init__( self, parent, tableau, sim = False):
1305         wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = _(u"Clustering").decode('utf8'), pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.DEFAULT_DIALOG_STYLE )
1306         
1307         self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
1308         
1309         #---------------------------------------------------------------
1310         #self.content = parent.content[:]
1311         self.header = tableau.get_colnames()
1312         labels = [val for val in self.header]
1313         self.labels_tot = labels
1314         self.varsup = []
1315         self.sim = sim
1316         #---------------------------------------------------------------
1317         bSizer2 = wx.BoxSizer( wx.VERTICAL )
1318         
1319         fgSizer1 = wx.FlexGridSizer( 0, 2, 0, 0 )
1320         fgSizer1.SetFlexibleDirection( wx.BOTH )
1321         fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
1322
1323         if not self.sim :
1324             self.lab_format = wx.StaticText( self, wx.ID_ANY, _(u"Supplementary variables are marked with a *").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
1325             self.lab_format.Wrap( -1 )
1326             fgSizer1.Add( self.lab_format, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1327         
1328             m_radioBox1Choices = [ _(u"yes").decode('utf8'), _(u"no").decode('utf8') ]
1329             self.m_radioBox1 = wx.RadioBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, m_radioBox1Choices, 1, wx.RA_SPECIFY_COLS )
1330             self.m_radioBox1.SetSelection( 0 )
1331             fgSizer1.Add( self.m_radioBox1, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1332         
1333         self.m_staticText3 = wx.StaticText( self, wx.ID_ANY, _(u"Actives variables (almost 3)").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
1334         self.m_staticText3.Wrap( -1 )
1335         fgSizer1.Add( self.m_staticText3, 0, wx.ALL, 5 )
1336         
1337         self.m_staticText2 = wx.StaticText( self, wx.ID_ANY, _(u"Supplementaries variables (almost 1)").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
1338         self.m_staticText2.Wrap( -1 )
1339         fgSizer1.Add( self.m_staticText2, 0, wx.ALL, 5 )
1340         
1341         self.ListActive = wx.ListBox( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, labels,  wx.LB_EXTENDED )
1342         self.ListActive.SetMinSize( wx.Size( 300,250 ) )
1343         
1344         fgSizer1.Add( self.ListActive, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL|wx.EXPAND, 5 )
1345         
1346         self.ListSup = wx.ListBox( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, labels, wx.LB_EXTENDED )
1347         self.ListSup.SetMinSize( wx.Size( 300,250 ) )
1348         
1349         fgSizer1.Add( self.ListSup, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL|wx.EXPAND, 5 )
1350         
1351         self.but_suiv = wx.Button( self, wx.ID_ANY, _(u"Next").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
1352         fgSizer1.Add( self.but_suiv, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1353         
1354         self.but_prec = wx.Button( self, wx.ID_ANY, _(u"Previous").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
1355         fgSizer1.Add( self.but_prec, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1356         
1357         if not sim :
1358             self.lab_nbcl = wx.StaticText( self, wx.ID_ANY, _(u"Number of terminal clusters in phase 1").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
1359             self.lab_nbcl.Wrap( -1 )
1360             fgSizer1.Add( self.lab_nbcl, 0, wx.ALL, 5 )
1361             
1362             self.spin_nbcl = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 2, 100, 10 )
1363             self.spin_nbcl.SetValue(10)
1364             self.spin_nbcl.SetMinSize( wx.Size( 100,30 ) )
1365             
1366             fgSizer1.Add( self.spin_nbcl, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1367             
1368             self.lab_mincl = wx.StaticText( self, wx.ID_ANY, _(u"Minimum text segments frenquency in clusters (2= automatic)").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
1369             self.lab_mincl.Wrap( -1 )
1370             fgSizer1.Add( self.lab_mincl, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
1371             
1372             self.spin_mincl = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 2, 1000, 0 )
1373             self.spin_mincl.SetValue(2)
1374             self.spin_mincl.SetMinSize( wx.Size( 100,30 ) )
1375             
1376             fgSizer1.Add( self.spin_mincl, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1377             
1378         bSizer2.Add( fgSizer1, 1, wx.EXPAND, 5 )
1379         
1380         m_sdbSizer2 = wx.StdDialogButtonSizer()
1381         self.m_sdbSizer2OK = wx.Button( self, wx.ID_OK )
1382         m_sdbSizer2.AddButton( self.m_sdbSizer2OK )
1383         self.m_sdbSizer2Cancel = wx.Button( self, wx.ID_CANCEL )
1384         m_sdbSizer2.AddButton( self.m_sdbSizer2Cancel )
1385         m_sdbSizer2.Realize();
1386         bSizer2.Add( m_sdbSizer2, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT|wx.ALL, 5 )
1387         
1388         self.SetSizer( bSizer2 )
1389         self.Layout()
1390         bSizer2.Fit( self )
1391         
1392         self.Centre( wx.BOTH )
1393         
1394         if not self.sim :
1395             self.ListActive.Enable(False)
1396             self.ListSup.Enable(False)
1397             self.but_suiv.Enable(False)
1398             self.but_prec.Enable(False)
1399         else :
1400             self.ListSup.Enable(False)
1401             self.but_prec.Enable(False)
1402         
1403         # Connect Events
1404         if not self.sim :
1405             self.m_radioBox1.Bind( wx.EVT_RADIOBOX, self.onformat )
1406         self.but_suiv.Bind(wx.EVT_BUTTON, self.onsuivant)
1407         self.but_prec.Bind(wx.EVT_BUTTON, self.onprec)
1408         self.m_sdbSizer2OK.Bind(wx.EVT_BUTTON, self.onvalid)
1409
1410     def __del__( self ):
1411         pass
1412     
1413     # Virtual event handlers, overide them in your derived class
1414     def onformat( self, event ):
1415         if self.m_radioBox1.GetSelection() == 0 :
1416             self.ListActive.Enable(False)
1417             self.ListSup.Enable(False)
1418             self.but_suiv.Enable(False)
1419             self.m_sdbSizer2OK.Enable(True)
1420         else :
1421             self.ListActive.Enable(True)
1422             self.but_suiv.Enable(True)
1423             self.m_sdbSizer2OK.Enable(False)
1424         
1425     def onsuivant(self, evt) :
1426         actives = list(self.ListActive.GetSelections())
1427         actives.sort()
1428         if len(actives)>=3 and len(actives) != len(self.header) :
1429             self.hindices = []
1430             self.nactives = []
1431             compt = 0
1432             header = self.header[:]
1433             for i in range(0, len(header)):
1434                 self.hindices.append(i)
1435             for i in actives :
1436                 self.nactives.append(i)
1437                 header.pop(i - compt)
1438                 self.hindices.pop(i - compt)
1439                 compt += 1
1440             self.labels = [val for val in header]
1441             self.ListSup.Clear()
1442             for i in header :
1443                 self.ListSup.Append(i)
1444                         
1445             self.ListActive.Enable(False)    
1446             self.ListSup.Enable(True)
1447             self.but_suiv.Enable(False)
1448             self.but_prec.Enable(True)
1449             if not self.sim :
1450                 self.m_sdbSizer2OK.Enable(True)
1451
1452     def onprec(self, evt) :
1453         self.ListActive.Enable(True)    
1454         self.ListSup.Enable(False)
1455         self.but_suiv.Enable(True)
1456         self.but_prec.Enable(False)
1457         if not self.sim :
1458             self.m_sdbSizer2OK.Enable(False)
1459
1460     def onvalid(self, evt) :
1461         for i in self.ListSup.GetSelections() :
1462             self.varsup.append(self.hindices[i])
1463         if not self.sim :
1464             if len(self.varsup) >= 1 or self.m_radioBox1.GetSelection() == 0 :
1465                 evt.Skip()
1466         else :
1467             if len(self.varsup) >= 1 :
1468                 evt.Skip()
1469
1470 class FindInCluster(wx.Frame):
1471     def __init__(self, parent, id, result, style = wx.DEFAULT_FRAME_STYLE):
1472         # begin wxGlade: MyFrame.__init__
1473         wx.Frame.__init__(self, parent, id)
1474         self.spanel =  wx.ScrolledWindow(self, -1, style=wx.TAB_TRAVERSAL)
1475         self.sizer1 = wx.FlexGridSizer(0,4,0,0)
1476         self.parent = parent
1477         self.formes = {}
1478         txt =  [_(u"form").decode('utf8'),_(u"cluster").decode('utf8'),_(u"Chi2").decode('utf8'), _(u"see").decode('utf8')]
1479         for val in txt :
1480             self.sizer1.Add( wx.StaticText(self.spanel, -1, val), 0, wx.ALL, 5)
1481         for val in txt :
1482             self.sizer1.Add(wx.StaticLine(self.spanel, -1), 0, wx.ALL, 5)
1483         for i,val in enumerate(result) :
1484             forme = val[0]
1485             cl = val[1]
1486             chi = val[2]
1487             pan = wx.Panel(self.spanel, -1, style=wx.SIMPLE_BORDER)
1488             siz = wx.BoxSizer(wx.VERTICAL)
1489             txt = wx.StaticText(pan, -1, forme)
1490             siz.Add(txt, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5)
1491             pan.SetSizer(siz)
1492             self.sizer1.Add(pan, 0, wx.ALL|wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 5)
1493             pan = wx.Panel(self.spanel, -1, style=wx.SIMPLE_BORDER)
1494             siz = wx.BoxSizer(wx.VERTICAL)
1495             txt = wx.StaticText(pan, -1, str(cl))
1496             siz.Add(txt, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5)
1497             pan.SetSizer(siz)
1498             self.sizer1.Add(pan, 0, wx.ALL|wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 5)
1499             pan = wx.Panel(self.spanel, -1, style=wx.SIMPLE_BORDER)
1500             siz = wx.BoxSizer(wx.VERTICAL)
1501             txt = wx.StaticText(pan, -1, str(chi))
1502             siz.Add(txt, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5)
1503             pan.SetSizer(siz)
1504             self.sizer1.Add(pan, 0, wx.ALL|wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 5)
1505             idbut = wx.NewId()
1506             self.formes[idbut] = [forme, cl]
1507             but = wx.Button(self.spanel, idbut, u"voir")
1508             self.sizer1.Add(but, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5)
1509             self.Bind(wx.EVT_BUTTON, self.showitem, but)
1510         self.button_1 = wx.Button(self, -1, "Fermer")
1511         self.Bind(wx.EVT_BUTTON, self.OnCloseMe, self.button_1)
1512         self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)
1513         self.__set_properties()
1514         self.__do_layout()
1515         # end wxGlade
1516     
1517     def __set_properties(self):
1518         self.SetTitle(_(u"Results").decode('utf8'))
1519         self.spanel.EnableScrolling(True,True)
1520         #self.panel_1.SetSize((1000,1000))
1521         self.spanel.SetScrollRate(20, 20)
1522         h = 60 * len(self.formes)
1523         if h > 600 :
1524             h = 600
1525         if h < 150 :
1526             h = 150
1527         self.SetSize(wx.Size(400,h))
1528
1529     def __do_layout(self):
1530         # begin wxGlade: MyFrame.__do_layout
1531         sizer_1 = wx.BoxSizer(wx.VERTICAL)
1532         sizer_2 = wx.BoxSizer(wx.VERTICAL)
1533         self.spanel.SetSizer(self.sizer1)
1534         sizer_1.Add(self.spanel, 4, wx.EXPAND, 0)
1535         sizer_1.Add(self.button_1, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ADJUST_MINSIZE, 0)
1536         #sizer_1.Add(sizer_2, 1, wx.EXPAND, 0)
1537         self.SetAutoLayout(True)
1538         self.SetSizer(sizer_1)
1539         self.Layout()
1540         # end wxGlade
1541
1542     def showitem(self, evt) :
1543         idb = evt.GetEventObject().GetId()
1544         nb = self.parent.nb
1545         profile = nb.GetPage(nb.GetSelection())
1546         cl = self.formes[idb][1] - 1
1547         forme = self.formes[idb][0]
1548         profile.ProfNB.SetSelection(cl)
1549         UnSelectList(profile.ProfNB.GetPage(cl))
1550         datas = dict([[profile.ProfNB.GetPage(cl).getColumnText(i,6),i] for i in range(profile.ProfNB.GetPage(cl).GetItemCount())])
1551         profile.ProfNB.GetPage(cl).SetItemState(datas[self.formes[idb][0]], wx.LIST_STATE_SELECTED, wx.LIST_STATE_SELECTED)
1552         profile.ProfNB.GetPage(cl).Focus(datas[forme])
1553         profile.ProfNB.GetPage(cl).SetFocus()
1554
1555     def OnCloseMe(self, evt) :
1556         self.Close(True)
1557
1558     def OnCloseWindow(self, evt):
1559         self.Destroy()
1560
1561 class SearchDial ( wx.Frame ):
1562     
1563     def __init__( self, parent, listctrl, col, shown):
1564         wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = wx.EmptyString, pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.DEFAULT_FRAME_STYLE )
1565         self.parent = parent
1566         self.listctrl = listctrl
1567         self.col = col
1568         self.shown = shown
1569         self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
1570         
1571         bSizer1 = wx.BoxSizer( wx.VERTICAL )
1572         
1573         self.search = wx.SearchCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.TE_PROCESS_ENTER )
1574         self.search.ShowSearchButton( True )
1575         self.search.ShowCancelButton( True )
1576         bSizer1.Add( self.search, 0, wx.ALL, 5 )
1577         sizer2 = wx.BoxSizer(wx.HORIZONTAL)
1578         self.backward = wx.Button(self, wx.ID_BACKWARD, _(u"Previous").decode('utf8'))
1579         self.forward = wx.Button(self, wx.ID_FORWARD, _(u"Next").decode('utf8'))
1580         sizer2.Add(self.backward, 0, wx.ALL, 5)
1581         sizer2.Add(self.forward, 0, wx.ALL, 5)
1582         bSizer1.Add( sizer2, 0, wx.ALL, 5 )
1583
1584         self.SetSizer( bSizer1 )
1585         self.Layout()
1586         bSizer1.Fit( self )
1587         self.Bind(wx.EVT_SEARCHCTRL_SEARCH_BTN, self.OnSearch, self.search)
1588         self.Bind(wx.EVT_SEARCHCTRL_CANCEL_BTN, self.OnCancel, self.search)
1589         self.Bind(wx.EVT_TEXT_ENTER, self.OnSearch, self.search)
1590         self.Bind(wx.EVT_BUTTON, self.onforward, self.forward)
1591         self.Bind(wx.EVT_BUTTON, self.onbackward, self.backward)
1592         self.search.SetFocus()
1593         self.forward.Enable(False)
1594         self.backward.Enable(False)
1595
1596         self.Centre( wx.BOTH )
1597     
1598     def __del__( self ):
1599         pass
1600
1601     def OnSearch(self, evt):
1602         UnSelectList(self.listctrl)
1603         search_word = self.search.GetValue()
1604         if search_word.strip() != '' :
1605             formes = [self.listctrl.getColumnText(i, self.col) for i in range(self.listctrl.GetItemCount())]
1606             if search_word.endswith(u'*') :
1607                 search_word = search_word[0:-1]
1608                 result = [j for j, forme in enumerate(formes) if forme.startswith(search_word)]
1609             else :
1610                 result = [j for j, forme in enumerate(formes) if forme == search_word]
1611             if result == [] :
1612                 self.noresult()
1613             elif self.shown == True :
1614                 self.showitems(result)
1615             else :
1616                 self.showresult(result)
1617         else :
1618             self.Destroy()
1619
1620     
1621     def showitems(self, items) :
1622         if len(items) == 1 :
1623             self.listctrl.SetItemState(items[0], wx.LIST_STATE_SELECTED, wx.LIST_STATE_SELECTED)
1624             self.listctrl.Focus(items[0])
1625             self.listctrl.SetFocus()
1626             self.Destroy()
1627         else :
1628             for i in items :
1629                 self.listctrl.SetItemState(i, wx.LIST_STATE_SELECTED, wx.LIST_STATE_SELECTED)
1630             self.listctrl.Focus(items[0])
1631             self.listctrl.SetFocus()
1632             self.forward.Enable(True)
1633             self.backward.Enable(False)
1634             self.items = items
1635             self.forwitem = 1
1636             self.backitem = -1
1637     
1638     def showresult(self, result) :
1639         toshow = [self.listctrl.itemDataMap[int(self.listctrl.getColumnText(i,0))] for i in result]
1640         proflist = [[[line[1], i+1, val] for i, val in enumerate(line[2:]) if val>=2] for line in toshow]
1641         #FIXME: intervenir en aval en virant les forme avec chi<2
1642         if proflist != [[]] :
1643             proflist = [val for line in proflist for val in line if line !=[]]
1644             nb = self.parent.parent.nb
1645             profile = nb.GetPage(nb.GetSelection())
1646             first_forme = proflist[0]
1647             cl = first_forme[1] - 1
1648             profile.ProfNB.SetSelection(cl)
1649             profile.ProfNB.GetPage(cl).SetFocus()
1650             UnSelectList(profile.ProfNB.GetPage(cl))
1651             datas = dict([[profile.ProfNB.GetPage(cl).getColumnText(i,6),i] for i in range(profile.ProfNB.GetPage(cl).GetItemCount())])
1652             profile.ProfNB.GetPage(cl).SetItemState(datas[first_forme[0]], wx.LIST_STATE_SELECTED, wx.LIST_STATE_SELECTED)
1653             profile.ProfNB.GetPage(cl).Focus(datas[first_forme[0]])
1654             profile.ProfNB.GetPage(cl).SetFocus()
1655             if len(proflist) == 1 :
1656                 self.Destroy()
1657             else :
1658                 SearchResult = FindInCluster(self.parent.parent, -1, proflist)
1659                 SearchResult.Show()
1660                 self.Destroy()
1661         else :
1662             self.noresult()
1663
1664     def onforward(self, evt) :
1665         self.listctrl.Focus(self.items[self.forwitem])
1666         self.listctrl.SetFocus()
1667         self.forwitem += 1
1668         if self.forwitem == len(self.items) :
1669             self.forward.Enable(False)
1670             self.backward.Enable(True)
1671             self.backitem += 1
1672         else :
1673             self.backitem += 1
1674             self.backward.Enable(True)
1675
1676     def onbackward(self, evt) :
1677         self.listctrl.Focus(self.items[self.backitem])
1678         self.listctrl.SetFocus()
1679         self.backitem -= 1
1680         if self.backitem == -1 :
1681             self.forwitem -= 1
1682             self.forward.Enable(True)
1683             self.backward.Enable(False)
1684         else :
1685             self.forwitem -= 1
1686             self.forward.Enable(True)
1687
1688     def noresult(self) :
1689         msg = _(u"Absent form").decode('utf8')
1690         dial = wx.MessageDialog(self, _(u"Absent form").decode('utf8'),_(u"Absent form").decode('utf8'), wx.OK | wx.ICON_INFORMATION)
1691         dial.CenterOnParent()
1692         dial.ShowModal()
1693         dial.Destroy()
1694
1695     def OnCancel(self, evt) :
1696         self.search.Clear()
1697
1698 def UnSelectList(liste) :
1699     if liste.GetFirstSelected() != -1 :
1700         last = liste.GetFirstSelected()
1701         liste.Select(liste.GetFirstSelected(), False)
1702         while liste.GetNextSelected(last) != -1 :
1703             last = liste.GetNextSelected(last)
1704             liste.Select(liste.GetFirstSelected(),False)
1705
1706
1707 class OptLexi(wx.Dialog):
1708     def __init__(self, parent, force_chi = False):
1709         # begin wxGlade: MyDialog.__init__
1710         #kwds["style"] = wx.DEFAULT_DIALOG_STYLE
1711         wx.Dialog.__init__(self, parent, style = wx.DEFAULT_DIALOG_STYLE)
1712         self.listet = None
1713         self.variables = None
1714         self.force_chi = force_chi
1715         #self.labellem =  wx.StaticText(self, -1, u"Lemmatisation : ")
1716         #self.checklem = wx.CheckBox(self, -1)
1717         if not self.force_chi :
1718             self.label_typeformes =  wx.StaticText(self, -1, _(u"Used forms").decode('utf8'))
1719             typeformeschoiceChoices = [ _(u"actives and supplementaries").decode('utf8'), _(u"actives").decode('utf8'), _(u"supplementaries").decode('utf8')]
1720             self.typeformes = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, typeformeschoiceChoices, 0 )
1721             self.typeformes.SetSelection( 0 )
1722
1723         self.label_var =  wx.StaticText(self, -1, _(u"Select by").decode('utf8'))
1724         self.choice = wx.Choice(self, -1, (100,50), choices = [_(u"variables").decode('utf8'), _(u"modalities").decode('utf8')])
1725         self.label1 =  wx.StaticText(self, -1, _(u"Choice").decode('utf8'))
1726         self.list_box_1 = wx.ListBox(self, -1, choices=[],  size = wx.Size( 150,200 ), style=wx.LB_EXTENDED | wx.LB_HSCROLL)
1727         self.button_2 = wx.Button(self, wx.ID_CANCEL, "")
1728         self.button_1 = wx.Button(self, wx.ID_OK, "")
1729         if not self.force_chi :
1730             indices = [_(u"hypergeometrical law").decode('utf8'), _(u"chi2").decode('utf8')]
1731         else :
1732             indices = [_(u"chi2").decode('utf8')]
1733         self.label_indice =  wx.StaticText(self, -1, _(u"Score").decode('utf8'))
1734         self.choice_indice =  wx.Choice(self, -1, (100,50), choices = indices)
1735         if not self.force_chi :
1736             self.label = wx.StaticText(self, -1, _(u"Minimum frequency").decode('utf8'))
1737             self.spin = wx.SpinCtrl(self, -1, min = 1, max = 10000, initial = 10)
1738         self.Bind(wx.EVT_CHOICE, self.onselect, self.choice)
1739         self.__set_properties()
1740         self.__do_layout()
1741         # end wxGlade
1742
1743     def __set_properties(self):
1744         # begin wxGlade: MyDialog.__set_properties
1745         self.SetTitle(_(u"Variables choice").decode('utf8'))
1746         if not self.force_chi :
1747             self.spin.SetValue(10)
1748         self.choice.SetSelection(0)
1749         self.choice_indice.SetSelection(0)
1750         #self.SetMinSize(wx.Size(300, 400))
1751         # end wxGlade
1752
1753     def __do_layout(self):
1754         # begin wxGlade: MyDialog.__do_layout
1755         sizer_1 = wx.BoxSizer(wx.VERTICAL)
1756         sizer_2 = wx.FlexGridSizer(0,2,0,0)
1757         sizer_3 = wx.BoxSizer(wx.HORIZONTAL)
1758         #sizer_2.Add(self.labellem, 0, wx.ALIGN_CENTER_VERTICAL, 3)
1759         #sizer_2.Add(self.checklem, 0, wx.ALIGN_CENTER_VERTICAL, 3)
1760         if not self.force_chi :
1761             sizer_2.Add(self.label_typeformes, 0, wx.ALIGN_CENTER_VERTICAL, 3)
1762             sizer_2.Add(self.typeformes, 0, wx.ALIGN_CENTER_VERTICAL, 3)
1763         sizer_2.Add(self.label_var, 0, wx.ALIGN_CENTER_VERTICAL, 3)
1764         sizer_2.Add(self.choice, 0, wx.ALIGN_CENTER_VERTICAL, 3)
1765         sizer_2.Add(self.label1, 0, wx.ALIGN_CENTER_VERTICAL, 3)
1766         sizer_2.Add(self.list_box_1, 0, wx.ALIGN_RIGHT, 3)
1767         sizer_3.Add(self.button_2, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 3)
1768         sizer_3.Add(self.button_1, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 3)
1769         sizer_2.Add(self.label_indice, 0, wx.ALIGN_CENTER_VERTICAL, 3)
1770         sizer_2.Add(self.choice_indice, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 3)
1771         if not self.force_chi :
1772             sizer_2.Add(self.label, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 3)
1773             sizer_2.Add(self.spin, 0, wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 3)
1774         sizer_1.Add(sizer_2, 0, wx.ALIGN_CENTER_HORIZONTAL, 3)
1775         sizer_1.Add(sizer_3, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_RIGHT, 3)
1776         self.SetSizer(sizer_1)
1777         sizer_1.Fit(self)
1778         self.Layout()
1779         self.Centre()
1780
1781     def onselect(self, evt):
1782         self.list_box_1.Clear()
1783         if self.choice.GetSelection() == 0 :
1784             for var in self.variables :
1785                 self.list_box_1.Append(var)
1786         else :
1787             for et in self.listet :
1788                 self.list_box_1.Append(et)
1789
1790
1791 class PrefDendro ( wx.Dialog ):
1792     
1793     def __init__( self, parent, param ):
1794         wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = _(u"Dendrogram").decode('utf8'), pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.DEFAULT_DIALOG_STYLE )
1795         self.param = param
1796         self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
1797         
1798         fgSizer1 = wx.FlexGridSizer( 0, 2, 0, 0 )
1799         fgSizer1.SetFlexibleDirection( wx.BOTH )
1800         fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
1801         
1802         self.m_staticText1 = wx.StaticText( self, wx.ID_ANY, _(u"Picture size").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
1803         self.m_staticText1.Wrap( -1 )
1804         fgSizer1.Add( self.m_staticText1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1805         
1806         bSizer2 = wx.BoxSizer( wx.VERTICAL )
1807         
1808         bSizer3 = wx.BoxSizer( wx.HORIZONTAL )
1809         
1810         self.m_staticText2 = wx.StaticText( self, wx.ID_ANY, _(u"height").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
1811         self.m_staticText2.Wrap( -1 )
1812         bSizer3.Add( self.m_staticText2, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1813         
1814         self.m_spinCtrl1 = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 50, 10000, 600 )
1815         bSizer3.Add( self.m_spinCtrl1, 0, wx.ALL, 5 )
1816         
1817         bSizer2.Add( bSizer3, 1, wx.EXPAND, 5 )
1818         
1819         bSizer31 = wx.BoxSizer( wx.HORIZONTAL )
1820         
1821         self.m_staticText3 = wx.StaticText( self, wx.ID_ANY, _(u"width").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
1822         self.m_staticText3.Wrap( -1 )
1823         bSizer31.Add( self.m_staticText3, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1824         
1825         self.m_spinCtrl2 = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 50, 10000, 600 )
1826         bSizer31.Add( self.m_spinCtrl2, 0, wx.ALL, 5 )
1827         
1828         bSizer2.Add( bSizer31, 1, wx.EXPAND, 5 )
1829         
1830         fgSizer1.Add( bSizer2, 1, wx.EXPAND, 5 )
1831         
1832         self.m_staticline1 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1833         fgSizer1.Add( self.m_staticline1, 0, wx.EXPAND |wx.ALL, 5 )
1834         
1835         self.m_staticline2 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1836         fgSizer1.Add( self.m_staticline2, 0, wx.EXPAND |wx.ALL, 5 )
1837         
1838         self.m_staticText4 = wx.StaticText( self, wx.ID_ANY, _(u"Dendrogram type").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
1839         self.m_staticText4.Wrap( -1 )
1840         fgSizer1.Add( self.m_staticText4, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1841         
1842         m_choice1Choices = [ u"phylogram", u"cladogram", u"fan", u"unrooted", u"radial" ]
1843         self.m_choice1 = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, m_choice1Choices, 0 )
1844         self.m_choice1.SetSelection( 0 )
1845         fgSizer1.Add( self.m_choice1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT|wx.ALL, 5 )
1846         
1847         self.m_staticline3 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1848         fgSizer1.Add( self.m_staticline3, 0, wx.EXPAND |wx.ALL, 5 )
1849         
1850         self.m_staticline4 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1851         fgSizer1.Add( self.m_staticline4, 0, wx.EXPAND |wx.ALL, 5 )
1852         
1853         self.m_staticText5 = wx.StaticText( self, wx.ID_ANY, _(u"Color or black and white").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
1854         self.m_staticText5.Wrap( -1 )
1855         fgSizer1.Add( self.m_staticText5, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1856         
1857         m_radioBox1Choices = [ _(u"color").decode('utf8'), _(u"black and white").decode('utf8') ]
1858         self.m_radioBox1 = wx.RadioBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, m_radioBox1Choices, 1, wx.RA_SPECIFY_COLS )
1859         self.m_radioBox1.SetSelection( 0 )
1860         fgSizer1.Add( self.m_radioBox1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT|wx.ALL, 5 )
1861         
1862         self.m_staticline5 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1863         fgSizer1.Add( self.m_staticline5, 0, wx.EXPAND |wx.ALL, 5 )
1864         
1865         self.m_staticline6 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1866         fgSizer1.Add( self.m_staticline6, 0, wx.EXPAND |wx.ALL, 5 )
1867         
1868         bSizer4 = wx.BoxSizer( wx.HORIZONTAL )
1869         
1870         self.m_staticText6 = wx.StaticText( self, wx.ID_ANY, _(u"Add cluster size").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
1871         self.m_staticText6.Wrap( -1 )
1872         bSizer4.Add( self.m_staticText6, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1873         
1874         self.m_checkBox1 = wx.CheckBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
1875         self.m_checkBox1.SetValue(True) 
1876         bSizer4.Add( self.m_checkBox1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1877         
1878         fgSizer1.Add( bSizer4, 1, wx.EXPAND, 5 )
1879         
1880         m_radioBox2Choices = [ _(u"circular diagram").decode('utf8'), _(u"bar").decode('utf8') ]
1881         self.m_radioBox2 = wx.RadioBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, m_radioBox2Choices, 1, wx.RA_SPECIFY_COLS )
1882         self.m_radioBox2.SetSelection( 0 )
1883         fgSizer1.Add( self.m_radioBox2, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT|wx.ALL, 5 )
1884         
1885         self.m_staticline7 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1886         fgSizer1.Add( self.m_staticline7, 0, wx.EXPAND |wx.ALL, 5 )
1887         
1888         self.m_staticline8 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1889         fgSizer1.Add( self.m_staticline8, 0, wx.EXPAND |wx.ALL, 5 )
1890         
1891         
1892         fgSizer1.AddSpacer( ( 0, 0), 1, wx.EXPAND, 5 )
1893         
1894         m_sdbSizer2 = wx.StdDialogButtonSizer()
1895         self.m_sdbSizer2OK = wx.Button( self, wx.ID_OK )
1896         m_sdbSizer2.AddButton( self.m_sdbSizer2OK )
1897         self.m_sdbSizer2Cancel = wx.Button( self, wx.ID_CANCEL )
1898         m_sdbSizer2.AddButton( self.m_sdbSizer2Cancel )
1899         m_sdbSizer2.Realize();
1900         fgSizer1.Add( m_sdbSizer2, 1, wx.EXPAND, 5 )
1901         
1902         self.__set_properties()
1903         self.SetSizer( fgSizer1 )
1904         self.Layout()
1905         fgSizer1.Fit( self )
1906         
1907         self.Centre( wx.BOTH )
1908
1909     def __set_properties(self):
1910         self.m_spinCtrl2.SetValue(self.param['width'])
1911         self.m_spinCtrl1.SetValue(self.param['height'])
1912         self.m_choice1.SetSelection(self.param['type_dendro'])
1913         self.m_radioBox1.SetSelection(self.param['color_nb'])
1914         self.m_checkBox1.SetValue(self.param['taille_classe'])
1915         self.m_radioBox2.SetSelection(self.param['type_tclasse'])
1916     
1917     def __del__( self ):
1918         pass
1919
1920
1921 class PrefWordCloud ( wx.Dialog ):
1922     
1923     def __init__( self, parent, fromcluster = False ):
1924         wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = _(u"Wordcloud settings").decode('utf8'), pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.DEFAULT_DIALOG_STYLE )
1925         
1926         self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
1927         
1928         fgSizer1 = wx.FlexGridSizer( 0, 2, 0, 0 )
1929         fgSizer1.SetFlexibleDirection( wx.BOTH )
1930         fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
1931         
1932         #self.m_staticText1 = wx.StaticText( self, wx.ID_ANY, u"Sélectionner les formes", wx.DefaultPosition, wx.DefaultSize, 0 )
1933         #self.m_staticText1.Wrap( -1 )
1934         #fgSizer1.Add( self.m_staticText1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
1935         
1936         #self.but_selectcol = wx.Button( self, wx.ID_ANY, u"Sélectionner", wx.DefaultPosition, wx.DefaultSize, 0 )
1937         #fgSizer1.Add( self.but_selectcol, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1938         
1939         #self.m_staticline1 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1940         #fgSizer1.Add( self.m_staticline1, 0, wx.EXPAND |wx.ALL, 5 )
1941         
1942         #self.m_staticline2 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1943         #fgSizer1.Add( self.m_staticline2, 0, wx.EXPAND |wx.ALL, 5 )
1944         
1945         bSizer1 = wx.BoxSizer( wx.HORIZONTAL )
1946         
1947         self.m_staticText3 = wx.StaticText( self, wx.ID_ANY, _(u"height").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
1948         self.m_staticText3.Wrap( -1 )
1949         bSizer1.Add( self.m_staticText3, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
1950         
1951         self.spin_H = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size( 100,30 ), wx.SP_ARROW_KEYS, 0, 10000, 600 )
1952         self.spin_H.SetValue( 800 )
1953         bSizer1.Add( self.spin_H, 0, wx.ALL, 5 )
1954         
1955         fgSizer1.Add( bSizer1, 1, wx.EXPAND, 5 )
1956         
1957         bSizer3 = wx.BoxSizer( wx.HORIZONTAL )
1958         
1959         self.m_staticText4 = wx.StaticText( self, wx.ID_ANY, _(u"width").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
1960         self.m_staticText4.Wrap( -1 )
1961         bSizer3.Add( self.m_staticText4, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
1962         
1963         self.spin_L = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size( 100,30 ), wx.SP_ARROW_KEYS, 0, 10000, 600 )
1964         self.spin_L.SetValue( 800 )
1965         bSizer3.Add( self.spin_L, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1966         
1967         fgSizer1.Add( bSizer3, 1, wx.EXPAND, 5 )
1968         
1969         self.m_staticline3 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1970         fgSizer1.Add( self.m_staticline3, 0, wx.EXPAND |wx.ALL, 5 )
1971         
1972         self.m_staticline4 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1973         fgSizer1.Add( self.m_staticline4, 0, wx.EXPAND |wx.ALL, 5 )
1974         
1975         self.m_staticText11 = wx.StaticText( self, wx.ID_ANY, _(u"Picture format").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
1976         self.m_staticText11.Wrap( -1 )
1977         fgSizer1.Add( self.m_staticText11, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1978         
1979         formatChoices = [ u"png", u"svg" ]
1980         self.format = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, formatChoices, 0 )
1981         self.format.SetSelection( 0 )
1982         fgSizer1.Add( self.format, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1983
1984         if fromcluster :
1985             self.m_staticText111 = wx.StaticText( self, wx.ID_ANY, _(u"Word size proportional to ...").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
1986             self.m_staticText11.Wrap( -1 )
1987             fgSizer1.Add( self.m_staticText111, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1988         
1989             IndiceChoices = [ _(u"chi2").decode('utf8'), _(u"frequency").decode('utf8') ]
1990             self.indice = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, IndiceChoices, 0 )
1991             self.indice.SetSelection( 0 )
1992             fgSizer1.Add( self.indice, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1993
1994         self.m_staticline13 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1995         fgSizer1.Add( self.m_staticline13, 0, wx.EXPAND |wx.ALL, 5 )
1996         
1997         self.m_staticline14 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1998         fgSizer1.Add( self.m_staticline14, 0, wx.EXPAND |wx.ALL, 5 )
1999
2000         self.m_staticText5 = wx.StaticText( self, wx.ID_ANY, _(u"Maximum number of forms").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2001         self.m_staticText5.Wrap( -1 )
2002         fgSizer1.Add( self.m_staticText5, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2003         
2004         self.spin_maxword = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 0, 10000, 600 )
2005         self.spin_maxword.SetValue( 600 )
2006         fgSizer1.Add( self.spin_maxword, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2007         
2008         self.m_staticline5 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
2009         fgSizer1.Add( self.m_staticline5, 0, wx.EXPAND |wx.ALL, 5 )
2010         
2011         self.m_staticline6 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
2012         fgSizer1.Add( self.m_staticline6, 0, wx.EXPAND |wx.ALL, 5 )
2013         
2014         self.typeformes = wx.StaticText( self, wx.ID_ANY, _(u"Used forms").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2015         self.typeformes.Wrap( -1 )
2016         fgSizer1.Add( self.typeformes, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2017         
2018         typeformeschoiceChoices = [ _(u"actives").decode('utf8'), _(u"supplementaries").decode('utf8'), _(u"actives and supplementaries").decode('utf8') ]
2019         self.typeformeschoice = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, typeformeschoiceChoices, 0 )
2020         self.typeformeschoice.SetSelection( 0 )
2021         fgSizer1.Add( self.typeformeschoice, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2022         
2023         self.m_staticline11 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
2024         fgSizer1.Add( self.m_staticline11, 0, wx.EXPAND |wx.ALL, 5 )
2025         
2026         self.m_staticline12 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
2027         fgSizer1.Add( self.m_staticline12, 0, wx.EXPAND |wx.ALL, 5 )        
2028         
2029         self.m_staticText6 = wx.StaticText( self, wx.ID_ANY, _(u"Text size").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2030         self.m_staticText6.Wrap( -1 )
2031         fgSizer1.Add( self.m_staticText6, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2032         
2033         bSizer4 = wx.BoxSizer( wx.VERTICAL )
2034         
2035         bSizer5 = wx.BoxSizer( wx.HORIZONTAL )
2036         
2037         self.m_staticText7 = wx.StaticText( self, wx.ID_ANY, u"Min", wx.DefaultPosition, wx.DefaultSize, 0 )
2038         self.m_staticText7.Wrap( -1 )
2039         bSizer5.Add( self.m_staticText7, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2040         
2041         self.spin_mincex = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 0, 1000, 5 )
2042         self.spin_mincex.SetValue( 5 )
2043         bSizer5.Add( self.spin_mincex, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT|wx.ALL, 5 )
2044         
2045         bSizer4.Add( bSizer5, 1, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.EXPAND, 5 )
2046         
2047         bSizer6 = wx.BoxSizer( wx.HORIZONTAL )
2048         
2049         self.m_staticText8 = wx.StaticText( self, wx.ID_ANY, u"Max", wx.DefaultPosition, wx.DefaultSize, 0 )
2050         self.m_staticText8.Wrap( -1 )
2051         bSizer6.Add( self.m_staticText8, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2052         
2053         self.spin_maxcex = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 0, 1000, 50 )
2054         self.spin_maxcex.SetValue( 50 )
2055         bSizer6.Add( self.spin_maxcex, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2056         
2057         bSizer4.Add( bSizer6, 1, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.EXPAND, 5 )
2058         
2059         fgSizer1.Add( bSizer4, 1, wx.EXPAND, 5 )
2060         
2061         self.m_staticline7 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
2062         fgSizer1.Add( self.m_staticline7, 0, wx.EXPAND |wx.ALL, 5 )
2063         
2064         self.m_staticline8 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
2065         fgSizer1.Add( self.m_staticline8, 0, wx.EXPAND |wx.ALL, 5 )
2066         
2067         bSizer61 = wx.BoxSizer( wx.HORIZONTAL )
2068         
2069         self.m_staticText81 = wx.StaticText( self, wx.ID_ANY, _(u"Text color").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2070         self.m_staticText81.Wrap( -1 )
2071         bSizer61.Add( self.m_staticText81, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2072         
2073         self.color_text = wx.ColourPickerCtrl( self, wx.ID_ANY, wx.BLACK, wx.DefaultPosition, wx.DefaultSize, wx.CLRP_DEFAULT_STYLE )
2074         bSizer61.Add( self.color_text, 0, wx.ALL, 5 )
2075         
2076         fgSizer1.Add( bSizer61, 1, wx.EXPAND, 5 )
2077         
2078         bSizer7 = wx.BoxSizer( wx.HORIZONTAL )
2079         
2080         self.m_staticText9 = wx.StaticText( self, wx.ID_ANY, _(u"Background color").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2081         self.m_staticText9.Wrap( -1 )
2082         bSizer7.Add( self.m_staticText9, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2083         
2084         self.color_bg = wx.ColourPickerCtrl( self, wx.ID_ANY, (255,255,255), wx.DefaultPosition, wx.DefaultSize, wx.CLRP_DEFAULT_STYLE )
2085         bSizer7.Add( self.color_bg, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2086         
2087         fgSizer1.Add( bSizer7, 1, wx.EXPAND, 5 )
2088         
2089         self.m_staticline9 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
2090         fgSizer1.Add( self.m_staticline9, 0, wx.EXPAND |wx.ALL, 5 )
2091         
2092         self.m_staticline10 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
2093         fgSizer1.Add( self.m_staticline10, 0, wx.EXPAND |wx.ALL, 5 )
2094
2095         fgSizer1.AddSpacer( ( 0, 0), 1, wx.EXPAND, 5 )
2096         
2097         m_sdbSizer1 = wx.StdDialogButtonSizer()
2098         self.m_sdbSizer1OK = wx.Button( self, wx.ID_OK )
2099         m_sdbSizer1.AddButton( self.m_sdbSizer1OK )
2100         self.m_sdbSizer1Cancel = wx.Button( self, wx.ID_CANCEL )
2101         m_sdbSizer1.AddButton( self.m_sdbSizer1Cancel )
2102         m_sdbSizer1.Realize();
2103         fgSizer1.Add( m_sdbSizer1, 1, wx.EXPAND, 5 )
2104         
2105         self.SetSizer( fgSizer1 )
2106         self.Layout()
2107         fgSizer1.Fit( self )
2108         
2109         self.Centre( wx.BOTH )
2110     
2111     def __del__( self ):
2112         pass
2113     
2114 class PrefChi(sc.SizedDialog):
2115     def __init__(self, parent, ID, optionchi, title):
2116
2117         sc.SizedDialog.__init__(self, None, -1, _(u"Settings").decode('utf8'), 
2118                         style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER)
2119         pane = self.GetContentsPane()
2120         pane.SetSizerType("form")
2121         pane.SetSizerProps(border=("all",5))
2122         self.parent = parent
2123         self.optionchi = optionchi
2124         
2125
2126         self.label_obs = wx.StaticText(pane, -1, _(u"observed values").decode('utf8'))
2127         self.check1 = wx.CheckBox(pane, -1)
2128  
2129         self.label_theo = wx.StaticText(pane, -1, _(u"expected values").decode('utf8'))
2130         self.check2 = wx.CheckBox(pane, -1)
2131
2132         self.label_resi = wx.StaticText(pane, -1, _(u"residuals").decode('utf8'))
2133         self.check3 = wx.CheckBox(pane, -1)
2134
2135         self.label_contrib = wx.StaticText(pane, -1, _(u"standardized residuals").decode('utf8'))
2136         self.check4 = wx.CheckBox(pane, -1)
2137 #        self.label_graph = wx.StaticText(pane, -1, u'graphique')
2138 #        self.check8 = wx.CheckBox(pane, -1)
2139         self.label_pourcent = wx.StaticText(pane, -1, _(u"total percentage").decode('utf8'))
2140         self.check5 = wx.CheckBox(pane, -1)
2141
2142         self.label_prl = wx.StaticText(pane, -1, _(u"row percentage").decode('utf8'))
2143         self.check6 = wx.CheckBox(pane, -1)
2144
2145         self.label_prc = wx.StaticText(pane, -1, _(u"column percentage").decode('utf8'))
2146         self.check7 = wx.CheckBox(pane, -1)
2147
2148         self.label_graph = wx.StaticText(pane, -1, _(u"graphical").decode('utf8'))
2149         self.check8 = wx.CheckBox(pane, -1)
2150         
2151         self.label_graphbw = wx.StaticText(pane, -1, _(u"black and white graphical").decode('utf8'))
2152         self.checkbw = wx.CheckBox(pane, -1)
2153
2154         self.SetButtonSizer(self.CreateStdDialogButtonSizer(wx.OK | wx.CANCEL))
2155
2156         self.__set_properties()
2157         self.Fit()
2158         self.SetMinSize(self.GetSize())
2159
2160     def __set_properties(self):
2161         self.check1.SetValue(self.optionchi['valobs'])
2162         self.check2.SetValue(self.optionchi['valtheo'])
2163         self.check3.SetValue(self.optionchi['resi'])
2164         self.check4.SetValue(self.optionchi['contrib'])
2165         self.check5.SetValue(self.optionchi['pourcent'])
2166         self.check6.SetValue(self.optionchi['pourcentl'])
2167         self.check7.SetValue(self.optionchi['pourcentc'])
2168         self.check8.SetValue(self.optionchi['graph'])
2169         self.checkbw.SetValue(self.optionchi['bw'])
2170
2171 class ChiDialog(wx.Dialog):
2172     def __init__(
2173             self, parent, ID, title, optionchi, tableau, size=wx.DefaultSize, pos=wx.DefaultPosition, 
2174             style=wx.DEFAULT_DIALOG_STYLE
2175             ):
2176
2177         pre = wx.PreDialog()
2178         pre.SetExtraStyle(wx.DIALOG_EX_CONTEXTHELP)
2179         pre.Create(parent, ID, title, pos, size, style)
2180
2181         self.PostCreate(pre)
2182         self.parent = parent 
2183         self.optionchi = optionchi
2184         self.chiopt = False
2185         self.tableau = tableau
2186         #self.Filename=parent.filename
2187         #self.content=parent.content[:]
2188         self.headers=self.tableau.get_colnames()
2189         LABELLIST=[]
2190         
2191         for i in self.headers:
2192             if len(i)>60 :
2193                 LABELLIST.append(i[0:60])
2194             else:
2195                 LABELLIST.append(i)
2196         
2197         self.ListOK=[]
2198         self.LabelListOK=LABELLIST
2199  
2200         self.list_box_1 = wx.ListBox(self, -1, choices=self.LabelListOK, style=wx.LB_EXTENDED|wx.LB_HSCROLL)
2201         self.list_box_2 = wx.ListBox(self, -1, choices=self.LabelListOK, style=wx.LB_EXTENDED|wx.LB_HSCROLL)
2202         self.button_1 = wx.Button(self, wx.ID_OK)
2203         self.button_cancel = wx.Button(self, wx.ID_CANCEL)
2204         self.button_pref = wx.Button(self, wx.ID_PREFERENCES)
2205         self.__set_properties()
2206         self.__do_layout()
2207
2208         self.Bind(wx.EVT_LISTBOX, self.Select1, self.list_box_1)
2209         self.Bind(wx.EVT_BUTTON, self.onparam, self.button_pref)
2210         # end wxGlade
2211 #-------------------------------
2212     def __set_properties(self):
2213         # begin wxGlade: ConfChi2.__set_properties
2214         self.SetTitle(_(u"Variables selection").decode('utf8'))
2215
2216     def __do_layout(self):
2217         # begin wxGlade: ConfChi2.__do_layout
2218         sizer_1 = wx.BoxSizer(wx.VERTICAL)
2219         sizer_2 = wx.BoxSizer(wx.VERTICAL)
2220         sizer_3 = wx.BoxSizer(wx.HORIZONTAL)
2221         sizer_4 = wx.BoxSizer(wx.HORIZONTAL)
2222         sizer_3.Add(self.list_box_1, 0, wx.EXPAND, 0)
2223         sizer_3.Add(self.list_box_2, 0, wx.EXPAND|wx.ALIGN_CENTER_HORIZONTAL, 0)
2224         sizer_2.Add(sizer_3, 1, wx.EXPAND, 0)
2225         sizer_4.Add(self.button_cancel, 0, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL, 0)
2226         sizer_4.Add(self.button_pref, 0, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL, 0)
2227         sizer_4.Add(self.button_1, 0, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL, 0)
2228         sizer_2.Add(sizer_4, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL, 0)
2229         sizer_1.Add(sizer_2, 1, wx.EXPAND, 0)
2230         self.SetSizer(sizer_1)
2231         sizer_1.Fit(self)
2232         self.Layout()
2233         # end wxGlade
2234
2235     def Select1(self, event): # wxGlade: ConfChi2.<event_handler>
2236         event.Skip()
2237     
2238     
2239     def onparam(self,event):
2240         self.dial = PrefChi(self.parent, -1, self.optionchi, '')
2241         self.dial.CenterOnParent()
2242         self.chiopt = self.dial.ShowModal()
2243
2244 class CorpusPref ( wx.Dialog ):
2245     
2246     def __init__( self, parent, parametres ):
2247         wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = _(u"Settings").decode('utf8'), pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.DEFAULT_DIALOG_STYLE )
2248         self.parent = parent 
2249         langues_n = [u'français', u'english', u'german (expérimentale)', u'italian', u'swedish (expérimentale)', u'portuguese (expérimentale)', u'spanish (expérimentale)', u'greek (expériementale)', u'galician (expérimentale)', u'autre...']
2250         self.langues = [u'french', u'english', u'german', u'italian', u'swedish', u'portuguese', u'spanish', u'greek', u'galician', u'other']
2251         self.encodages = [enc[0].lower() for enc in encodages]
2252
2253         ucimark = [u'****', u'0000']
2254         ucemethod = [_(u"characters").decode('utf8'), _(u"occurrences").decode('utf8'), _(u"paragraphs").decode('utf8')]
2255
2256         self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
2257         
2258         bSizer1 = wx.BoxSizer( wx.VERTICAL )
2259         
2260         self.m_notebook1 = wx.Notebook( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, 0 )
2261         self.m_panel1 = wx.Panel( self.m_notebook1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
2262         fgSizer1 = wx.FlexGridSizer( 0, 2, 0, 0 )
2263         fgSizer1.SetFlexibleDirection( wx.BOTH )
2264         fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
2265         
2266         self.m_staticText7 = wx.StaticText( self.m_panel1, wx.ID_ANY, _(u"Corpora").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2267         self.m_staticText7.Wrap( -1 )
2268         fgSizer1.Add( self.m_staticText7, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2269         
2270         self.txtpath = wx.StaticText( self.m_panel1, wx.ID_ANY, _(u"Path").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2271         self.txtpath.Wrap( -1 )
2272         fgSizer1.Add( self.txtpath, 0, wx.ALL, 5 )
2273
2274         self.m_staticText18 = wx.StaticText( self.m_panel1, wx.ID_ANY, u"Corpus' name", wx.DefaultPosition, wx.DefaultSize, 0 )
2275         self.m_staticText18.Wrap( -1 )
2276         fgSizer1.Add( self.m_staticText18, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2277         
2278         self.corpusname = wx.TextCtrl( self.m_panel1, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size( 200,-1 ), 0 )
2279         fgSizer1.Add( self.corpusname, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2280              
2281         self.m_staticText1 = wx.StaticText( self.m_panel1, wx.ID_ANY, _(u"Characters set").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2282         self.m_staticText1.Wrap( -1 )
2283         fgSizer1.Add( self.m_staticText1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2284         
2285         encodage_choicesChoices = [' - '.join(encodage) for encodage in encodages]
2286         self.encodage_choices = wx.Choice( self.m_panel1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, encodage_choicesChoices, 0 )
2287         self.encodage_choices.SetSelection( 0 )
2288         fgSizer1.Add( self.encodage_choices, 0, wx.ALL, 5 )
2289         
2290         self.m_staticText2 = wx.StaticText( self.m_panel1, wx.ID_ANY, _(u"Language").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2291         self.m_staticText2.Wrap( -1 )
2292         fgSizer1.Add( self.m_staticText2, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2293         
2294         lang_choicesChoices = langues_n
2295         self.lang_choices = wx.Choice( self.m_panel1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, lang_choicesChoices, 0 )
2296         self.lang_choices.SetSelection( 0 )
2297         fgSizer1.Add( self.lang_choices, 0, wx.ALL, 5 )
2298
2299         self.m_staticText19 = wx.StaticText( self.m_panel1, wx.ID_ANY, u"Dictionary", wx.DefaultPosition, wx.DefaultSize, 0 )
2300         self.m_staticText19.Wrap( -1 )
2301         fgSizer1.Add( self.m_staticText19, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2302         
2303         bSizer2 = wx.BoxSizer( wx.HORIZONTAL )
2304         
2305         fgSizer5 = wx.FlexGridSizer( 2, 2, 0, 0 )
2306         fgSizer5.SetFlexibleDirection( wx.BOTH )
2307         fgSizer5.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
2308         
2309         self.radio_default_dict = wx.RadioButton( self.m_panel1, wx.ID_ANY, u"Default", wx.DefaultPosition, wx.DefaultSize, 0 )
2310         fgSizer5.Add( self.radio_default_dict, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2311         
2312         self.defaultdictpath = wx.TextCtrl( self.m_panel1, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size( 300,-1 ), wx.TE_READONLY )
2313         self.defaultdictpath.Enable( False )
2314         
2315         fgSizer5.Add( self.defaultdictpath, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2316         
2317         self.radio_other_dict = wx.RadioButton( self.m_panel1, wx.ID_ANY, u"Other", wx.DefaultPosition, wx.DefaultSize, 0 )
2318         fgSizer5.Add( self.radio_other_dict, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2319         
2320         self.otherdictpath = wx.FilePickerCtrl( self.m_panel1, wx.ID_ANY, wx.EmptyString, u"Select a file", u"*.*", wx.DefaultPosition, wx.Size( 300,-1 ), wx.FLP_DEFAULT_STYLE )
2321         fgSizer5.Add( self.otherdictpath, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2322         
2323         
2324         bSizer2.Add( fgSizer5, 1, wx.EXPAND, 5 )
2325         
2326         
2327         fgSizer1.Add( bSizer2, 1, wx.EXPAND, 5 )
2328
2329         self.m_staticText3 = wx.StaticText( self.m_panel1, wx.ID_ANY, _(u"Output folder").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2330         self.m_staticText3.Wrap( -1 )
2331         fgSizer1.Add( self.m_staticText3, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2332         
2333         
2334         fgSizer41 = wx.FlexGridSizer( 0, 2, 0, 0 )
2335         fgSizer41.SetFlexibleDirection( wx.BOTH )
2336         fgSizer41.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
2337         
2338         self.repout_choices = wx.TextCtrl( self.m_panel1, wx.ID_ANY, u"MyLabel", wx.DefaultPosition, wx.DefaultSize, 0 )
2339         self.repout_choices.SetMinSize( wx.Size( 400,-1 ) )
2340         fgSizer41.Add( self.repout_choices, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2341         
2342         self.m_button1 = wx.Button( self.m_panel1, wx.ID_ANY, _(u"Change ...").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2343         fgSizer41.Add( self.m_button1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2344         
2345         fgSizer1.Add( fgSizer41, 1, wx.EXPAND, 5 )        
2346
2347         self.m_staticText12 = wx.StaticText( self.m_panel1, wx.ID_ANY, _(u"Text mark").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2348         self.m_staticText12.Wrap( -1 )
2349         fgSizer1.Add( self.m_staticText12, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2350         
2351         ucimark_choicesChoices = ucimark
2352         self.ucimark_choices = wx.Choice( self.m_panel1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, ucimark_choicesChoices, 0 )
2353         self.ucimark_choices.SetSelection( 0 )
2354         fgSizer1.Add( self.ucimark_choices, 0, wx.ALL, 5 )
2355         
2356         self.m_staticText6 = wx.StaticText( self.m_panel1, wx.ID_ANY, _(u"Use the expression dictionary").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2357         self.m_staticText6.Wrap( -1 )
2358         fgSizer1.Add( self.m_staticText6, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2359         
2360         self.check_expressions = wx.CheckBox( self.m_panel1, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
2361         self.check_expressions.SetValue(True) 
2362         fgSizer1.Add( self.check_expressions, 0, wx.ALL, 5 )
2363         
2364         self.m_staticText9 = wx.StaticText( self.m_panel1, wx.ID_ANY, _(u"Make text segments").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2365         self.m_staticText9.Wrap( -1 )
2366         fgSizer1.Add( self.m_staticText9, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2367         
2368         self.check_makeuce = wx.CheckBox( self.m_panel1, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
2369         self.check_makeuce.SetValue(True) 
2370         fgSizer1.Add( self.check_makeuce, 0, wx.ALL, 5 )
2371         
2372         self.m_staticText10 = wx.StaticText( self.m_panel1, wx.ID_ANY, _(u"Text segments build process").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2373         self.m_staticText10.Wrap( -1 )
2374         fgSizer1.Add( self.m_staticText10, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2375         
2376         uce_modeChoices = ucemethod
2377         self.uce_mode = wx.Choice( self.m_panel1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, uce_modeChoices, 0 )
2378         self.uce_mode.SetSelection( 0 )
2379         fgSizer1.Add( self.uce_mode, 0, wx.ALL, 5 )
2380         
2381         self.m_staticText13 = wx.StaticText( self.m_panel1, wx.ID_ANY, _(u"Text segments size").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2382         self.m_staticText13.Wrap( -1 )
2383         fgSizer1.Add( self.m_staticText13, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2384         
2385         self.uce_size = wx.SpinCtrl( self.m_panel1, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 1, 1000000, 40 )
2386         fgSizer1.Add( self.uce_size, 0, wx.ALL, 5 )
2387         
2388         
2389         self.m_panel1.SetSizer( fgSizer1 )
2390         self.m_panel1.Layout()
2391         fgSizer1.Fit( self.m_panel1 )
2392         self.m_notebook1.AddPage( self.m_panel1, _(u"General").decode('utf8'), True )
2393         self.m_panel2 = wx.Panel( self.m_notebook1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
2394         fgSizer3 = wx.FlexGridSizer( 0, 2, 0, 0 )
2395         fgSizer3.SetFlexibleDirection( wx.BOTH )
2396         fgSizer3.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
2397         
2398         self.m_staticText4 = wx.StaticText( self.m_panel2, wx.ID_ANY, _(u"Put text in lowercase").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2399         self.m_staticText4.Wrap( -1 )
2400         fgSizer3.Add( self.m_staticText4, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2401         
2402         self.check_lower = wx.CheckBox( self.m_panel2, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
2403         self.check_lower.SetValue(True) 
2404         fgSizer3.Add( self.check_lower, 0, wx.ALL, 5 )
2405         
2406         self.m_staticText5 = wx.StaticText( self.m_panel2, wx.ID_ANY, _(u"Delete characters not in this list").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2407         self.m_staticText5.Wrap( -1 )
2408         fgSizer3.Add( self.m_staticText5, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2409         
2410         fgSizer4 = wx.FlexGridSizer( 0, 2, 0, 0 )
2411         fgSizer4.SetFlexibleDirection( wx.BOTH )
2412         fgSizer4.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
2413         
2414         self.check_charact = wx.CheckBox( self.m_panel2, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
2415         self.check_charact.SetValue(True) 
2416         fgSizer4.Add( self.check_charact, 0, wx.ALL, 5 )
2417         
2418         self.txt_charact = wx.TextCtrl( self.m_panel2, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
2419         self.txt_charact.SetMinSize( wx.Size( 400,-1 ) )
2420         
2421         fgSizer4.Add( self.txt_charact, 0, wx.ALL|wx.EXPAND, 5 )
2422         
2423         
2424         fgSizer3.Add( fgSizer4, 1, wx.ALIGN_CENTER_VERTICAL|wx.EXPAND, 5 )
2425         
2426         self.m_staticText14 = wx.StaticText( self.m_panel2, wx.ID_ANY, _(u"Replace apostrophe by space").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2427         self.m_staticText14.Wrap( -1 )
2428         fgSizer3.Add( self.m_staticText14, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2429         
2430         self.check_apos = wx.CheckBox( self.m_panel2, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
2431         self.check_apos.SetValue(True) 
2432         fgSizer3.Add( self.check_apos, 0, wx.ALL, 5 )
2433         
2434         self.m_staticText15 = wx.StaticText( self.m_panel2, wx.ID_ANY, _(u"Replace dash by space").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2435         self.m_staticText15.Wrap( -1 )
2436         fgSizer3.Add( self.m_staticText15, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2437         
2438         self.check_tirets = wx.CheckBox( self.m_panel2, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
2439         self.check_tirets.SetValue(True) 
2440         fgSizer3.Add( self.check_tirets, 0, wx.ALL, 5 )
2441         
2442         self.m_staticText17 = wx.StaticText( self.m_panel2, wx.ID_ANY, _(u"Keep punctuation").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2443         self.m_staticText17.Wrap( -1 )
2444         fgSizer3.Add( self.m_staticText17, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2445         
2446         self.check_ponct = wx.CheckBox( self.m_panel2, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
2447         fgSizer3.Add( self.check_ponct, 0, wx.ALL, 5 )
2448
2449         self.m_staticText16 = wx.StaticText( self.m_panel2, wx.ID_ANY, _(u"No space between two forms").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2450         self.m_staticText16.Wrap( -1 )
2451         fgSizer3.Add( self.m_staticText16, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2452         
2453         self.check_tolist = wx.CheckBox( self.m_panel2, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
2454         fgSizer3.Add( self.check_tolist, 0, wx.ALL, 5 )
2455         
2456         
2457         self.m_panel2.SetSizer( fgSizer3 )
2458         self.m_panel2.Layout()
2459         fgSizer3.Fit( self.m_panel2 )
2460         self.m_notebook1.AddPage( self.m_panel2, _(u"Cleaning").decode('utf8'), False )
2461         
2462         bSizer1.Add( self.m_notebook1, 1, wx.EXPAND |wx.ALL, 5 )
2463         
2464         m_sdbSizer1 = wx.StdDialogButtonSizer()
2465         self.m_sdbSizer1OK = wx.Button( self, wx.ID_OK )
2466         m_sdbSizer1.AddButton( self.m_sdbSizer1OK )
2467         self.m_sdbSizer1Cancel = wx.Button( self, wx.ID_CANCEL )
2468         m_sdbSizer1.AddButton( self.m_sdbSizer1Cancel )
2469         m_sdbSizer1.Realize();
2470         
2471         bSizer1.Add( m_sdbSizer1, 0, wx.EXPAND, 5 )
2472        
2473
2474         # Connect Events
2475         self.Bind(wx.EVT_BUTTON, self.OnChangeDir, self.m_button1)
2476         self.lang_choices.Bind( wx.EVT_CHOICE, self.OnChangeLangage )
2477         self.radio_other_dict.Bind( wx.EVT_RADIOBUTTON, self.changedictchoice )        
2478
2479         self.setparametres(parametres) 
2480         self.SetSizer( bSizer1 )
2481         self.Layout()
2482         bSizer1.Fit( self )
2483         
2484         self.Centre( wx.BOTH )
2485
2486     def OnChangeDir(self, evt) :
2487         dlg = wx.DirDialog(self.parent, _(u"Choose a folder").decode('utf8'), style = wx.DD_DEFAULT_STYLE)
2488         if dlg.ShowModal() == wx.ID_OK :
2489             self.repout_choices.SetValue(dlg.GetPath())
2490     
2491     def __del__( self ):
2492         pass
2493
2494     def setparametres(self, parametres) :
2495         if  locale.getpreferredencoding().lower() == 'mac-roman' :
2496             enc = self.encodages.index('macroman')
2497         else :
2498             try :
2499                 enc = self.encodages.index(locale.getpreferredencoding().lower())
2500             except ValueError :
2501                 enc = self.encodages.index('utf-8')
2502         self.encodage_choices.SetSelection(enc)
2503         self.lang_choices.SetSelection(0)
2504         self.repout_choices.SetValue(parametres['pathout'])
2505         self.ucimark_choices.SetSelection(parametres['ucimark'])
2506         self.check_expressions.SetValue(parametres['expressions'])
2507         self.check_makeuce.SetValue(parametres['douce'])
2508         self.uce_mode.SetSelection(parametres['ucemethod'])
2509         self.uce_size.SetValue(parametres['ucesize'])
2510         self.check_lower.SetValue(parametres['lower'])
2511         #self.check_charact.SetValue(parametres['charact'])
2512         self.txt_charact.SetValue(parametres['keep_caract'])
2513         self.check_apos.SetValue(parametres['apos'])
2514         self.check_tirets.SetValue(parametres['tiret'])
2515         self.check_tolist.SetValue(parametres['tolist'])
2516         self.check_ponct.SetValue(parametres['keep_ponct'])
2517
2518     def doparametres(self) :
2519         parametres = {}
2520         parametres['encoding'] = encodages[self.encodage_choices.GetSelection()][0]
2521         parametres['lang'] = self.langues[self.lang_choices.GetSelection()]
2522         parametres['pathout'] = self.repout_choices.GetValue()
2523         parametres['ucimark'] = self.ucimark_choices.GetSelection()
2524         parametres['expressions'] = self.check_expressions.GetValue()
2525         parametres['douce'] =  self.check_makeuce.GetValue()
2526         parametres['ucemethod'] = self.uce_mode.GetSelection()
2527         parametres['ucesize'] = self.uce_size.GetValue()
2528         parametres['lower'] = self.check_lower.GetValue()
2529         parametres['charact'] = self.check_charact.GetValue()
2530         parametres['keep_caract'] = self.txt_charact.GetValue()
2531         parametres['apos'] = self.check_apos.GetValue()
2532         parametres['tiret'] = self.check_tirets.GetValue()
2533         parametres['tolist'] = self.check_tolist.GetValue()
2534         parametres['keep_ponct'] = self.check_ponct.GetValue()
2535         for val in parametres :
2536             if isinstance(parametres[val], bool) :
2537                 if parametres[val] :
2538                     parametres[val] = 1
2539                 else :
2540                     parametres[val] = 0
2541         return parametres
2542     
2543     def OnChangeLangage(self, evt):
2544         pass
2545     
2546     def changedictchoice(self, evt):
2547         pass
2548
2549
2550 class ConcordList(wx.HtmlListBox):
2551     def __init__(self, parent, concord):
2552         self.concord = concord
2553         #self.script_status = dict()
2554         wx.HtmlListBox.__init__(self, parent, -1, size = (900, 600))
2555         self.SetItemCount(len(concord))
2556         #self.Bind(wx.EVT_LISTBOX, self.RefreshMe)
2557         #self.Bind(wx.EVT_LISTBOX_DCLICK, self.Download)
2558   
2559     def OnGetItem(self, index):
2560         return self.concord[index] + '<br>'
2561
2562 class message(wx.Dialog):
2563     def __init__(self, parent, items, title, size, save = True):
2564         wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = title, pos = wx.DefaultPosition, size = size, style = wx.DEFAULT_DIALOG_STYLE|wx.STAY_ON_TOP )
2565         self.save = save    
2566         self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
2567
2568         self.html = ""
2569         #self.HtmlPage=wx.html.HtmlWindow(self, -1)
2570         self.HtmlPage = ConcordList(self, items)
2571         #self.HtmlPage.SetMinSize( size )
2572         #if "gtk2" in wx.PlatformInfo:
2573         #    self.HtmlPage.SetStandardFonts()
2574         #self.HtmlPage.SetFonts('Courier','Courier')
2575
2576         self.button_1 = wx.Button(self, wx.ID_CANCEL)
2577
2578         self.Bind(wx.EVT_BUTTON, self.OnCloseMe, self.button_1)
2579         if self.save :
2580             self.button_2 = wx.Button(self, wx.ID_SAVE)
2581             self.Bind(wx.EVT_BUTTON, self.OnSavePage, self.button_2)
2582         self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)
2583         self.__do_layout()
2584
2585     def __do_layout(self):
2586         sizer_2 = wx.BoxSizer(wx.VERTICAL)
2587         sizer_2.Add(self.HtmlPage, 0, wx.EXPAND|wx.ADJUST_MINSIZE, 0)
2588         m_sdbSizer1 = wx.StdDialogButtonSizer()
2589         m_sdbSizer1.AddButton(  self.button_1 )
2590         if self.save :
2591             m_sdbSizer1.AddButton(  self.button_2 )
2592         m_sdbSizer1.Realize()
2593         sizer_2.Add(m_sdbSizer1, 1, wx.EXPAND, 5)
2594         self.SetSizer(sizer_2)
2595         self.Layout()
2596         sizer_2.Fit( self )
2597
2598     def OnSavePage(self, evt) :
2599         dlg = wx.FileDialog(
2600             self, message=_(u"Save as ...").decode('utf8'), defaultDir=os.getcwd(),
2601             defaultFile="concordancier.html", wildcard="html|*.html", style=wx.SAVE | wx.OVERWRITE_PROMPT
2602             )
2603         dlg.SetFilterIndex(2)
2604         dlg.CenterOnParent()
2605         if dlg.ShowModal() == wx.ID_OK:
2606             path = dlg.GetPath()
2607             with open(path, 'w') as f :
2608                 f.write(self.html)
2609
2610     def OnCloseMe(self, event):
2611         self.Close(True)
2612
2613     def OnCloseWindow(self, event):
2614         self.Destroy()
2615
2616
2617
2618 class ExtractDialog ( wx.Dialog ):
2619     
2620     def __init__( self, parent, option ):
2621         wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = wx.EmptyString, pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.DEFAULT_DIALOG_STYLE )
2622
2623         self.option = option
2624         
2625         self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
2626         
2627         fgSizer1 = wx.FlexGridSizer( 0, 2, 0, 0 )
2628         fgSizer1.SetFlexibleDirection( wx.BOTH )
2629         fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
2630         
2631         self.m_staticText1 = wx.StaticText( self, wx.ID_ANY, _(u"Corpora").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2632         self.m_staticText1.Wrap( -1 )
2633         fgSizer1.Add( self.m_staticText1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2634         
2635         self.corpusfile = wx.FilePickerCtrl( self, wx.ID_ANY, wx.EmptyString, _(u"Select a file").decode('utf8'), u"*.txt", wx.DefaultPosition, wx.Size( -1,-1 ), wx.FLP_DEFAULT_STYLE|wx.FLP_FILE_MUST_EXIST|wx.FLP_OPEN )
2636         self.corpusfile.SetMinSize( wx.Size( 500,-1 ) )
2637         
2638         fgSizer1.Add( self.corpusfile, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL|wx.EXPAND, 5 )
2639         
2640         self.m_staticText2 = wx.StaticText( self, wx.ID_ANY, _(u"Characters set").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2641         self.m_staticText2.Wrap( -1 )
2642         fgSizer1.Add( self.m_staticText2, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2643         
2644         encodageChoices = [' - '.join(encodage) for encodage in encodages]
2645         self.encodage = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, encodageChoices, 0 )
2646         self.encodage.SetSelection( 0 )
2647         self.encodage.SetMinSize( wx.Size( 200,-1 ) )
2648         
2649         fgSizer1.Add( self.encodage, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL|wx.EXPAND, 5 )
2650         
2651         if option == 'splitvar' :
2652             self.m_staticText3 = wx.StaticText( self, wx.ID_ANY, _(u"Variables (with the * but without the _)").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2653             self.m_staticText3.Wrap( -1 )
2654             fgSizer1.Add( self.m_staticText3, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2655             
2656             self.txtvar = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
2657             self.txtvar.SetMinSize( wx.Size( 200,-1 ) )
2658             
2659             fgSizer1.Add( self.txtvar, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL|wx.EXPAND, 5 )
2660         
2661         if option == 'mods' :
2662             self.m_staticText4 = wx.StaticText( self, wx.ID_ANY, _(u"Modalities (one by line, with the *)").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2663             self.m_staticText4.Wrap( -1 )
2664             fgSizer1.Add( self.m_staticText4, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2665             
2666             self.txtmods = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.TE_MULTILINE )
2667             self.txtmods.SetMinSize( wx.Size( 200,150 ) )
2668             
2669             fgSizer1.Add( self.txtmods, 0, wx.ALL|wx.EXPAND, 5 )
2670             
2671             self.m_staticText5 = wx.StaticText( self, wx.ID_ANY, _(u"Extraction type").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2672             self.m_staticText5.Wrap( -1 )
2673             fgSizer1.Add( self.m_staticText5, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2674             
2675             extractformatChoices = [ _(u"Only one file").decode('utf8'), _(u"One file by modality").decode('utf8') ]
2676             self.extractformat = wx.RadioBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, extractformatChoices, 1, wx.RA_SPECIFY_COLS )
2677             self.extractformat.SetSelection( 0 )
2678             fgSizer1.Add( self.extractformat, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2679         
2680         if option == 'them' :
2681             self.m_staticText4 = wx.StaticText( self, wx.ID_ANY, _(u"thematics (one by line, with the -*)").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2682             self.m_staticText4.Wrap( -1 )
2683             fgSizer1.Add( self.m_staticText4, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2684             
2685             self.txtmods = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.TE_MULTILINE )
2686             self.txtmods.SetMinSize( wx.Size( 200,150 ) )
2687             
2688             fgSizer1.Add( self.txtmods, 0, wx.ALL|wx.EXPAND, 5 )
2689             
2690             #self.m_staticText5 = wx.StaticText( self, wx.ID_ANY, _(u"Extraction type").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2691             #self.m_staticText5.Wrap( -1 )
2692             #fgSizer1.Add( self.m_staticText5, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2693             
2694             #extractformatChoices = [ _(u"Only one file").decode('utf8'), _(u"One file by thematic").decode('utf8') ]
2695             #self.extractformat = wx.RadioBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, extractformatChoices, 1, wx.RA_SPECIFY_COLS )
2696             #self.extractformat.SetSelection( 0 )
2697             #fgSizer1.Add( self.extractformat, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )        
2698             
2699         
2700         fgSizer1.AddSpacer( ( 0, 0), 1, wx.EXPAND, 5 )
2701         
2702         m_sdbSizer1 = wx.StdDialogButtonSizer()
2703         self.m_sdbSizer1OK = wx.Button( self, wx.ID_OK )
2704         m_sdbSizer1.AddButton( self.m_sdbSizer1OK )
2705         self.m_sdbSizer1Cancel = wx.Button( self, wx.ID_CANCEL )
2706         m_sdbSizer1.AddButton( self.m_sdbSizer1Cancel )
2707         m_sdbSizer1.Realize();
2708         
2709         fgSizer1.Add( m_sdbSizer1, 1, wx.EXPAND, 5 )
2710         
2711         
2712         self.SetSizer( fgSizer1 )
2713         self.Layout()
2714         fgSizer1.Fit( self )
2715         
2716         self.Centre( wx.BOTH )
2717
2718     def make_param(self) :
2719         parametres = {}
2720         le = [enc[0].lower() for enc in encodages]
2721         parametres['filein'] = self.corpusfile.GetPath()
2722         encodage = le[self.encodage.GetSelection()]
2723         parametres['encodein'] = encodage
2724         if self.option == 'splitvar' :
2725             parametres['var'] = self.txtvar.GetValue()
2726         if self.option == 'mods' :
2727             parametres['mods'] = self.txtmods.GetValue().splitlines()
2728             if self.extractformat.GetSelection() == 0 :
2729                 parametres['onefile'] = True
2730             else :
2731                 parametres['onefile'] = False
2732         if self.option == 'them' :
2733             parametres['them'] = self.txtmods.GetValue().splitlines()
2734         #    if self.extractformat.GetSelection() == 0 :
2735         #        parametres['onefile'] = True
2736         #    else :
2737         #        parametres['onefile'] = False        
2738         parametres['encodeout'] = le[self.encodage.GetSelection()]
2739         return parametres
2740     
2741     def __del__( self ):
2742         pass
2743
2744 class FreqDialog(wx.Dialog):
2745     def __init__(self, parent, ID, listcol, title, size) :
2746         wx.Dialog.__init__(self, parent, ID, title, size=size, pos=wx.DefaultPosition,style=wx.DEFAULT_DIALOG_STYLE | wx.CANCEL | wx.OK )
2747         pre = wx.PreDialog()
2748         pre.SetExtraStyle(wx.DIALOG_EX_CONTEXTHELP)
2749         pre.Create(parent, ID, title, wx.DefaultPosition, size, wx.DEFAULT_DIALOG_STYLE | wx.CANCEL | wx.OK)
2750         self.PostCreate(pre)
2751         self.parent = parent 
2752         sizer = wx.BoxSizer(wx.VERTICAL)
2753         #self.content = parent.content
2754         self.header = listcol
2755         #LABELLIST = []
2756         #for i in self.header:
2757         #    forme = i
2758         #    if len(forme) > 60 :
2759         #        LABELLIST.append(i[0:60])
2760         #    else:
2761         #        LABELLIST.append(i)
2762         self.list_box_1 = wx.ListBox(self, -1, choices=self.header, style=wx.LB_EXTENDED | wx.LB_HSCROLL)
2763         sizer.Add(self.list_box_1, 0, 5)
2764         
2765         btnsizer = wx.BoxSizer(wx.HORIZONTAL)
2766         
2767         btn = wx.Button(self, wx.ID_CANCEL)
2768         btnsizer.Add(btn)
2769         
2770         btn = wx.Button(self, wx.ID_OK)
2771         btn.SetDefault()
2772         btnsizer.Add(btn)
2773         
2774         sizer.Add(btnsizer, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_CENTER_HORIZONTAL, 5)
2775         self.SetSizer(sizer)
2776         sizer.Fit(self)
2777         self.SetTitle(_(u"Selection").decode('utf8'))
2778   
2779         # end wxGlade
2780
2781 class ProtoDial ( wx.Dialog ):
2782     
2783     def __init__( self, parent, headers ):
2784         wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = _(u"Settings").decode('utf8'), pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.DEFAULT_DIALOG_STYLE )
2785         
2786         self.SetSizeHintsSz( wx.Size( 200,300 ), wx.DefaultSize )
2787         
2788         bSizer1 = wx.BoxSizer( wx.VERTICAL )
2789         
2790         fgSizer1 = wx.FlexGridSizer( 0, 2, 0, 0 )
2791         fgSizer1.SetFlexibleDirection( wx.BOTH )
2792         fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
2793         
2794         self.m_staticText1 = wx.StaticText( self, wx.ID_ANY, _(u"Variables").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2795         self.m_staticText1.Wrap( -1 )
2796         fgSizer1.Add( self.m_staticText1, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALL, 5 )
2797         
2798         self.m_staticText2 = wx.StaticText( self, wx.ID_ANY, _(u"Ranks").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2799         self.m_staticText2.Wrap( -1 )
2800         fgSizer1.Add( self.m_staticText2, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALL, 5 )
2801         
2802         variablesChoices = headers
2803         self.variables = wx.ListBox( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, variablesChoices, wx.LB_MULTIPLE )
2804         self.variables.SetMinSize( wx.Size( 150,-1 ) )
2805         
2806         fgSizer1.Add( self.variables, 0, wx.ALL|wx.EXPAND, 5 )
2807         
2808         rangsChoices = headers
2809         self.rangs = wx.ListBox( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, rangsChoices, wx.LB_MULTIPLE )
2810         self.rangs.SetMinSize( wx.Size( 150,-1 ) )
2811         
2812         fgSizer1.Add( self.rangs, 0, wx.ALL|wx.EXPAND, 5 )
2813         
2814         
2815         bSizer1.Add( fgSizer1, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL, 5 )
2816         
2817         fgSizer3 = wx.FlexGridSizer( 0, 2, 0, 0 )
2818         fgSizer3.SetFlexibleDirection( wx.BOTH )
2819         fgSizer3.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
2820         
2821         self.m_staticText3 = wx.StaticText( self, wx.ID_ANY, _(u"Limit frequency").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2822         self.m_staticText3.Wrap( -1 )
2823         fgSizer3.Add( self.m_staticText3, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2824         
2825         bSizer2 = wx.BoxSizer( wx.HORIZONTAL )
2826         
2827         choix_freqChoices = [ _(u"automatic (mean)").decode('utf8'), _(u"manual").decode('utf8') ]
2828         self.choix_freq = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, choix_freqChoices, 0 )
2829         self.choix_freq.SetSelection( 0 )
2830         bSizer2.Add( self.choix_freq, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2831         
2832         self.freqlim = wx.TextCtrl( self, wx.ID_ANY, u"0", wx.DefaultPosition, wx.DefaultSize, wx.TE_CENTRE )
2833         self.freqlim.Enable( False )
2834         self.freqlim.SetMinSize( wx.Size( 100,-1 ) )
2835         
2836         bSizer2.Add( self.freqlim, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2837         
2838         
2839         fgSizer3.Add( bSizer2, 1, wx.EXPAND, 5 )
2840         
2841         self.m_staticText4 = wx.StaticText( self, wx.ID_ANY, _(u"Limit rank").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2842         self.m_staticText4.Wrap( -1 )
2843         fgSizer3.Add( self.m_staticText4, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2844         
2845         bSizer21 = wx.BoxSizer( wx.HORIZONTAL )
2846         
2847         choix_rangChoices = [ _(u"automatic (mean)").decode('utf8'), _(u"manual").decode('utf8')]
2848         self.choix_rang = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, choix_rangChoices, 0 )
2849         self.choix_rang.SetSelection( 0 )
2850         bSizer21.Add( self.choix_rang, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2851         
2852         self.ranglim = wx.TextCtrl( self, wx.ID_ANY, u"0", wx.DefaultPosition, wx.DefaultSize, wx.TE_CENTRE )
2853         self.ranglim.Enable( False )
2854         self.ranglim.SetMinSize( wx.Size( 100,-1 ) )
2855         
2856         bSizer21.Add( self.ranglim, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2857         
2858         
2859         fgSizer3.Add( bSizer21, 1, wx.EXPAND, 5 )
2860         
2861         self.m_staticText5 = wx.StaticText( self, wx.ID_ANY, _(u"Minimum frequency").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2862         self.m_staticText5.Wrap( -1 )
2863         fgSizer3.Add( self.m_staticText5, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2864         
2865         self.m_textCtrl4 = wx.TextCtrl( self, wx.ID_ANY, u"2", wx.DefaultPosition, wx.DefaultSize, wx.TE_CENTRE )
2866         fgSizer3.Add( self.m_textCtrl4, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALL, 5 )
2867         
2868         
2869         bSizer1.Add( fgSizer3, 1, wx.EXPAND, 5 )
2870         
2871         m_sdbSizer1 = wx.StdDialogButtonSizer()
2872         self.m_sdbSizer1OK = wx.Button( self, wx.ID_OK )
2873         m_sdbSizer1.AddButton( self.m_sdbSizer1OK )
2874         self.m_sdbSizer1Cancel = wx.Button( self, wx.ID_CANCEL )
2875         m_sdbSizer1.AddButton( self.m_sdbSizer1Cancel )
2876         m_sdbSizer1.Realize();
2877         
2878         bSizer1.Add( m_sdbSizer1, 0, wx.EXPAND, 5 )
2879         
2880         self.SetSizer( bSizer1 )
2881         self.Layout()
2882         bSizer1.Fit( self )
2883         
2884         self.Centre( wx.BOTH )
2885         
2886         # Connect Events
2887         self.choix_freq.Bind( wx.EVT_CHOICE, self.UpdateText )
2888         self.choix_rang.Bind( wx.EVT_CHOICE, self.UpdateText )
2889     
2890     def __del__( self ):
2891         pass
2892     
2893     
2894     # Virtual event handlers, overide them in your derived class
2895     def UpdateText( self, event ):
2896         event.Skip()
2897
2898 class SimpleDialog ( wx.Dialog ):
2899     
2900     def __init__( self, parent ):
2901         wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = wx.EmptyString, pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.DEFAULT_DIALOG_STYLE )
2902         
2903         self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
2904         
2905         bSizer1 = wx.BoxSizer( wx.VERTICAL )
2906         
2907         self.m_panel1 = wx.Panel( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
2908         bSizer2 = wx.BoxSizer( wx.VERTICAL )
2909         
2910         self.m_staticText1 = wx.StaticText( self.m_panel1, wx.ID_ANY, _(u"Export finished. Open in a web browser :").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2911         self.m_staticText1.Wrap( -1 )
2912         bSizer2.Add( self.m_staticText1, 0, wx.ALL, 5 )
2913         
2914         self.link = wx.HyperlinkCtrl( self.m_panel1, wx.ID_ANY, u"wxFB Website", u"http://www.wxformbuilder.org", wx.DefaultPosition, wx.DefaultSize, wx.HL_DEFAULT_STYLE )
2915         bSizer2.Add( self.link, 0, wx.ALL, 5 )
2916         
2917         
2918         self.m_panel1.SetSizer( bSizer2 )
2919         self.m_panel1.Layout()
2920         bSizer2.Fit( self.m_panel1 )
2921         bSizer1.Add( self.m_panel1, 1, wx.EXPAND |wx.ALL, 5 )
2922         
2923         m_sdbSizer1 = wx.StdDialogButtonSizer()
2924         self.m_sdbSizer1OK = wx.Button( self, wx.ID_OK )
2925         m_sdbSizer1.AddButton( self.m_sdbSizer1OK )
2926         m_sdbSizer1.Realize();
2927         
2928         bSizer1.Add( m_sdbSizer1, 0, wx.EXPAND, 5 )
2929         
2930         
2931         self.SetSizer( bSizer1 )
2932         self.Layout()
2933         bSizer1.Fit( self )
2934         
2935         self.Centre( wx.BOTH )
2936     
2937     def __del__( self ):
2938         pass
2939
2940
2941 class SubTextFromMetaDial ( wx.Dialog ):
2942     
2943     def __init__( self, parent, parametres ):
2944         wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = u"Subcorpus from metadata", pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.DEFAULT_DIALOG_STYLE )
2945         
2946         self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
2947         
2948         bSizer1 = wx.BoxSizer( wx.VERTICAL )
2949         
2950         fgSizer1 = wx.FlexGridSizer( 0, 2, 0, 0 )
2951         fgSizer1.SetFlexibleDirection( wx.BOTH )
2952         fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
2953         
2954         self.m_staticText1 = wx.StaticText( self, wx.ID_ANY, u"SubCorpus Name", wx.DefaultPosition, wx.DefaultSize, 0 )
2955         self.m_staticText1.Wrap( -1 )
2956         fgSizer1.Add( self.m_staticText1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2957         
2958         self.subcorpusname = wx.TextCtrl( self, wx.ID_ANY, parametres['corpus_name'], wx.DefaultPosition, wx.Size( 300,-1 ), 0 )
2959         fgSizer1.Add( self.subcorpusname, 0, wx.ALL, 5 )
2960         
2961         self.m_staticText2 = wx.StaticText( self, wx.ID_ANY, u"Select one or more metadata", wx.DefaultPosition, wx.DefaultSize, 0 )
2962         self.m_staticText2.Wrap( -1 )
2963         fgSizer1.Add( self.m_staticText2, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2964         
2965         m_listBox1Choices = parametres['meta']
2966         self.m_listBox1 = wx.ListBox( self, wx.ID_ANY, wx.DefaultPosition, wx.Size( -1,-1 ), m_listBox1Choices, wx.LB_HSCROLL|wx.LB_MULTIPLE )
2967         self.m_listBox1.SetMinSize( wx.Size( -1,200 ) )
2968         self.m_listBox1.SetMaxSize( wx.Size( -1,500 ) )
2969         
2970         fgSizer1.Add( self.m_listBox1, 0, wx.ALL|wx.EXPAND, 5 )
2971         
2972         
2973         bSizer1.Add( fgSizer1, 1, wx.EXPAND, 5 )
2974         
2975         m_sdbSizer1 = wx.StdDialogButtonSizer()
2976         self.m_sdbSizer1OK = wx.Button( self, wx.ID_OK )
2977         m_sdbSizer1.AddButton( self.m_sdbSizer1OK )
2978         self.m_sdbSizer1Cancel = wx.Button( self, wx.ID_CANCEL )
2979         m_sdbSizer1.AddButton( self.m_sdbSizer1Cancel )
2980         m_sdbSizer1.Realize();
2981         
2982         bSizer1.Add( m_sdbSizer1, 0, wx.EXPAND, 5 )
2983         
2984         
2985         self.SetSizer( bSizer1 )
2986         self.Layout()
2987         bSizer1.Fit( self )
2988         
2989         self.Centre( wx.BOTH )
2990     
2991     def __del__( self ):
2992         pass
2993
2994
2995
2996
2997