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