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
11 from functions import DoConf
14 from KeyFrame import AlcOptFrame
15 #---------------------------------------------------------------------------
16 provider = wx.SimpleHelpProvider()
17 wx.HelpProvider_Set(provider)
19 #---------------------------------------------------------------------------
22 encodages = [[u'cp1252',u'Western Europe'], [u'utf-8',u'all languages'], [u'MacRoman',u'Western Europe'], [u'ascii', u'English'], [u'big5', u'Traditional Chinese'], [u'big5hkscs', u'Traditional Chinese'], [u'cp037', u'English'], [u'cp424', u'Hebrew'], [u'cp437', u'English'], [u'cp500', u'Western Europe'], [u'cp737', u'Greek'], [u'cp775', u'Baltic languages'], [u'cp850', u'Western Europe'], [u'cp852', u'Central and Eastern Europe'], [u'cp855', u'Bulg, Byelorus, Mace, Rus, Serb'], [u'cp856', u'Hebrew'], [u'cp857', u'Turkish'], [u'cp860', u'Portuguese'], [u'cp861', u'Icelandic'], [u'cp862', u'Hebrew'], [u'cp863', u'Canadian'], [u'cp864', u'Arabic'], [u'cp865', u'Danish, Norwegian'], [u'cp866', u'Russian'], [u'cp869', u'Greek'], [u'cp874', u'Thai'], [u'cp875', u'Greek'], [u'cp932', u'Japanese'], [u'cp949', u'Korean'], [u'cp950', u'Traditional Chinese'], [u'cp1006', u'Urdu'], [u'cp1026', u'Turkish'], [u'cp1140', u'Western Europe'], [u'cp1250', u'Central and Eastern Europe'], [u'cp1251', u'Bulg, Byelorus, Mace, Rus, Serb'], [u'cp1253', u'Greek'], [u'cp1254', u'Turkish'], [u'cp1255', u'Hebrew'], [u'cp1256', u'Arabic'], [u'cp1257', u'Baltic languages'], [u'cp1258', u'Vietnamese'], [u'euc_jp', u'Japanese'], [u'euc_jis_2004', u'Japanese'], [u'euc_jisx0213', u'Japanese'], [u'euc_kr', u'Korean'], [u'gb2312', u'Simplified Chinese'], [u'gbk', u'Unified Chinese'], [u'gb18030', u'Unified Chinese'], [u'hz', u'Simplified Chinese'], [u'iso2022_jp', u'Japanese'], [u'iso2022_jp_1', u'Japanese'], [u'iso2022_jp_2', u'Jp, K, S C, WE, G'], [u'iso2022_jp_2004', u'Japanese'], [u'iso2022_jp_3', u'Japanese'], [u'iso2022_jp_ext', u'Japanese'], [u'iso2022_kr', u'Korean'], [u'latin_1', u'West Europe'], [u'iso8859_2', u'Central and Eastern Europe'], [u'iso8859_3', u'Esperanto, Maltese'], [u'iso8859_4', u'Baltic languages'], [u'iso8859_5', u'Bulg, Byelorus, Mace, Rus, Serb'], [u'iso8859_6', u'Arabic'], [u'iso8859_7', u'Greek'], [u'iso8859_8', u'Hebrew'], [u'iso8859_9', u'Turkish'], [u'iso8859_10', u'Nordic languages'], [u'iso8859_13', u'Baltic languages'], [u'iso8859_14', u'Celtic languages'], [u'iso8859_15', u'Western Europe'], [u'iso8859_16', u'South-Eastern Europe'], [u'johab', u'Korean'], [u'koi8_r', u'Russian'], [u'koi8_u', u'Ukrainian'], [u'mac_cyrillic', u'Bulg, Byelorus, Mace, Rus, Serb'], [u'mac_greek', u'Greek'], [u'mac_iceland', u'Icelandic'], [u'mac_latin2', u'Central and Eastern Europe'], [u'mac_turkish', u'Turkish'], [u'ptcp154', u'Kazakh'], [u'shift_jis', u'Japanese'], [u'shift_jis_2004', u'Japanese'], [u'shift_jisx0213', u'Japanese'], [u'utf_32', u'all languages'], [u'utf_32_be', u'all languages'], [u'utf_32_le', u'all languages'], [u'utf_16', u'all languages'], [u'utf_16_be', u'all languages (BMP only)'], [u'utf_16_le', u'all languages (BMP only)'], [u'utf_7', u'all languages'], [u'utf_8_sig', u'all languages']]
24 class FileOptionDialog(wx.Dialog):
26 self, parent, ID, title, sep=False, sheet = False, size=wx.DefaultSize, pos=wx.DefaultPosition,
27 style=wx.DEFAULT_DIALOG_STYLE
31 pre.SetExtraStyle(wx.DIALOG_EX_CONTEXTHELP)
32 pre.Create(parent, ID, title, pos, size, style)
36 sizer = wx.BoxSizer(wx.VERTICAL)
37 grid_sizer = wx.FlexGridSizer(0, 2, 2, 2)
38 ##############################
40 label = wx.StaticText(self, -1, u"La première ligne contient les noms de colonne")
41 label.SetHelpText(u"La première ligne contient les noms de colonne")
42 grid_sizer.Add(label, 0, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
44 self.radio_box_1 = wx.RadioBox(self, -1, u"", choices=on, majorDimension=0, style=wx.RA_SPECIFY_ROWS)
45 self.radio_box_1.SetHelpText(u"La première ligne contient les noms de colonne")
46 grid_sizer.Add(self.radio_box_1, 1, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
48 ##############################
50 label = wx.StaticText(self, -1, u"La première colonne contient un identifiant")
51 label.SetHelpText(u"La première colonne contient un identifiant")
52 grid_sizer.Add(label, 0, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
54 self.radio_box_2 = wx.RadioBox(self, -1, u"", choices=on, majorDimension=0, style=wx.RA_SPECIFY_ROWS)
55 self.radio_box_2.SetHelpText(u"La première colonne contient un identifiant")
56 grid_sizer.Add(self.radio_box_2, 1, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
58 ##############################
60 label = wx.StaticText(self, -1, u"Séparateur de colonne")
61 label.SetHelpText(u"Quel charactère sépare les colonnes ?")
62 grid_sizer.Add(label, 0, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
63 self.colsep = [";", "tabulation", ","]
64 self.choice3 = wx.Choice(self, -1, (100, 50), choices=self.colsep)
65 self.choice3.SetHelpText(u"Quel charactère sépare les colonnes ?")
66 grid_sizer.Add(self.choice3, 1, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
68 ##############################
70 label = wx.StaticText(self, -1, u"Séparateur de texte")
71 label.SetHelpText(u"Quel caractère encadre les champs texte ?")
72 grid_sizer.Add(label, 0, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
73 self.txtsep = ["\"", "'"]
74 self.choice4 = wx.Choice(self, -1, (100, 50), choices=self.txtsep)
75 self.choice4.SetHelpText(u"Quel caractère encadre les champs texte ?")
76 grid_sizer.Add(self.choice4, 1, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
77 self.choice3.SetSelection(0)
78 self.choice4.SetSelection(0)
79 self.text = wx.StaticText(self, -1, u"Encodage du corpus : ")
80 grid_sizer.Add(self.text, 1, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
81 self.le = [enc[0].lower() for enc in encodages]
82 self.list_encodages = wx.Choice(self, -1, (25, 30), choices=[' - '.join(encodage) for encodage in encodages])
83 if locale.getpreferredencoding().lower() == 'mac-roman' :
84 enc = self.le.index('macroman')
87 enc = self.le.index(sys.getdefaultencoding().lower())
89 enc = self.le.index('utf-8')
90 self.list_encodages.SetSelection(enc)
91 grid_sizer.Add(self.list_encodages, 1, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
93 label = wx.StaticText(self, -1, u"Feuille ")
94 grid_sizer.Add(label, 0, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
95 self.spin1 = wx.SpinCtrl(self, -1, '',size = (100,30), min=1, max=500)
96 grid_sizer.Add(self.spin1, 1, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
98 sizer.Add(grid_sizer, 0, wx.GROW | wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5)
101 line = wx.StaticLine(self, -1, size=(20, -1), style=wx.LI_HORIZONTAL)
102 sizer.Add(line, 0, wx.GROW | wx.ALIGN_CENTER_VERTICAL | wx.RIGHT | wx.TOP, 5)
104 btnsizer = wx.StdDialogButtonSizer()
106 if wx.Platform != "__WXMSW__":
107 btn = wx.ContextHelpButton(self)
108 btnsizer.AddButton(btn)
110 btn = wx.Button(self, wx.ID_OK)
111 btn.SetHelpText("The OK button completes the dialog")
113 btnsizer.AddButton(btn)
115 btn = wx.Button(self, wx.ID_CANCEL)
116 btn.SetHelpText("The Cancel button cnacels the dialog. (Cool, huh?)")
117 btnsizer.AddButton(btn)
120 sizer.Add(btnsizer, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_CENTER_HORIZONTAL, 5)
126 class ClusterNbDialog(wx.Dialog):
128 self, LIST_CLASSE, parent, ID, title, size=wx.DefaultSize, pos=wx.DefaultPosition,
129 style=wx.DEFAULT_DIALOG_STYLE
133 pre.SetExtraStyle(wx.DIALOG_EX_CONTEXTHELP)
134 pre.Create(parent, ID, title, pos, size, style)
138 # Now continue with the normal construction of the dialog
140 sizer = wx.BoxSizer(wx.VERTICAL)
142 label = wx.StaticText(self, -1, u"Résultats de la classification")
143 label.SetHelpText("This is the help text for the label")
144 sizer.Add(label, 0, wx.ALIGN_CENTRE | wx.ALL, 5)
146 box = wx.BoxSizer(wx.HORIZONTAL)
148 label = wx.StaticText(self, -1, u"Choisissez le nombre de classes")
149 label.SetHelpText("This is the help text for the label")
150 box.Add(label, 0, wx.ALIGN_CENTRE | wx.ALL, 5)
152 if type(LIST_CLASSE) != float :
153 for i in LIST_CLASSE :
154 LIST_CLASSE_OK.append(str(i))
156 LIST_CLASSE_OK.append(str(LIST_CLASSE))
157 self.list_box_1 = wx.ListBox(self, -1, choices=LIST_CLASSE_OK, style=wx.LB_SINGLE | wx.LB_HSCROLL)
158 self.list_box_1.SetHelpText("Here's some help text for field #1")
159 box.Add(self.list_box_1, 1, wx.ALIGN_CENTRE | wx.ALL, 5)
161 sizer.Add(box, 0, wx.GROW | wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5)
164 ###############################
165 line = wx.StaticLine(self, -1, size=(20, -1), style=wx.LI_HORIZONTAL)
166 sizer.Add(line, 0, wx.GROW | wx.ALIGN_CENTER_VERTICAL | wx.RIGHT | wx.TOP, 5)
168 btnsizer = wx.StdDialogButtonSizer()
170 if wx.Platform != "__WXMSW__":
171 btn = wx.ContextHelpButton(self)
172 btnsizer.AddButton(btn)
174 btn = wx.Button(self, wx.ID_OK)
175 btn.SetHelpText("The OK button completes the dialog")
177 btnsizer.AddButton(btn)
179 btn = wx.Button(self, wx.ID_CANCEL)
180 btn.SetHelpText("The Cancel button cnacels the dialog. (Cool, huh?)")
181 btnsizer.AddButton(btn)
184 sizer.Add(btnsizer, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5)
189 class EncodeDialog(wx.Dialog):
190 def __init__(self, *args, **kwds):
191 # begin wxGlade: MyDialog.__init__
192 kwds["style"] = wx.DEFAULT_DIALOG_STYLE
193 kwds["size"] = wx.Size(100, 60)
194 kwds["title"] = u'Encodage'
195 wx.Dialog.__init__(self, *args, **kwds)
196 self.label_dict = wx.StaticText(self, -1, u"Langue")
197 langues_n = [u'français', u'english', u'german (expérimentale)', u'italian (expérimentale)', u'swedish (exp.)', u'portuguese (exp.)']
198 self.langues = [u'french', u'english', u'german', 'italian', 'swedish', 'portuguese']
199 self.choice_dict = wx.Choice(self, -1, choices = langues_n)
200 self.encodages = encodages
201 self.text = wx.StaticText(self, -1, u"Encodage du corpus : ")
202 self.le = [enc[0].lower() for enc in self.encodages]
203 self.list_encodages = wx.Choice(self, -1, (25, 50), choices=[' - '.join(encodage) for encodage in self.encodages])#style=wx.LB_SINGLE | wx.LB_HSCROLL)
204 self.button_1 = wx.Button(self, wx.ID_OK, "")
206 self.__set_properties()
210 def __set_properties(self):
211 # begin wxGlade: MyDialog.__set_properties
212 self.SetTitle(u"Encodage du corpus")
213 self.SetMinSize(wx.Size(300, 100))
214 if locale.getpreferredencoding().lower() == 'mac-roman' :
215 enc = self.le.index('macroman')
217 enc = self.le.index(locale.getpreferredencoding().lower())
218 self.list_encodages.SetSelection(enc)
219 self.choice_dict.SetSelection(0)
222 def __do_layout(self):
223 # begin wxGlade: MyDialog.__do_layout
224 sizer_1 = wx.BoxSizer(wx.VERTICAL)
225 sizer_1.Add(self.text, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL, 0)
226 sizer_1.Add(self.list_encodages, 1, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL, 0)
227 sizer_1.Add(self.label_dict, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL, 0)
228 sizer_1.Add(self.choice_dict, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL, 0)
229 sizer_1.Add(self.button_1, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL, 0)
230 self.SetSizer(sizer_1)
234 class CHDDialog(wx.Dialog):
236 self, parent, ID, title, size=wx.DefaultSize, pos=wx.DefaultPosition,
237 style=wx.DEFAULT_DIALOG_STYLE | wx.CANCEL
240 pre.SetExtraStyle(wx.DIALOG_EX_CONTEXTHELP)
241 pre.Create(parent, ID, title, pos, size, style)
245 self.colsep = parent.colsep
247 self.content = parent.content[:]
248 self.header = parent.header[:]
250 for i in self.header:
252 LABELLIST.append(i[0:60])
255 self.LABELLISTTOT = LABELLIST
257 #----------------------------------------------------------------------------------------------------
258 self.text1 = wx.StaticText(self, -1, u"Variables Actives (au moins 3)")
259 self.text2 = wx.StaticText(self, -1, u"Variables Supplémentaires (au moins 1)")
260 self.list_box_1 = wx.ListBox(self, -1, choices=LABELLIST, style=wx.LB_EXTENDED | wx.LB_HSCROLL)
261 self.list_box_2 = wx.ListBox(self, -1, choices=LABELLIST, style=wx.LB_EXTENDED | wx.LB_HSCROLL)
262 self.button_cancel = wx.Button(self, wx.ID_CANCEL)
263 self.button_back = wx.Button(self, wx.ID_BACKWARD)
264 self.button_forw = wx.Button(self, wx.ID_FORWARD)
265 self.button_ok = wx.Button(self, wx.ID_OK)
266 self.button_pref = wx.Button(self, wx.ID_PROPERTIES)
267 self.button_selectall = wx.Button(self, wx.NewId(), u"Sélectionner tout")
268 self.__set_properties()
271 self.Bind(wx.EVT_BUTTON, self.OnPrec, self.button_back)
272 self.Bind(wx.EVT_BUTTON, self.OnSuivant, self.button_forw)
273 self.Bind(wx.EVT_BUTTON, self.OnValider, self.button_ok)
274 self.Bind(wx.EVT_BUTTON, self.OnSelectAll, self.button_selectall)
277 self.TEMPDIR = parent.TEMPDIR
280 def __set_properties(self):
281 # begin wxGlade: ConfChi2.__set_properties
282 self.SetTitle(u"Sélection des variables")
283 self.list_box_2.Enable(False)
284 self.button_ok.Enable(False)
285 self.button_back.Enable(False)
288 def __do_layout(self):
289 # begin wxGlade: ConfChi2.__do_layout
290 sizer_1 = wx.BoxSizer(wx.VERTICAL)
291 sizer_2 = wx.BoxSizer(wx.VERTICAL)
292 sizer_3 = wx.BoxSizer(wx.HORIZONTAL)
293 sizer_4 = wx.BoxSizer(wx.HORIZONTAL)
294 sizer_5 = wx.BoxSizer(wx.HORIZONTAL)
295 sizer_6 = wx.BoxSizer(wx.HORIZONTAL)
296 sizer_7 = wx.BoxSizer(wx.HORIZONTAL)
297 sizer_5.Add(self.text1, 1, wx.CENTER | wx.ALL, 0)
298 sizer_5.Add(self.text2, 1, wx.CENTER | wx.ALL, 0)
299 sizer_3.Add(self.list_box_1, 0, wx.EXPAND, 0)
300 sizer_3.Add(self.list_box_2, 0, wx.EXPAND, 0)
301 sizer_6.Add(self.button_selectall, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL, 0)
302 sizer_7.Add(self.button_cancel, 0, wx.ALL, 0)
303 sizer_7.Add(self.button_pref, 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
304 sizer_7.Add(self.button_ok, 0, wx.wx.ALIGN_CENTER_HORIZONTAL, 0)
305 sizer_4.Add(self.button_back, 0, wx.ALL, 0)
306 sizer_4.Add(self.button_forw, 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
307 sizer_2.Add(sizer_5, 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
308 sizer_2.Add(sizer_3, 1, wx.EXPAND, 0)
309 sizer_2.Add(sizer_6, 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
310 sizer_2.Add(sizer_4, 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
311 sizer_2.Add(sizer_7, 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
312 sizer_1.Add(sizer_2, 1, wx.EXPAND, 4)
313 self.SetSizer(sizer_1)
317 #--------------FIXME-----------------------
318 #NETTOYAGE des variables inutiles
319 def OnSuivant(self, event):
320 LISTACTIVE = self.list_box_1.GetSelections()
321 if len(LISTACTIVE) != len(self.LABELLISTTOT) and len(LISTACTIVE) >= 3:
322 self.button_ok.Enable(True)
324 self.LISTHEADERINDICE = []
325 self.LISTNUMACTIVE = []
327 header = self.header[:]
328 for i in range(0, len(header)):
329 self.LISTHEADERINDICE.append(i)
330 for i in LISTACTIVE :
331 self.LISTNUMACTIVE.append(i)
332 header.pop(i - COMPT)
333 self.LISTHEADERINDICE.pop(i - COMPT)
338 self.LABELLIST.append(i[0:60])
340 self.LABELLIST.append(i)
341 self.list_box_2.Clear()
342 for i in self.LABELLIST :
343 self.list_box_2.Append(i)
345 self.list_box_1.Enable(False)
346 self.list_box_2.Enable(True)
347 self.button_forw.Enable(False)
348 self.button_back.Enable(True)
350 def OnValider(self, event):
351 LISTVARSUPSEL = self.list_box_2.GetSelections()
352 for i in LISTVARSUPSEL :
353 self.LISTVARSUP.append(self.LISTHEADERINDICE[i])
356 def OnPrec(self, event):
357 self.list_box_1.Enable(True)
358 self.list_box_2.Enable(False)
359 self.button_forw.Enable(True)
360 self.button_back.Enable(False)
361 self.button_ok.Enable(False)
365 def OnSelectAll(self, event):
367 for i in range(len(self.LABELLISTTOT)):
368 self.list_box_1.Select(i)
370 for i in range(len(self.LABELLIST)):
371 self.list_box_2.Select(i)
373 class PrefDialog ( wx.Dialog ):
375 def __init__( self, parent ):
376 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 )
379 self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
381 bSizer1 = wx.BoxSizer( wx.VERTICAL )
383 fgSizer1 = wx.FlexGridSizer( 0, 3, 0, 0 )
384 fgSizer1.SetFlexibleDirection( wx.BOTH )
385 fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
387 self.m_staticText1 = wx.StaticText( self, wx.ID_ANY, u"Jouer un son à la fin des analyses", wx.DefaultPosition, wx.DefaultSize, 0 )
388 self.m_staticText1.Wrap( -1 )
389 fgSizer1.Add( self.m_staticText1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
391 self.m_staticText2 = wx.StaticText( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
392 self.m_staticText2.Wrap( -1 )
393 fgSizer1.Add( self.m_staticText2, 0, wx.ALL, 5 )
395 m_radioBox1Choices = [ u"oui", u"non" ]
396 self.m_radioBox1 = wx.RadioBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, m_radioBox1Choices, 1, wx.RA_SPECIFY_COLS )
397 self.m_radioBox1.SetSelection( 0 )
398 fgSizer1.Add( self.m_radioBox1, 0, wx.ALIGN_RIGHT|wx.ALL, 5 )
400 msg = u"""Vérifier au démarrage si une
401 nouvelle version est disponible"""
402 self.m_staticText3 = wx.StaticText( self, wx.ID_ANY, msg, wx.DefaultPosition, wx.DefaultSize, 0 )
403 self.m_staticText3.Wrap( -1 )
404 fgSizer1.Add( self.m_staticText3, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
406 self.m_staticText4 = wx.StaticText( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
407 self.m_staticText4.Wrap( -1 )
408 fgSizer1.Add( self.m_staticText4, 0, wx.ALL, 5 )
410 m_radioBox2Choices = [ u"oui", u"non" ]
411 self.m_radioBox2 = wx.RadioBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, m_radioBox2Choices, 1, wx.RA_SPECIFY_COLS )
412 self.m_radioBox2.SetSelection( 0 )
413 fgSizer1.Add( self.m_radioBox2, 0, wx.ALIGN_RIGHT|wx.ALL, 5 )
415 msg = u"""Langue de l'interface"""
416 self.m_staticText45 = wx.StaticText( self, wx.ID_ANY, msg, wx.DefaultPosition, wx.DefaultSize, 0 )
417 self.m_staticText45.Wrap( -1 )
418 fgSizer1.Add( self.m_staticText45, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
420 self.m_staticText46 = wx.StaticText( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
421 self.m_staticText46.Wrap( -1 )
422 fgSizer1.Add( self.m_staticText46, 0, wx.ALL, 5 )
424 self.listlangues = [ u"french", u"english" ]
425 self.langues = wx.Choice( self, wx.ID_ANY, (200, -1), choices = self.listlangues)
426 #self.langues.SetSelection( 0 )
427 fgSizer1.Add( self.langues, 0, wx.ALIGN_RIGHT|wx.ALL, 5 )
429 msg = u"""Vérifier l'installation des
430 bibliothèques de R"""
431 self.m_staticText5 = wx.StaticText( self, wx.ID_ANY, msg, wx.DefaultPosition, wx.DefaultSize, 0 )
432 self.m_staticText5.Wrap( -1 )
433 fgSizer1.Add( self.m_staticText5, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
435 self.m_staticText6 = wx.StaticText( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
436 self.m_staticText6.Wrap( -1 )
437 fgSizer1.Add( self.m_staticText6, 0, wx.ALL, 5 )
439 self.m_button1 = wx.Button( self, wx.ID_ANY, u"Vérifier", wx.DefaultPosition, wx.DefaultSize, 0 )
440 fgSizer1.Add( self.m_button1, 0, wx.ALIGN_RIGHT|wx.ALL, 5 )
442 bSizer1.Add( fgSizer1, 1, wx.EXPAND, 5 )
443 if sys.platform == 'win32' :
444 bSizer2 = wx.BoxSizer( wx.HORIZONTAL )
446 msg = u"""Mémoire maximum allouée
448 self.m_staticText7 = wx.StaticText( self, wx.ID_ANY, msg, wx.DefaultPosition, wx.DefaultSize, 0 )
449 self.m_staticText7.Wrap( -1 )
450 bSizer2.Add( self.m_staticText7, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
452 self.m_checkBox1 = wx.CheckBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
453 bSizer2.Add( self.m_checkBox1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
455 self.m_spinCtrl1 = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 32, 16000, 1535 )
456 bSizer2.Add( self.m_spinCtrl1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
458 self.m_staticline7 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
459 bSizer2.Add( self.m_staticline7, 0, wx.EXPAND |wx.ALL, 5 )
461 bSizer1.Add( bSizer2, 0, wx.EXPAND, 5 )
462 self.m_checkBox1.Bind( wx.EVT_CHECKBOX, self.oncheckmem )
464 bSizer3 = wx.BoxSizer( wx.HORIZONTAL )
465 bSizer4 = wx.BoxSizer( wx.HORIZONTAL )
466 self.text8 = wx.StaticText( self, wx.ID_ANY, u"Utiliser svdlibc", wx.DefaultPosition, wx.DefaultSize, 0 )
467 self.text8.Wrap( -1 )
468 fgSizer1.Add( self.text8, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
469 self.check_svdc = wx.CheckBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
470 bSizer4.Add( self.check_svdc, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
471 bSizer3.Add( bSizer4, 0, wx.EXPAND, 5 )
472 self.fbb = filebrowse.FileBrowseButton(self, -1, size=(250, -1), fileMode = 2, fileMask = '*')
473 bSizer3.Add( self.fbb, 0, wx.EXPAND, 5 )
474 self.fbb.SetLabel(u"Chemin : ")
475 fgSizer1.Add( wx.StaticText(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 ), wx.ID_ANY, wx.ALL, 5)
476 fgSizer1.Add( bSizer3, 0, wx.ALIGN_RIGHT|wx.ALL, 5 )
478 Rpath_text = wx.StaticText( self, wx.ID_ANY, u"Chemin de R", wx.DefaultPosition, wx.DefaultSize, 0 )
479 Rpath_text.Wrap( -1 )
480 fgSizer1.Add( Rpath_text, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
481 fgSizer1.Add( wx.StaticText(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 ), wx.ID_ANY, wx.ALL, 5)
482 self.Rpath_value = filebrowse.FileBrowseButton(self, -1, size=(350, -1), fileMode = 2, fileMask = '*')
483 self.Rpath_value.SetLabel(u'Chemin : ')
484 fgSizer1.Add( self.Rpath_value, 0, wx.ALIGN_RIGHT|wx.ALL, 5 )
486 mirror_text = wx.StaticText( self, wx.ID_ANY, u"Miroir de R par défaut", wx.DefaultPosition, wx.DefaultSize, 0 )
487 mirror_text.Wrap( -1 )
488 fgSizer1.Add( mirror_text, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
489 fgSizer1.Add( wx.StaticText(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 ), wx.ID_ANY, wx.ALL, 5)
490 self.mirror_value = wx.TextCtrl( self, wx.ID_ANY, u'http://cran.univ-lyon1.fr', wx.DefaultPosition, wx.Size( 300,30 ), 0 )
491 fgSizer1.Add( self.mirror_value, 0, wx.ALIGN_RIGHT|wx.ALL, 5 )
494 m_sdbSizer1 = wx.StdDialogButtonSizer()
495 self.m_sdbSizer1OK = wx.Button( self, wx.ID_OK )
496 m_sdbSizer1.AddButton( self.m_sdbSizer1OK )
497 self.m_sdbSizer1Cancel = wx.Button( self, wx.ID_CANCEL )
498 m_sdbSizer1.AddButton( self.m_sdbSizer1Cancel )
499 m_sdbSizer1.Realize()
500 bSizer1.Add( m_sdbSizer1, 0, wx.EXPAND, 5 )
502 self.SetSizer( bSizer1 )
506 self.Centre( wx.BOTH )
509 self.m_sdbSizer1OK.Bind( wx.EVT_BUTTON, self.OnValid )
510 self.m_button1.Bind( wx.EVT_BUTTON, parent.OnVerif )
511 self.check_svdc.Bind( wx.EVT_CHECKBOX, self.OnSVDC )
512 self.__set_properties()
514 def __set_properties(self):
515 self.SetTitle(u"Préférences")
516 if self.parent.pref.getboolean('iramuteq', 'sound'): val1 = 0
518 self.m_radioBox1.SetSelection(val1)
519 if self.parent.pref.getboolean('iramuteq', 'checkupdate') : val2 = 0
521 self.m_radioBox2.SetSelection(val2)
522 self.langues.SetSelection(self.listlangues.index(self.parent.pref.get('iramuteq', 'guilanguage')))
523 if sys.platform == 'win32' :
524 if self.parent.pref.getboolean('iramuteq', 'R_mem') :
525 self.m_checkBox1.SetValue(True)
526 self.m_spinCtrl1.Enable(True)
527 self.m_spinCtrl1.SetValue(self.parent.pref.getint('iramuteq', 'R_max_mem'))
529 self.m_checkBox1.SetValue(False)
530 self.m_spinCtrl1.Enable(False)
531 if self.parent.pref.getboolean('iramuteq', 'libsvdc') :
532 self.check_svdc.SetValue(True)
533 self.fbb.SetValue(self.parent.pref.get('iramuteq', 'libsvdc_path'))
535 self.check_svdc.SetValue(False)
536 self.fbb.SetValue(self.parent.pref.get('iramuteq', 'libsvdc_path'))
537 self.fbb.Enable(False)
538 self.Rpath_value.SetValue(self.parent.PathPath.get('PATHS', 'rpath'))
539 self.mirror_value.SetValue(self.parent.pref.get('iramuteq', 'rmirror'))
541 def oncheckmem(self, evt):
542 if self.m_checkBox1.GetValue() :
543 self.m_spinCtrl1.Enable(True)
545 self.m_spinCtrl1.Enable(False)
547 def OnSVDC(self, evt):
548 if self.check_svdc.GetValue() :
549 self.fbb.Enable(True)
551 self.fbb.Enable(False)
553 def OnValid(self, event):
555 if self.m_radioBox1.GetSelection() == 0 : valsound = 'true'
556 else : valsound = 'false'
557 parent.pref.set('iramuteq', 'sound', valsound)
558 if self.m_radioBox2.GetSelection() == 0 : valcheck = 'true'
559 else : valcheck = 'false'
560 parent.pref.set('iramuteq', 'checkupdate', valcheck)
561 parent.pref.set('iramuteq', 'guilanguage', self.listlangues[self.langues.GetSelection()])
562 if sys.platform == 'win32' :
563 if self.m_checkBox1.GetValue() :
564 parent.pref.set('iramuteq', 'R_mem', 'true')
565 parent.pref.set('iramuteq', 'R_max_mem', str(self.m_spinCtrl1.GetValue()))
567 parent.pref.set('iramuteq', 'R_mem', 'false')
568 if self.check_svdc.GetValue() :
569 parent.pref.set('iramuteq', 'libsvdc', 'true')
571 parent.pref.set('iramuteq', 'libsvdc', 'false')
572 parent.pref.set('iramuteq', 'libsvdc_path', self.fbb.GetValue())
573 self.parent.pref.set('iramuteq', 'rmirror', self.mirror_value.GetValue())
574 file = open(parent.ConfigPath['preferences'], 'w')
575 parent.pref.write(file)
577 self.parent.PathPath.set('PATHS', 'rpath', self.Rpath_value.GetValue())
578 with open(self.parent.ConfigPath['path'], 'w') as f:
579 self.parent.PathPath.write(f)
582 class PrefGraph(wx.Dialog):
583 def __init__(self, parent, ID, paramgraph, title = '', size=wx.DefaultSize, pos=wx.DefaultPosition, style=wx.DEFAULT_DIALOG_STYLE):
585 pre.SetExtraStyle(wx.DIALOG_EX_CONTEXTHELP)
586 pre.Create(parent, ID, title, pos, size, style)
589 self.paramgraph=paramgraph
590 self.labeltype = wx.StaticText(self, -1, u'Type de graph')
591 if self.paramgraph['clnb'] <= 3 :
595 self.choicetype = wx.Choice(self, -1, (100,50), choices=choix)
596 self.label_format = wx.StaticText(self, -1, u"Format de l'image")
597 self.choix_format = wx.Choice(self, -1, (100,50), choices = ['png', 'svg'])
598 self.label_1 = wx.StaticText(self, -1, u'Largeur')
599 self.spin1 = wx.SpinCtrl(self, -1, '',size = (100,30), min=100, max=5000)
600 self.label_2 = wx.StaticText(self, -1, u'Hauteur')
601 self.spin2 = wx.SpinCtrl(self, -1, '', size = (100,30), min=100, max=5000)
602 self.label_what = wx.StaticText(self, -1, u'Représentation')
603 self.choice1 = wx.Choice(self, -1, (100,50), choices=[u'coordonnées' ,u'corrélation'])
604 self.label_qui = wx.StaticText(self, -1, u'Variables')
605 self.choice2 = wx.Choice(self, -1, (100,50), choices=[u'actives' ,u'supplémentaires', u'étoilées', 'classes'])
606 self.label_3 = wx.StaticText(self, -1, u'Taille du texte')
607 self.spin3 = wx.SpinCtrl(self, -1, '', size = (100,30), min=1, max=20)
608 txt = u"""Prendre les x premiers points"""
609 self.label_4 = wx.StaticText(self, -1, txt)
610 self.check1 = wx.CheckBox(self, -1)
611 self.spin_nb = wx.SpinCtrl(self, -1, '', size = (100,30), min=2, max=1000)
612 txt = u"""Prendre les x premiers points par classe"""
613 self.label_chic = wx.StaticText(self, -1, txt)
614 self.check_chic = wx.CheckBox(self, -1)
615 self.spin_nbchic = wx.SpinCtrl(self, -1, '', size = (100,30), min=2, max=1000)
616 txt = u"""Limiter le nombre de points
617 par le chi2 de liaison aux classes"""
618 self.label_5 = wx.StaticText(self, -1, txt)
619 self.check2 = wx.CheckBox(self, -1)
620 self.spin_chi = wx.SpinCtrl(self, -1, '',size = (100,30), min=2, max=1000)
621 self.label_6 = wx.StaticText(self, -1, u'Eliminer les recouvrements')
622 self.check3 = wx.CheckBox(self, -1)
623 txt = u"""Taille du texte proportionnel
624 à l'effectif de la forme"""
625 self.label_7 = wx.StaticText(self, -1, txt)
626 self.check4 = wx.CheckBox(self, -1)
627 self.label_min = wx.StaticText(self, -1, 'min')
628 self.spin_min = wx.SpinCtrl(self, -1, '',size = (100,30), min = 1, max = 100)
629 self.label_max = wx.StaticText(self, -1, 'max')
630 self.spin_max = wx.SpinCtrl(self, -1, '',size = (100,30), min = 1, max = 100)
631 txt = u"""Taille du texte proportionnel
632 au chi2 d'association de la forme"""
633 self.label_tchi = wx.StaticText(self, -1, txt)
634 self.check_tchi = wx.CheckBox(self, -1)
635 self.label_min_tchi = wx.StaticText(self, -1, 'min')
636 self.spin_min_tchi = wx.SpinCtrl(self, -1, '', size = (100,30), min = 1, max = 100)
637 self.label_max_tchi = wx.StaticText(self, -1, 'max')
638 self.spin_max_tchi = wx.SpinCtrl(self, -1, '', size = (100,30), min = 1, max = 100)
639 self.label_8 = wx.StaticText(self, -1, 'Facteur x :')
640 self.spin_f1 = wx.SpinCtrl(self, -1, '',size = (100,30), min=1, max=self.paramgraph['clnb']-1)
641 self.label_9 = wx.StaticText(self, -1, 'Facteur y :')
642 self.spin_f2 = wx.SpinCtrl(self, -1, '',size = (100,30), min=1, max=self.paramgraph['clnb']-1)
643 self.label_f3 = wx.StaticText(self, -1, 'Facteur z :')
644 self.spin_f3 = wx.SpinCtrl(self, -1, '',size = (100,30), min=1, max=self.paramgraph['clnb']-1)
645 self.label_sphere = wx.StaticText(self, -1, u"Transparence des sphères")
646 self.slider_sphere = wx.Slider(self, -1, 10, 1, 100, size = (255,-1), style = wx.SL_HORIZONTAL | wx.SL_AUTOTICKS | wx.SL_LABELS)
648 self.label_film = wx.StaticText(self, -1, 'Faire un film')
649 self.film = wx.CheckBox(self, -1)
651 self.btnsizer = wx.StdDialogButtonSizer()
652 if wx.Platform != "__WXMSW__":
653 btn = wx.ContextHelpButton(self)
654 self.btnsizer.AddButton(btn)
655 btn = wx.Button(self, wx.ID_OK)
656 btn.SetHelpText("Ok")
658 self.btnsizer.AddButton(btn)
659 btn = wx.Button(self, wx.ID_CANCEL)
660 btn.SetHelpText("Annuler")
661 self.btnsizer.AddButton(btn)
662 self.btnsizer.Realize()
664 self.Bind(wx.EVT_CHECKBOX, self.OnCheck1, self.check1)
665 self.Bind(wx.EVT_CHECKBOX, self.OnCheck2, self.check2)
666 self.Bind(wx.EVT_CHECKBOX, self.OnNorm, self.check4)
667 self.Bind(wx.EVT_CHECKBOX, self.OnCheckTchi, self.check_tchi)
668 self.Bind(wx.EVT_CHOICE, self.On3D, self.choicetype)
669 self.Bind(wx.EVT_CHOICE, self.OnPass, self.choice2)
670 self.Bind(wx.EVT_CHECKBOX, self.OnCheckChic, self.check_chic)
671 self.__set_properties()
672 self.OnNorm(wx.EVT_CHECKBOX)
673 self.OnCheckTchi(wx.EVT_CHECKBOX)
676 def __set_properties(self):
677 self.choicetype.SetSelection(self.paramgraph['typegraph'])
678 if self.paramgraph['typegraph'] == 0 :
679 self.film.Enable(False)
680 self.spin_f3.Enable(False)
681 self.slider_sphere.Enable(False)
682 self.choix_format.SetSelection(self.paramgraph['svg'])
683 self.choice1.SetSelection(self.paramgraph['what'])
684 self.choice2.SetSelection(self.paramgraph['qui'])
685 self.spin_chi.SetValue(self.paramgraph['select_nb'])
686 self.spin_nb.SetValue(self.paramgraph['select_chi'])
687 self.spin1.SetValue(self.paramgraph['width'])
688 self.spin2.SetValue(self.paramgraph['height'])
689 self.spin3.SetValue(self.paramgraph['taillecar'])
690 self.spin_nb.SetValue(self.paramgraph['select_nb'])
691 self.spin_chi.SetValue(self.paramgraph['select_chi'])
692 self.spin_nbchic.SetValue(self.paramgraph['nbchic'])
693 self.check1.SetValue(self.paramgraph['do_select_nb'])
694 self.check2.SetValue(self.paramgraph['do_select_chi'])
695 self.check_chic.SetValue(self.paramgraph['do_select_chi_classe'])
696 self.check3.SetValue(self.paramgraph['over'])
697 if self.paramgraph['do_select_nb'] :
698 self.spin_nb.Enable(True)
699 self.spin_chi.Enable(False)
700 self.spin_nbchic.Enable(False)
701 elif self.paramgraph['do_select_chi_classe'] :
702 self.spin_nb.Enable(False)
703 self.spin_chi.Enable(False)
704 self.spin_nbchic.Enable(True)
705 elif self.paramgraph['do_select_chi'] :
706 self.spin_nb.Enable(False)
707 self.spin_chi.Enable(True)
708 self.spin_nbchic.Enable(False)
710 self.spin_nb.Enable(False)
711 self.spin_chi.Enable(False)
712 self.spin_nbchic.Enable(False)
715 self.check4.SetValue(self.paramgraph['cex_txt'])
716 self.spin_min.SetValue(self.paramgraph['txt_min'])
717 self.spin_max.SetValue(self.paramgraph['txt_max'])
718 self.check_tchi.SetValue(self.paramgraph['tchi'])
719 self.spin_min_tchi.SetValue(self.paramgraph['tchi_min'])
720 self.spin_max_tchi.SetValue(self.paramgraph['tchi_max'])
722 self.spin_f1.SetValue(self.paramgraph['facteur'][0])
723 self.spin_f2.SetValue(self.paramgraph['facteur'][1])
724 self.spin_f3.SetValue(self.paramgraph['facteur'][2])
725 self.slider_sphere.SetValue(self.paramgraph['alpha'])
727 def __do_layout(self):
728 sizer_2 = wx.BoxSizer(wx.VERTICAL)
729 fsizer = wx.FlexGridSizer(0,2,0,5)
730 grid_min = wx.FlexGridSizer(0, 2, 0, 0)
731 grid_max = wx.FlexGridSizer(0, 2, 0, 0)
732 grid_minmax = wx.FlexGridSizer(0, 2, 0, 0)
733 grid_min_tchi = wx.FlexGridSizer(0, 2, 0, 0)
734 grid_max_tchi = wx.FlexGridSizer(0, 2, 0, 0)
735 grid_minmax_tchi = wx.FlexGridSizer(0, 2, 0, 0)
737 sizer_3 = wx.BoxSizer(wx.VERTICAL)
739 fsizer.Add(self.labeltype, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
740 fsizer.Add(self.choicetype, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
741 fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
742 fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
744 fsizer.Add(self.label_format, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
745 fsizer.Add(self.choix_format, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
746 fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
747 fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
749 fsizer.Add(self.label_what, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
750 fsizer.Add(self.choice1, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
751 fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
752 fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
754 fsizer.Add(self.label_qui, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
755 fsizer.Add(self.choice2, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
756 fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
757 fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
759 sizer_h1 = wx.BoxSizer(wx.HORIZONTAL)
760 sizer_h1.Add(self.label_1, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
761 sizer_h1.Add(self.spin1, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
762 fsizer.Add(sizer_h1, 0, wx.ALL, 5)
763 sizer_h2 = wx.BoxSizer(wx.HORIZONTAL)
764 sizer_h2.Add(self.label_2, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
765 sizer_h2.Add(self.spin2, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
766 fsizer.Add(sizer_h2, 0, wx.ALL, 5)
767 fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
768 fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
770 fsizer.Add(self.label_3, 0, wx.ALL | wx.LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
771 fsizer.Add(self.spin3, 0, wx.ALL | wx.LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
772 fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
773 fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
775 fsizer.Add(self.label_4, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
776 sizer_nb = wx.BoxSizer(wx.HORIZONTAL)
777 sizer_nb.Add(self.check1, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
778 sizer_nb.Add(self.spin_nb, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
779 fsizer.Add(sizer_nb, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
780 fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
781 fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
783 fsizer.Add(self.label_chic, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
784 sizer_nbchic = wx.BoxSizer(wx.HORIZONTAL)
785 sizer_nbchic.Add(self.check_chic, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
786 sizer_nbchic.Add(self.spin_nbchic, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
787 fsizer.Add(sizer_nbchic, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
788 fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
789 fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
791 fsizer.Add(self.label_5, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
792 sizer_chi = wx.BoxSizer(wx.HORIZONTAL)
793 sizer_chi.Add(self.check2, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
794 sizer_chi.Add(self.spin_chi, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
795 fsizer.Add(sizer_chi, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
796 fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
797 fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
799 fsizer.Add(self.label_6, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL| wx.ADJUST_MINSIZE, 5)
800 fsizer.Add(self.check3, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 5)
801 fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
802 fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
804 sizer_2.Add(fsizer, 0, wx.EXPAND, 0)
806 bsizer_1 = wx.FlexGridSizer(0,3,0,0)
807 bsizer_1.Add(self.label_7, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
808 bsizer_1.Add(self.check4, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL|wx.EXPAND, 5)
809 grid_min.Add(self.label_min, 0,wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
810 grid_min.Add(self.spin_min, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
811 grid_max.Add(self.label_max, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
812 grid_max.Add(self.spin_max, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
813 grid_minmax.Add(grid_min, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
814 grid_minmax.Add(grid_max, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
816 bsizer_1.Add(grid_minmax, 0, wx.ALL, 5)
818 bsizer_1.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
819 bsizer_1.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
820 bsizer_1.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
822 bsizer_1.Add(self.label_tchi, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
823 bsizer_1.Add(self.check_tchi, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL|wx.EXPAND, 5)
824 grid_min_tchi.Add(self.label_min_tchi, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
825 grid_min_tchi.Add(self.spin_min_tchi, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
826 grid_max_tchi.Add(self.label_max_tchi, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
827 grid_max_tchi.Add(self.spin_max_tchi, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
828 grid_minmax_tchi.Add(grid_min_tchi, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
829 grid_minmax_tchi.Add(grid_max_tchi, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
831 bsizer_1.Add(grid_minmax_tchi, 0, wx.ALL, 5)
832 sizer_2.Add(bsizer_1, 0, wx.EXPAND, 5)
834 sizer_2.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
836 sizer_f = wx.BoxSizer(wx.HORIZONTAL)
837 sizer_f.Add(self.label_8, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
838 sizer_f.Add(self.spin_f1, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
840 sizer_f.Add(self.label_9, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
841 sizer_f.Add(self.spin_f2, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
843 sizer_f.Add(self.label_f3, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
844 sizer_f.Add(self.spin_f3, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
845 sizer_2.Add(sizer_f, 0, wx.EXPAND, 5)
847 sizer_2.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 5)
849 fsizer2 = wx.FlexGridSizer(0,2,0,0)
850 fsizer2.Add(self.label_sphere, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
851 fsizer2.Add(self.slider_sphere, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
852 fsizer2.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
853 fsizer2.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
855 fsizer2.Add(self.label_film, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
856 fsizer2.Add(self.film, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
857 sizer_2.Add(fsizer2, 0, wx.EXPAND, 5)
858 sizer_2.Add(self.btnsizer, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_CENTER_HORIZONTAL, 5)
859 self.SetSizer(sizer_2)
863 def OnCheck1(self, event):
864 if self.check1.GetValue() :
865 self.check2.SetValue(False)
866 self.check_chic.SetValue(False)
867 self.spin_chi.Enable(False)
868 self.spin_nb.Enable(True)
869 self.spin_nbchic.Enable(False)
871 self.spin_nb.Enable(False)
873 def OnCheck2(self, event):
874 if self.check2.GetValue() :
875 self.check1.SetValue(False)
876 self.check_chic.SetValue(False)
877 self.spin_chi.Enable(True)
878 self.spin_nb.Enable(False)
879 self.spin_nbchic.Enable(False)
881 self.spin_chi.Enable(False)
883 def OnCheckChic(self, event) :
884 if self.check_chic.GetValue() :
885 self.check1.SetValue(False)
886 self.check2.SetValue(False)
887 self.spin_chi.Enable(False)
888 self.spin_nb.Enable(False)
889 self.spin_nbchic.Enable(True)
891 self.spin_nbchic.Enable(False)
893 def OnNorm(self, event):
894 if not self.check4.GetValue() :
895 self.spin_min.Disable()
896 self.spin_max.Disable()
898 self.spin_min.Enable(True)
899 self.spin_max.Enable(True)
900 self.check_tchi.SetValue(False)
901 self.OnCheckTchi(wx.EVT_CHECKBOX)
903 def OnCheckTchi(self, evt) :
904 if not self.check_tchi.GetValue() :
905 self.spin_min_tchi.Disable()
906 self.spin_max_tchi.Disable()
908 self.spin_min_tchi.Enable(True)
909 self.spin_max_tchi.Enable(True)
910 self.check4.SetValue(False)
911 self.OnNorm(wx.EVT_CHECKBOX)
913 def On3D(self, event) :
914 if event.GetString() == u'3D' :
915 self.film.Enable(True)
916 self.spin_f3.Enable(True)
917 self.slider_sphere.Enable(True)
919 self.film.Enable(False)
920 self.spin_f3.Enable(False)
921 self.slider_sphere.Enable(False)
923 def OnPass(self,evt) :
924 if evt.GetString() == u'classes' :
925 self.check4.SetValue(False)
926 self.check4.Enable(False)
927 self.OnNorm(wx.EVT_CHECKBOX)
932 class SelectColDial ( wx.Dialog ):
934 def __init__( self, parent ):
935 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 )
937 self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
939 self.bSizer2 = wx.BoxSizer( wx.VERTICAL )
941 #self.m_checkList2 = wx.CheckListBox( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, ['r','t','y'], 0 )
942 #bSizer2.Add( self.m_checkList2, 2, wx.ALL|wx.EXPAND, 5 )
944 self.m_sdbSizer2 = wx.StdDialogButtonSizer()
945 self.m_sdbSizer2OK = wx.Button( self, wx.ID_CANCEL)
946 self.butok = wx.Button( self, wx.ID_OK)
947 #m_sdbSizer2.AddButton( self.m_sdbSizer2OK )
948 #self.m_sdbSizer2Cancel = wx.Button( self, wx.ID_CANCEL )
949 #m_sdbSizer2.AddButton( self.m_sdbSizer2Cancel )
950 #m_sdbSizer2.Realize();
951 #self.bSizer2.Add( m_sdbSizer2, 0, wx.EXPAND, 5 )
953 self.SetSizer( self.bSizer2 )
956 self.Centre( wx.BOTH )
961 class PrefExport(wx.Dialog):
962 def __init__(self, parent, *args, **kwds):
963 kwds['style'] = wx.OK|wx.DEFAULT_DIALOG_STYLE
964 wx.Dialog.__init__(self, *args, **kwds)
967 sizer = wx.BoxSizer(wx.VERTICAL)
968 box = wx.BoxSizer(wx.HORIZONTAL)
969 box3 = wx.BoxSizer(wx.HORIZONTAL)
970 self.label_lem = wx.StaticText(self, -1, u"Corpus Lemmatisé")
971 box3.Add(self.label_lem, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
972 self.radio_lem = wx.RadioBox(self, -1, u"", choices=['oui', 'non'], majorDimension=0, style=wx.RA_SPECIFY_ROWS)
973 box3.Add(self.radio_lem, 0, wx.ALIGN_RIGHT, 5)
974 sizer.Add(box3, 0, wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5)
975 self.label_txt = wx.StaticText(self, -1, u"Exporter pour...")
976 box.Add(self.label_txt, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
977 self.radio_type = wx.RadioBox(self, -1, u"", choices=['IRaMuTeQ/ALCESTE', 'Lexico'], majorDimension=0, style=wx.RA_SPECIFY_ROWS)
978 box.Add(self.radio_type, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
979 sizer.Add(box, 0, wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5)
980 box2 = wx.BoxSizer(wx.HORIZONTAL)
981 self.txt2 = wx.StaticText(self, -1, u"Fichier en sortie")
982 box2.Add(self.txt2, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
983 self.fbb = filebrowse.FileBrowseButton(self, -1, size=(450, -1), fileMode = 2)
984 box2.Add(self.fbb, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
985 self.fbb.SetLabel("")
986 sizer.Add(box2, 0, wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5)
988 btnsizer = wx.StdDialogButtonSizer()
989 btn = wx.Button(self, wx.ID_CANCEL)
990 btnsizer.AddButton(btn)
991 btn_ok = wx.Button(self, wx.ID_OK)
993 btnsizer.AddButton(btn_ok)
995 sizer.Add(btnsizer, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL|wx.ALIGN_RIGHT, 5)
996 self.Bind(wx.EVT_BUTTON, self.check_file, btn_ok)
1000 def check_file(self, evt) :
1001 if evt.GetId() == wx.ID_OK :
1002 if os.path.exists(self.fbb.GetValue()):
1003 dlg = wx.MessageDialog(self, u"%s\nCe fichier existe, continuer quand même ?" % self.fbb.GetValue(), 'ATTENTION', wx.NO | wx.YES | wx.ICON_WARNING)
1004 dlg.CenterOnParent()
1005 if dlg.ShowModal() not in [wx.ID_NO, wx.ID_CANCEL]:
1006 self.EndModal(wx.ID_OK)
1008 self.EndModal(wx.ID_OK)
1010 self.EndModal(wx.ID_CANCEL)
1012 class PrefProfTypes(wx.Dialog):
1013 def __init__(self, parent, *args, **kwds):
1014 kwds['style'] = wx.OK|wx.DEFAULT_DIALOG_STYLE
1015 wx.Dialog.__init__(self, parent, *args, **kwds)
1017 self.parent = parent
1018 sizer = wx.BoxSizer(wx.VERTICAL)
1019 box = wx.BoxSizer(wx.HORIZONTAL)
1020 box3 = wx.BoxSizer(wx.HORIZONTAL)
1021 self.label_txt = wx.StaticText(self, -1, u"Préférences")
1022 box.Add(self.label_txt, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
1023 self.radio_type = wx.RadioBox(self, -1, u"", choices=['comme ALCESTE', 'comme Lexico'], majorDimension=0, style=wx.RA_SPECIFY_ROWS)
1024 box.Add(self.radio_type, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
1025 sizer.Add(box, 0, wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5)
1026 box2 = wx.BoxSizer(wx.HORIZONTAL)
1027 self.txt2 = wx.StaticText(self, -1, u"Fichier en sortie")
1028 box2.Add(self.txt2, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
1029 self.fbb = filebrowse.FileBrowseButton(self, -1, size=(450, -1), fileMode = 2)
1030 box2.Add(self.fbb, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
1031 self.fbb.SetLabel("")
1032 sizer.Add(box2, 0, wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5)
1034 btnsizer = wx.StdDialogButtonSizer()
1035 btn = wx.Button(self, wx.ID_CANCEL)
1036 btnsizer.AddButton(btn)
1037 btn_ok = wx.Button(self, wx.ID_OK)
1039 btnsizer.AddButton(btn_ok)
1041 sizer.Add(btnsizer, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL|wx.ALIGN_RIGHT, 5)
1042 #self.Bind(wx.EVT_BUTTON, self.check_file, btn_ok)
1043 self.SetSizer(sizer)
1046 class PrefSimpleFile(wx.Dialog):
1047 def __init__(self, parent, *args, **kwds):
1048 kwds['style'] = wx.OK|wx.DEFAULT_DIALOG_STYLE
1050 self.mask = kwds['mask']
1052 else : self.mask = '*.*'
1053 wx.Dialog.__init__(self, *args, **kwds)
1055 self.parent = parent
1056 sizer = wx.BoxSizer(wx.VERTICAL)
1057 box2 = wx.BoxSizer(wx.HORIZONTAL)
1058 self.txt2 = wx.StaticText(self, -1, u"Fichier en sortie")
1059 box2.Add(self.txt2, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
1060 self.fbb = filebrowse.FileBrowseButton(self, -1, size=(450, -1), fileMode = 2, fileMask = self.mask)
1061 box2.Add(self.fbb, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
1062 self.fbb.SetLabel("")
1063 sizer.Add(box2, 0, wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5)
1065 btnsizer = wx.StdDialogButtonSizer()
1066 btn = wx.Button(self, wx.ID_CANCEL)
1067 btnsizer.AddButton(btn)
1068 btn_ok = wx.Button(self, wx.ID_OK)
1070 btnsizer.AddButton(btn_ok)
1072 sizer.Add(btnsizer, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL|wx.ALIGN_RIGHT, 5)
1073 self.Bind(wx.EVT_BUTTON, self.check_file, btn_ok)
1074 self.SetSizer(sizer)
1077 def check_file(self, evt) :
1078 if evt.GetId() == wx.ID_OK :
1079 if os.path.exists(self.fbb.GetValue()):
1080 dlg = wx.MessageDialog(self, u"%s\nCe fichier existe, continuer quand même ?" % self.fbb.GetValue(), 'ATTENTION', wx.NO | wx.YES | wx.ICON_WARNING)
1081 dlg.CenterOnParent()
1082 if dlg.ShowModal() not in [wx.ID_NO, wx.ID_CANCEL]:
1083 self.EndModal(wx.ID_OK)
1085 self.EndModal(wx.ID_OK)
1087 self.EndModal(wx.ID_CANCEL)
1090 class StatDialog(wx.Dialog):
1091 def __init__(self, parent, *args, **kwds):
1092 kwds['style'] = wx.DEFAULT_DIALOG_STYLE
1093 wx.Dialog.__init__(self, *args, **kwds)
1095 self.parent = parent
1096 self.label_lem = wx.StaticText(self, -1, u"Lemmatisation")
1097 self.radio_lem = wx.RadioBox(self, -1, u"", choices=['oui', 'non'], majorDimension=0, style=wx.RA_SPECIFY_ROWS)
1098 #txt = u"""Fréquence minimum d'une forme
1099 #analysée (0 = non utilisé)"""
1100 #self.label_8 = wx.StaticText(self, -1, txt)
1101 #self.spin_ctrl_5 = wx.SpinCtrl(self, -1, "",size = (100,30), min=0, max=1000, initial=0)
1102 #self.label_max_actives = wx.StaticText(self, -1, u"Nombre maximum de formes analysées")
1103 #self.spin_max_actives = wx.SpinCtrl(self, -1, "",size = (100,30), min=20, max=10000, initial=1500)
1104 self.label_4 = wx.StaticText(self, -1, u"Configuration des clés d'analyse")
1105 self.button_5 = wx.Button(self, wx.ID_PREFERENCES, "")
1107 #self.Bind(wx.EVT_CHECKBOX, self.OnCheckUce, self.check_uce)
1108 #self.Bind(wx.EVT_SPINCTRL, self.OnSpin, self.spin_ctrl_5)
1109 self.Bind(wx.EVT_BUTTON, self.OnKeys, self.button_5)
1111 self.__set_properties()
1113 def __do_layout(self) :
1114 first = wx.BoxSizer(wx.VERTICAL)
1115 sizer = wx.FlexGridSizer(0,2,0,0)
1116 sizer.Add(self.label_lem, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
1117 sizer.Add(self.radio_lem, 0, wx.ALIGN_LEFT, 5)
1118 sizer.Add(wx.StaticLine(self),0, wx.ALIGN_LEFT, 5)
1119 sizer.Add(wx.StaticLine(self),0, wx.ALIGN_LEFT, 5)
1120 #sizer.Add(self.txt_exp, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
1121 #sizer.Add(self.exp, 0, wx.ALIGN_RIGHT, 5)
1122 #sizer.Add(self.label_uce, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
1123 #sizer.Add(self.check_uce, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
1124 #sizer.Add(self.label_occuce, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
1125 #sizer.Add(self.spin_ctrl_4, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
1126 #sizer.Add(self.label_8, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
1127 #sizer.Add(self.spin_ctrl_5, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
1128 #sizer.Add(self.label_max_actives, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
1129 #sizer.Add(self.spin_max_actives, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
1130 sizer.Add(self.label_4, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
1131 sizer.Add(self.button_5, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
1132 sizer.Add(wx.StaticLine(self),0, wx.ALIGN_LEFT, 5)
1133 sizer.Add(wx.StaticLine(self),0, wx.ALIGN_LEFT, 5)
1134 #sizer.Add(box2, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT, 5)
1135 first.Add(sizer, 0, wx.ALL, 5)
1136 btnsizer = wx.StdDialogButtonSizer()
1137 btn = wx.Button(self, wx.ID_CANCEL)
1138 btnsizer.AddButton(btn)
1139 btn_ok = wx.Button(self, wx.ID_OK)
1141 btnsizer.AddButton(btn_ok)
1143 first.Add(btnsizer, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT, 5)
1144 self.SetSizer(first)
1147 def __set_properties(self) :
1148 self.SetTitle(u'Préférences')
1150 def OnKeys(self, evt):
1151 dial = AlcOptFrame(self, self.parent.parent)
1152 dial.CenterOnParent()
1154 for i in range(0,len(dial.listlabel)):
1155 dial.keys[dial.listcle[i]] = dial.listspin[i].GetValue()
1156 DoConf().makeoptions(['KEY'], [dial.keys], outfile = self.parent.parent.ConfigPath['key'])
1159 class LexDialog( wx.Dialog ):
1161 def __init__( self, parent ):
1162 wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = wx.EmptyString, pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.DEFAULT_DIALOG_STYLE )
1164 self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
1166 bSizer2 = wx.BoxSizer( wx.VERTICAL )
1168 fgSizer2 = wx.FlexGridSizer( 0, 2, 0, 0 )
1169 fgSizer2.SetFlexibleDirection( wx.BOTH )
1170 fgSizer2.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
1172 self.m_staticText9 = wx.StaticText( self, wx.ID_ANY, u"Lemmatisation", wx.DefaultPosition, wx.DefaultSize, 0 )
1173 self.m_staticText9.Wrap( -1 )
1174 fgSizer2.Add( self.m_staticText9, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 3 )
1176 m_radioBox2Choices = [ u"oui", u"non" ]
1177 self.m_radioBox2 = wx.RadioBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, m_radioBox2Choices, 1, wx.RA_SPECIFY_COLS )
1178 self.m_radioBox2.SetSelection( 0 )
1179 fgSizer2.Add( self.m_radioBox2, 0, wx.ALIGN_RIGHT|wx.ALL, 3 )
1181 # self.m_staticText10 = wx.StaticText( self, wx.ID_ANY, u"Utiliser le Dict. des expressions", wx.DefaultPosition, wx.DefaultSize, 0 )
1182 # self.m_staticText10.Wrap( -1 )
1183 # fgSizer2.Add( self.m_staticText10, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 3 )
1185 # m_radioBox21Choices = [ u"oui", u"non" ]
1186 # self.m_radioBox21 = wx.RadioBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, m_radioBox21Choices, 1, wx.RA_SPECIFY_COLS )
1187 # self.m_radioBox21.SetSelection( 0 )
1188 # fgSizer2.Add( self.m_radioBox21, 0, wx.ALIGN_RIGHT|wx.ALL, 3 )
1189 # bSizer2.Add( fgSizer2, 1, wx.EXPAND, 5 )
1191 btnsizer = wx.StdDialogButtonSizer()
1192 btn = wx.Button(self, wx.ID_CANCEL)
1193 btnsizer.AddButton(btn)
1194 btn_ok = wx.Button( self, wx.ID_OK)
1196 btnsizer.AddButton(btn_ok)
1199 bSizer2.Add(btnsizer, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT, 5)
1200 self.SetSizer( bSizer2 )
1203 self.Centre( wx.BOTH )
1205 class PrefUCECarac(wx.Dialog):
1206 def __init__(self, parent, *args, **kwds):
1207 kwds['style'] = wx.DEFAULT_DIALOG_STYLE
1208 kwds['title'] = u"Segments de texte caractéristiques"
1209 wx.Dialog.__init__(self, *args, **kwds)
1210 self.parent = parent
1211 first = wx.BoxSizer(wx.VERTICAL)
1212 sizer = wx.FlexGridSizer(0,2,0,0)
1213 self.label_type = wx.StaticText(self, -1, u"Score de classement")
1214 sizer.Add(self.label_type, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
1215 self.radio_type = wx.RadioBox(self, -1, u"", choices=[u'absolu (somme des chi2 des formes marquées du segment)', u'relatif (moyenne des chi2 des formes marquées du segment)'], majorDimension=0, style=wx.RA_SPECIFY_ROWS)
1216 sizer.Add(self.radio_type, 0, wx.ALIGN_RIGHT, 5)
1217 self.txt_eff = wx.StaticText(self, -1, u"Nombre maximum de segments de texte")
1218 sizer.Add(self.txt_eff, 0, wx.ALIGN_CENTRE, 5)
1219 self.spin_eff = wx.SpinCtrl(self, -1, '', size = (100, 30), min = 1, max = 100000, initial = 50)
1220 self.spin_eff.SetValue(50)
1221 sizer.Add(self.spin_eff, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
1222 first.Add(sizer, 0, wx.ALL, 5)
1223 btnsizer = wx.StdDialogButtonSizer()
1224 btn = wx.Button(self, wx.ID_CANCEL)
1225 btnsizer.AddButton(btn)
1226 btn_ok = wx.Button(self, wx.ID_OK)
1228 btnsizer.AddButton(btn_ok)
1230 first.Add(btnsizer, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT, 5)
1231 self.SetSizer(first)
1234 class PrefSegProf(wx.Dialog) :
1235 def __init__( self, parent ):
1236 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 )
1238 self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
1239 bSizer1 = wx.BoxSizer( wx.VERTICAL )
1240 txt = u"ATTENTION : le calcul des profils des segments répétés\npeut être très long sur les corpus importants"
1241 self.label = wx.StaticText( self, wx.ID_ANY, txt, wx.DefaultPosition, wx.DefaultSize, 0 )
1242 bSizer1.Add( self.label, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5 )
1244 fgSizer1 = wx.FlexGridSizer( 0, 2, 0, 0 )
1245 fgSizer1.SetFlexibleDirection( wx.BOTH )
1246 fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
1248 self.m_staticText1 = wx.StaticText( self, wx.ID_ANY, u"Corpus lemmatisé", wx.DefaultPosition, wx.DefaultSize, 0 )
1249 self.m_staticText1.Wrap( -1 )
1250 fgSizer1.Add( self.m_staticText1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1252 box_lemChoices = [ u"oui", u"non" ]
1253 self.box_lem = wx.RadioBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, box_lemChoices, 1, wx.RA_SPECIFY_COLS )
1254 self.box_lem.SetSelection( 1 )
1255 fgSizer1.Add( self.box_lem, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1256 #self.box_lem.Enable(False)
1258 self.m_staticText3 = wx.StaticText( self, wx.ID_ANY, u"Taille minimum des segments", wx.DefaultPosition, wx.DefaultSize, 0 )
1259 self.m_staticText3.Wrap( -1 )
1260 fgSizer1.Add( self.m_staticText3, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1262 self.spin_min = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, (100,30), wx.SP_ARROW_KEYS, 2, 30, 2 )
1263 self.spin_min.SetValue(2)
1264 fgSizer1.Add( self.spin_min, 0, wx.ALL, 5 )
1266 self.m_staticText4 = wx.StaticText( self, wx.ID_ANY, u"Taille maximum des segments", wx.DefaultPosition, wx.DefaultSize, 0 )
1267 self.m_staticText4.Wrap( -1 )
1268 fgSizer1.Add( self.m_staticText4, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1270 self.spin_max = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, (100,30), wx.SP_ARROW_KEYS, 2, 30, 10 )
1271 self.spin_max.SetValue(10)
1272 fgSizer1.Add( self.spin_max, 0, wx.ALL, 5 )
1274 self.m_staticText5 = wx.StaticText( self, wx.ID_ANY, u"Effectif minimum d'un segment retenu", wx.DefaultPosition, wx.DefaultSize, 0 )
1275 self.m_staticText5.Wrap( -1 )
1276 fgSizer1.Add( self.m_staticText5, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1278 self.spin_eff = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, (100,30), wx.SP_ARROW_KEYS, 4, 1000, 4 )
1279 self.spin_eff.SetValue(4)
1280 fgSizer1.Add( self.spin_eff, 0, wx.ALL, 5 )
1282 bSizer1.Add( fgSizer1, 1, wx.EXPAND, 5 )
1283 btnsizer = wx.StdDialogButtonSizer()
1284 btn = wx.Button(self, wx.ID_CANCEL)
1285 btnsizer.AddButton(btn)
1286 btn_ok = wx.Button(self, wx.ID_OK)
1288 btnsizer.AddButton(btn_ok)
1290 bSizer1.Add(btnsizer, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT, 5)
1292 self.SetSizer( bSizer1 )
1296 self.Centre( wx.BOTH )
1298 class PrefQuestAlc ( wx.Dialog ):
1300 def __init__( self, parent, sim = False):
1301 wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = u'Classification', pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.DEFAULT_DIALOG_STYLE )
1303 self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
1305 #---------------------------------------------------------------
1306 #self.content = parent.content[:]
1307 self.header = parent.tableau.get_colnames()
1308 labels = [val for val in self.header]
1309 self.labels_tot = labels
1312 #---------------------------------------------------------------
1313 bSizer2 = wx.BoxSizer( wx.VERTICAL )
1315 fgSizer1 = wx.FlexGridSizer( 0, 2, 0, 0 )
1316 fgSizer1.SetFlexibleDirection( wx.BOTH )
1317 fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
1320 self.lab_format = wx.StaticText( self, wx.ID_ANY, u"Le corpus est formaté", wx.DefaultPosition, wx.DefaultSize, 0 )
1321 self.lab_format.Wrap( -1 )
1322 fgSizer1.Add( self.lab_format, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1324 m_radioBox1Choices = [ u"oui", u"non" ]
1325 self.m_radioBox1 = wx.RadioBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, m_radioBox1Choices, 1, wx.RA_SPECIFY_COLS )
1326 self.m_radioBox1.SetSelection( 0 )
1327 fgSizer1.Add( self.m_radioBox1, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1329 self.m_staticText3 = wx.StaticText( self, wx.ID_ANY, u"Variables actives (min = 3) :", wx.DefaultPosition, wx.DefaultSize, 0 )
1330 self.m_staticText3.Wrap( -1 )
1331 fgSizer1.Add( self.m_staticText3, 0, wx.ALL, 5 )
1333 self.m_staticText2 = wx.StaticText( self, wx.ID_ANY, u"Variables illustratives (min = 1):", wx.DefaultPosition, wx.DefaultSize, 0 )
1334 self.m_staticText2.Wrap( -1 )
1335 fgSizer1.Add( self.m_staticText2, 0, wx.ALL, 5 )
1337 self.ListActive = wx.ListBox( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, labels, wx.LB_EXTENDED )
1338 self.ListActive.SetMinSize( wx.Size( 300,250 ) )
1340 fgSizer1.Add( self.ListActive, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL|wx.EXPAND, 5 )
1342 self.ListSup = wx.ListBox( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, labels, wx.LB_EXTENDED )
1343 self.ListSup.SetMinSize( wx.Size( 300,250 ) )
1345 fgSizer1.Add( self.ListSup, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL|wx.EXPAND, 5 )
1347 self.but_suiv = wx.Button( self, wx.ID_ANY, u"Suivant", wx.DefaultPosition, wx.DefaultSize, 0 )
1348 fgSizer1.Add( self.but_suiv, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1350 self.but_prec = wx.Button( self, wx.ID_ANY, u"Précédent", wx.DefaultPosition, wx.DefaultSize, 0 )
1351 fgSizer1.Add( self.but_prec, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1354 self.lab_nbcl = wx.StaticText( self, wx.ID_ANY, u"Nombre de classes terminales de la phase 1", wx.DefaultPosition, wx.DefaultSize, 0 )
1355 self.lab_nbcl.Wrap( -1 )
1356 fgSizer1.Add( self.lab_nbcl, 0, wx.ALL, 5 )
1358 self.spin_nbcl = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 2, 100, 10 )
1359 self.spin_nbcl.SetValue(10)
1360 self.spin_nbcl.SetMinSize( wx.Size( 100,30 ) )
1362 fgSizer1.Add( self.spin_nbcl, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1364 self.lab_mincl = wx.StaticText( self, wx.ID_ANY, u"Effectif minimum d'une classe (2 = automatique)", wx.DefaultPosition, wx.DefaultSize, 0 )
1365 self.lab_mincl.Wrap( -1 )
1366 fgSizer1.Add( self.lab_mincl, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
1368 self.spin_mincl = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 2, 1000, 0 )
1369 self.spin_mincl.SetValue(2)
1370 self.spin_mincl.SetMinSize( wx.Size( 100,30 ) )
1372 fgSizer1.Add( self.spin_mincl, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1374 bSizer2.Add( fgSizer1, 1, wx.EXPAND, 5 )
1376 m_sdbSizer2 = wx.StdDialogButtonSizer()
1377 self.m_sdbSizer2OK = wx.Button( self, wx.ID_OK )
1378 m_sdbSizer2.AddButton( self.m_sdbSizer2OK )
1379 self.m_sdbSizer2Cancel = wx.Button( self, wx.ID_CANCEL )
1380 m_sdbSizer2.AddButton( self.m_sdbSizer2Cancel )
1381 m_sdbSizer2.Realize();
1382 bSizer2.Add( m_sdbSizer2, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT|wx.ALL, 5 )
1384 self.SetSizer( bSizer2 )
1388 self.Centre( wx.BOTH )
1391 self.ListActive.Enable(False)
1392 self.ListSup.Enable(False)
1393 self.but_suiv.Enable(False)
1394 self.but_prec.Enable(False)
1396 self.ListSup.Enable(False)
1397 self.but_prec.Enable(False)
1401 self.m_radioBox1.Bind( wx.EVT_RADIOBOX, self.onformat )
1402 self.but_suiv.Bind(wx.EVT_BUTTON, self.onsuivant)
1403 self.but_prec.Bind(wx.EVT_BUTTON, self.onprec)
1404 self.m_sdbSizer2OK.Bind(wx.EVT_BUTTON, self.onvalid)
1406 def __del__( self ):
1409 # Virtual event handlers, overide them in your derived class
1410 def onformat( self, event ):
1411 if self.m_radioBox1.GetSelection() == 0 :
1412 self.ListActive.Enable(False)
1413 self.ListSup.Enable(False)
1414 self.but_suiv.Enable(False)
1415 self.m_sdbSizer2OK.Enable(True)
1417 self.ListActive.Enable(True)
1418 self.but_suiv.Enable(True)
1419 self.m_sdbSizer2OK.Enable(False)
1421 def onsuivant(self, evt) :
1422 actives = list(self.ListActive.GetSelections())
1424 if len(actives)>=3 and len(actives) != len(self.header) :
1428 header = self.header[:]
1429 for i in range(0, len(header)):
1430 self.hindices.append(i)
1432 self.nactives.append(i)
1433 header.pop(i - compt)
1434 self.hindices.pop(i - compt)
1436 self.labels = [val for val in header]
1437 self.ListSup.Clear()
1439 self.ListSup.Append(i)
1441 self.ListActive.Enable(False)
1442 self.ListSup.Enable(True)
1443 self.but_suiv.Enable(False)
1444 self.but_prec.Enable(True)
1446 self.m_sdbSizer2OK.Enable(True)
1448 def onprec(self, evt) :
1449 self.ListActive.Enable(True)
1450 self.ListSup.Enable(False)
1451 self.but_suiv.Enable(True)
1452 self.but_prec.Enable(False)
1454 self.m_sdbSizer2OK.Enable(False)
1456 def onvalid(self, evt) :
1457 for i in self.ListSup.GetSelections() :
1458 self.varsup.append(self.hindices[i])
1460 if len(self.varsup) >= 1 or self.m_radioBox1.GetSelection() == 0 :
1463 if len(self.varsup) >= 1 :
1466 class FindInCluster(wx.Frame):
1467 def __init__(self, parent, id, result, style = wx.DEFAULT_FRAME_STYLE):
1468 # begin wxGlade: MyFrame.__init__
1469 wx.Frame.__init__(self, parent, id)
1470 self.spanel = wx.ScrolledWindow(self, -1, style=wx.TAB_TRAVERSAL)
1471 self.sizer1 = wx.FlexGridSizer(0,4,0,0)
1472 self.parent = parent
1474 txt = [u'forme',u'classe',u'chi2',u'voir']
1476 self.sizer1.Add( wx.StaticText(self.spanel, -1, val), 0, wx.ALL, 5)
1478 self.sizer1.Add(wx.StaticLine(self.spanel, -1), 0, wx.ALL, 5)
1479 for i,val in enumerate(result) :
1483 pan = wx.Panel(self.spanel, -1, style=wx.SIMPLE_BORDER)
1484 siz = wx.BoxSizer(wx.VERTICAL)
1485 txt = wx.StaticText(pan, -1, forme)
1486 siz.Add(txt, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5)
1488 self.sizer1.Add(pan, 0, wx.ALL|wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 5)
1489 pan = wx.Panel(self.spanel, -1, style=wx.SIMPLE_BORDER)
1490 siz = wx.BoxSizer(wx.VERTICAL)
1491 txt = wx.StaticText(pan, -1, str(cl))
1492 siz.Add(txt, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5)
1494 self.sizer1.Add(pan, 0, wx.ALL|wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 5)
1495 pan = wx.Panel(self.spanel, -1, style=wx.SIMPLE_BORDER)
1496 siz = wx.BoxSizer(wx.VERTICAL)
1497 txt = wx.StaticText(pan, -1, str(chi))
1498 siz.Add(txt, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5)
1500 self.sizer1.Add(pan, 0, wx.ALL|wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 5)
1502 self.formes[idbut] = [forme, cl]
1503 but = wx.Button(self.spanel, idbut, u"voir")
1504 self.sizer1.Add(but, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5)
1505 self.Bind(wx.EVT_BUTTON, self.showitem, but)
1506 self.button_1 = wx.Button(self, -1, "Fermer")
1507 self.Bind(wx.EVT_BUTTON, self.OnCloseMe, self.button_1)
1508 self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)
1509 self.__set_properties()
1513 def __set_properties(self):
1514 self.SetTitle(u'Résultats')
1515 self.spanel.EnableScrolling(True,True)
1516 #self.panel_1.SetSize((1000,1000))
1517 self.spanel.SetScrollRate(20, 20)
1518 h = 60 * len(self.formes)
1523 self.SetSize(wx.Size(400,h))
1525 def __do_layout(self):
1526 # begin wxGlade: MyFrame.__do_layout
1527 sizer_1 = wx.BoxSizer(wx.VERTICAL)
1528 sizer_2 = wx.BoxSizer(wx.VERTICAL)
1529 self.spanel.SetSizer(self.sizer1)
1530 sizer_1.Add(self.spanel, 4, wx.EXPAND, 0)
1531 sizer_1.Add(self.button_1, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ADJUST_MINSIZE, 0)
1532 #sizer_1.Add(sizer_2, 1, wx.EXPAND, 0)
1533 self.SetAutoLayout(True)
1534 self.SetSizer(sizer_1)
1538 def showitem(self, evt) :
1539 idb = evt.GetEventObject().GetId()
1541 profile = nb.GetPage(nb.GetSelection())
1542 cl = self.formes[idb][1] - 1
1543 forme = self.formes[idb][0]
1544 profile.ProfNB.SetSelection(cl)
1545 UnSelectList(profile.ProfNB.GetPage(cl))
1546 datas = dict([[profile.ProfNB.GetPage(cl).getColumnText(i,6),i] for i in range(profile.ProfNB.GetPage(cl).GetItemCount())])
1547 profile.ProfNB.GetPage(cl).SetItemState(datas[self.formes[idb][0]], wx.LIST_STATE_SELECTED, wx.LIST_STATE_SELECTED)
1548 profile.ProfNB.GetPage(cl).Focus(datas[forme])
1549 profile.ProfNB.GetPage(cl).SetFocus()
1551 def OnCloseMe(self, evt) :
1554 def OnCloseWindow(self, evt):
1557 class SearchDial ( wx.Frame ):
1559 def __init__( self, parent, listctrl, col, shown):
1560 wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = wx.EmptyString, pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.DEFAULT_FRAME_STYLE )
1561 self.parent = parent
1562 self.listctrl = listctrl
1565 self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
1567 bSizer1 = wx.BoxSizer( wx.VERTICAL )
1569 self.search = wx.SearchCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.TE_PROCESS_ENTER )
1570 self.search.ShowSearchButton( True )
1571 self.search.ShowCancelButton( True )
1572 bSizer1.Add( self.search, 0, wx.ALL, 5 )
1573 sizer2 = wx.BoxSizer(wx.HORIZONTAL)
1574 self.backward = wx.Button(self, wx.ID_BACKWARD, u"Précédent")
1575 self.forward = wx.Button(self, wx.ID_FORWARD, u"Suivant")
1576 sizer2.Add(self.backward, 0, wx.ALL, 5)
1577 sizer2.Add(self.forward, 0, wx.ALL, 5)
1578 bSizer1.Add( sizer2, 0, wx.ALL, 5 )
1580 self.SetSizer( bSizer1 )
1583 self.Bind(wx.EVT_SEARCHCTRL_SEARCH_BTN, self.OnSearch, self.search)
1584 self.Bind(wx.EVT_SEARCHCTRL_CANCEL_BTN, self.OnCancel, self.search)
1585 self.Bind(wx.EVT_TEXT_ENTER, self.OnSearch, self.search)
1586 self.Bind(wx.EVT_BUTTON, self.onforward, self.forward)
1587 self.Bind(wx.EVT_BUTTON, self.onbackward, self.backward)
1588 self.search.SetFocus()
1589 self.forward.Enable(False)
1590 self.backward.Enable(False)
1592 self.Centre( wx.BOTH )
1594 def __del__( self ):
1597 def OnSearch(self, evt):
1598 UnSelectList(self.listctrl)
1599 search_word = self.search.GetValue()
1600 if search_word.strip() != '' :
1601 formes = [self.listctrl.getColumnText(i, self.col) for i in range(self.listctrl.GetItemCount())]
1602 if search_word.endswith(u'*') :
1603 search_word = search_word[0:-1]
1604 result = [j for j, forme in enumerate(formes) if forme.startswith(search_word)]
1606 result = [j for j, forme in enumerate(formes) if forme == search_word]
1609 elif self.shown == True :
1610 self.showitems(result)
1612 self.showresult(result)
1617 def showitems(self, items) :
1618 if len(items) == 1 :
1619 self.listctrl.SetItemState(items[0], wx.LIST_STATE_SELECTED, wx.LIST_STATE_SELECTED)
1620 self.listctrl.Focus(items[0])
1621 self.listctrl.SetFocus()
1625 self.listctrl.SetItemState(i, wx.LIST_STATE_SELECTED, wx.LIST_STATE_SELECTED)
1626 self.listctrl.Focus(items[0])
1627 self.listctrl.SetFocus()
1628 self.forward.Enable(True)
1629 self.backward.Enable(False)
1634 def showresult(self, result) :
1635 toshow = [self.listctrl.itemDataMap[int(self.listctrl.getColumnText(i,0))] for i in result]
1636 proflist = [[[line[1], i+1, val] for i, val in enumerate(line[2:]) if val>=2] for line in toshow]
1637 #FIXME: intervenir en aval en virant les forme avec chi<2
1638 if proflist != [[]] :
1639 proflist = [val for line in proflist for val in line if line !=[]]
1640 nb = self.parent.parent.nb
1641 profile = nb.GetPage(nb.GetSelection())
1642 first_forme = proflist[0]
1643 cl = first_forme[1] - 1
1644 profile.ProfNB.SetSelection(cl)
1645 profile.ProfNB.GetPage(cl).SetFocus()
1646 UnSelectList(profile.ProfNB.GetPage(cl))
1647 datas = dict([[profile.ProfNB.GetPage(cl).getColumnText(i,6),i] for i in range(profile.ProfNB.GetPage(cl).GetItemCount())])
1648 profile.ProfNB.GetPage(cl).SetItemState(datas[first_forme[0]], wx.LIST_STATE_SELECTED, wx.LIST_STATE_SELECTED)
1649 profile.ProfNB.GetPage(cl).Focus(datas[first_forme[0]])
1650 profile.ProfNB.GetPage(cl).SetFocus()
1651 if len(proflist) == 1 :
1654 SearchResult = FindInCluster(self.parent.parent, -1, proflist)
1660 def onforward(self, evt) :
1661 self.listctrl.Focus(self.items[self.forwitem])
1662 self.listctrl.SetFocus()
1664 if self.forwitem == len(self.items) :
1665 self.forward.Enable(False)
1666 self.backward.Enable(True)
1670 self.backward.Enable(True)
1672 def onbackward(self, evt) :
1673 self.listctrl.Focus(self.items[self.backitem])
1674 self.listctrl.SetFocus()
1676 if self.backitem == -1 :
1678 self.forward.Enable(True)
1679 self.backward.Enable(False)
1682 self.forward.Enable(True)
1684 def noresult(self) :
1685 msg = u"Forme absente"
1686 dial = wx.MessageDialog(self, 'Forme absente','Forme absente', wx.OK | wx.ICON_INFORMATION)
1687 dial.CenterOnParent()
1691 def OnCancel(self, evt) :
1694 def UnSelectList(liste) :
1695 if liste.GetFirstSelected() != -1 :
1696 last = liste.GetFirstSelected()
1697 liste.Select(liste.GetFirstSelected(), False)
1698 while liste.GetNextSelected(last) != -1 :
1699 last = liste.GetNextSelected(last)
1700 liste.Select(liste.GetFirstSelected(),False)
1703 class OptLexi(wx.Dialog):
1704 def __init__(self, parent, force_chi = False):
1705 # begin wxGlade: MyDialog.__init__
1706 #kwds["style"] = wx.DEFAULT_DIALOG_STYLE
1707 wx.Dialog.__init__(self, parent, style = wx.DEFAULT_DIALOG_STYLE)
1709 self.variables = None
1710 self.force_chi = force_chi
1711 #self.labellem = wx.StaticText(self, -1, u"Lemmatisation : ")
1712 #self.checklem = wx.CheckBox(self, -1)
1713 self.label_var = wx.StaticText(self, -1, u"Sélection par :")
1714 self.choice = wx.Choice(self, -1, (100,50), choices = [u'variables', u'modalités'])
1715 self.label1 = wx.StaticText(self, -1, u"Choix")
1716 self.list_box_1 = wx.ListBox(self, -1, choices=[], size = wx.Size( 150,200 ), style=wx.LB_EXTENDED | wx.LB_HSCROLL)
1717 self.button_2 = wx.Button(self, wx.ID_CANCEL, "")
1718 self.button_1 = wx.Button(self, wx.ID_OK, "")
1719 if not self.force_chi :
1720 indices = [u'loi hypergéométique', u'chi2']
1723 self.label_indice = wx.StaticText(self, -1, u"indice")
1724 self.choice_indice = wx.Choice(self, -1, (100,50), choices = indices)
1725 if not self.force_chi :
1726 self.label = wx.StaticText(self, -1, u"effectif minimum")
1727 self.spin = wx.SpinCtrl(self, -1, min = 1, max = 10000, initial = 10)
1728 self.Bind(wx.EVT_CHOICE, self.onselect, self.choice)
1729 self.__set_properties()
1733 def __set_properties(self):
1734 # begin wxGlade: MyDialog.__set_properties
1735 self.SetTitle("Choix des variables")
1736 if not self.force_chi :
1737 self.spin.SetValue(10)
1738 self.choice.SetSelection(0)
1739 self.choice_indice.SetSelection(0)
1740 #self.SetMinSize(wx.Size(300, 400))
1743 def __do_layout(self):
1744 # begin wxGlade: MyDialog.__do_layout
1745 sizer_1 = wx.BoxSizer(wx.VERTICAL)
1746 sizer_2 = wx.FlexGridSizer(0,2,0,0)
1747 sizer_3 = wx.BoxSizer(wx.HORIZONTAL)
1748 #sizer_2.Add(self.labellem, 0, wx.ALIGN_CENTER_VERTICAL, 3)
1749 #sizer_2.Add(self.checklem, 0, wx.ALIGN_CENTER_VERTICAL, 3)
1750 sizer_2.Add(self.label_var, 0, wx.ALIGN_CENTER_VERTICAL, 3)
1751 sizer_2.Add(self.choice, 0, wx.ALIGN_CENTER_VERTICAL, 3)
1752 sizer_2.Add(self.label1, 0, wx.ALIGN_CENTER_VERTICAL, 3)
1753 sizer_2.Add(self.list_box_1, 0, wx.ALIGN_RIGHT, 3)
1754 sizer_3.Add(self.button_2, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 3)
1755 sizer_3.Add(self.button_1, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 3)
1756 sizer_2.Add(self.label_indice, 0, wx.ALIGN_CENTER_VERTICAL, 3)
1757 sizer_2.Add(self.choice_indice, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 3)
1758 if not self.force_chi :
1759 sizer_2.Add(self.label, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 3)
1760 sizer_2.Add(self.spin, 0, wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 3)
1761 sizer_1.Add(sizer_2, 0, wx.ALIGN_CENTER_HORIZONTAL, 3)
1762 sizer_1.Add(sizer_3, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_RIGHT, 3)
1763 self.SetSizer(sizer_1)
1768 def onselect(self, evt):
1769 self.list_box_1.Clear()
1770 if self.choice.GetSelection() == 0 :
1771 for var in self.variables :
1772 self.list_box_1.Append(var)
1774 for et in self.listet :
1775 self.list_box_1.Append(et)
1778 class PrefDendro ( wx.Dialog ):
1780 def __init__( self, parent, param ):
1781 wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = u"Dendrogramme", pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.DEFAULT_DIALOG_STYLE )
1783 self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
1785 fgSizer1 = wx.FlexGridSizer( 0, 2, 0, 0 )
1786 fgSizer1.SetFlexibleDirection( wx.BOTH )
1787 fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
1789 self.m_staticText1 = wx.StaticText( self, wx.ID_ANY, u"Taille de l'image", wx.DefaultPosition, wx.DefaultSize, 0 )
1790 self.m_staticText1.Wrap( -1 )
1791 fgSizer1.Add( self.m_staticText1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1793 bSizer2 = wx.BoxSizer( wx.VERTICAL )
1795 bSizer3 = wx.BoxSizer( wx.HORIZONTAL )
1797 self.m_staticText2 = wx.StaticText( self, wx.ID_ANY, u"Hauteur", wx.DefaultPosition, wx.DefaultSize, 0 )
1798 self.m_staticText2.Wrap( -1 )
1799 bSizer3.Add( self.m_staticText2, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1801 self.m_spinCtrl1 = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 50, 10000, 600 )
1802 bSizer3.Add( self.m_spinCtrl1, 0, wx.ALL, 5 )
1804 bSizer2.Add( bSizer3, 1, wx.EXPAND, 5 )
1806 bSizer31 = wx.BoxSizer( wx.HORIZONTAL )
1808 self.m_staticText3 = wx.StaticText( self, wx.ID_ANY, u"Largeur", wx.DefaultPosition, wx.DefaultSize, 0 )
1809 self.m_staticText3.Wrap( -1 )
1810 bSizer31.Add( self.m_staticText3, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1812 self.m_spinCtrl2 = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 50, 10000, 600 )
1813 bSizer31.Add( self.m_spinCtrl2, 0, wx.ALL, 5 )
1815 bSizer2.Add( bSizer31, 1, wx.EXPAND, 5 )
1817 fgSizer1.Add( bSizer2, 1, wx.EXPAND, 5 )
1819 self.m_staticline1 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1820 fgSizer1.Add( self.m_staticline1, 0, wx.EXPAND |wx.ALL, 5 )
1822 self.m_staticline2 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1823 fgSizer1.Add( self.m_staticline2, 0, wx.EXPAND |wx.ALL, 5 )
1825 self.m_staticText4 = wx.StaticText( self, wx.ID_ANY, u"Type de dendrogramme", wx.DefaultPosition, wx.DefaultSize, 0 )
1826 self.m_staticText4.Wrap( -1 )
1827 fgSizer1.Add( self.m_staticText4, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1829 m_choice1Choices = [ u"phylogram", u"cladogram", u"fan", u"unrooted", u"radial" ]
1830 self.m_choice1 = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, m_choice1Choices, 0 )
1831 self.m_choice1.SetSelection( 0 )
1832 fgSizer1.Add( self.m_choice1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT|wx.ALL, 5 )
1834 self.m_staticline3 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1835 fgSizer1.Add( self.m_staticline3, 0, wx.EXPAND |wx.ALL, 5 )
1837 self.m_staticline4 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1838 fgSizer1.Add( self.m_staticline4, 0, wx.EXPAND |wx.ALL, 5 )
1840 self.m_staticText5 = wx.StaticText( self, wx.ID_ANY, u"Couleur ou noir et blanc", wx.DefaultPosition, wx.DefaultSize, 0 )
1841 self.m_staticText5.Wrap( -1 )
1842 fgSizer1.Add( self.m_staticText5, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1844 m_radioBox1Choices = [ u"couleur", u"noir et blanc" ]
1845 self.m_radioBox1 = wx.RadioBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, m_radioBox1Choices, 1, wx.RA_SPECIFY_COLS )
1846 self.m_radioBox1.SetSelection( 0 )
1847 fgSizer1.Add( self.m_radioBox1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT|wx.ALL, 5 )
1849 self.m_staticline5 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1850 fgSizer1.Add( self.m_staticline5, 0, wx.EXPAND |wx.ALL, 5 )
1852 self.m_staticline6 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1853 fgSizer1.Add( self.m_staticline6, 0, wx.EXPAND |wx.ALL, 5 )
1855 bSizer4 = wx.BoxSizer( wx.HORIZONTAL )
1857 self.m_staticText6 = wx.StaticText( self, wx.ID_ANY, u"Ajouter la taille des classes", wx.DefaultPosition, wx.DefaultSize, 0 )
1858 self.m_staticText6.Wrap( -1 )
1859 bSizer4.Add( self.m_staticText6, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1861 self.m_checkBox1 = wx.CheckBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
1862 self.m_checkBox1.SetValue(True)
1863 bSizer4.Add( self.m_checkBox1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1865 fgSizer1.Add( bSizer4, 1, wx.EXPAND, 5 )
1867 m_radioBox2Choices = [ u"camemberts", u"barres" ]
1868 self.m_radioBox2 = wx.RadioBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, m_radioBox2Choices, 1, wx.RA_SPECIFY_COLS )
1869 self.m_radioBox2.SetSelection( 0 )
1870 fgSizer1.Add( self.m_radioBox2, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT|wx.ALL, 5 )
1872 self.m_staticline7 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1873 fgSizer1.Add( self.m_staticline7, 0, wx.EXPAND |wx.ALL, 5 )
1875 self.m_staticline8 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1876 fgSizer1.Add( self.m_staticline8, 0, wx.EXPAND |wx.ALL, 5 )
1879 fgSizer1.AddSpacer( ( 0, 0), 1, wx.EXPAND, 5 )
1881 m_sdbSizer2 = wx.StdDialogButtonSizer()
1882 self.m_sdbSizer2OK = wx.Button( self, wx.ID_OK )
1883 m_sdbSizer2.AddButton( self.m_sdbSizer2OK )
1884 self.m_sdbSizer2Cancel = wx.Button( self, wx.ID_CANCEL )
1885 m_sdbSizer2.AddButton( self.m_sdbSizer2Cancel )
1886 m_sdbSizer2.Realize();
1887 fgSizer1.Add( m_sdbSizer2, 1, wx.EXPAND, 5 )
1889 self.__set_properties()
1890 self.SetSizer( fgSizer1 )
1892 fgSizer1.Fit( self )
1894 self.Centre( wx.BOTH )
1896 def __set_properties(self):
1897 self.m_spinCtrl2.SetValue(self.param['width'])
1898 self.m_spinCtrl1.SetValue(self.param['height'])
1899 self.m_choice1.SetSelection(self.param['type_dendro'])
1900 self.m_radioBox1.SetSelection(self.param['color_nb'])
1901 self.m_checkBox1.SetValue(self.param['taille_classe'])
1902 self.m_radioBox2.SetSelection(self.param['type_tclasse'])
1904 def __del__( self ):
1908 class PrefWordCloud ( wx.Dialog ):
1910 def __init__( self, parent ):
1911 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 )
1913 self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
1915 fgSizer1 = wx.FlexGridSizer( 0, 2, 0, 0 )
1916 fgSizer1.SetFlexibleDirection( wx.BOTH )
1917 fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
1919 #self.m_staticText1 = wx.StaticText( self, wx.ID_ANY, u"Sélectionner les formes", wx.DefaultPosition, wx.DefaultSize, 0 )
1920 #self.m_staticText1.Wrap( -1 )
1921 #fgSizer1.Add( self.m_staticText1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
1923 #self.but_selectcol = wx.Button( self, wx.ID_ANY, u"Sélectionner", wx.DefaultPosition, wx.DefaultSize, 0 )
1924 #fgSizer1.Add( self.but_selectcol, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1926 #self.m_staticline1 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1927 #fgSizer1.Add( self.m_staticline1, 0, wx.EXPAND |wx.ALL, 5 )
1929 #self.m_staticline2 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1930 #fgSizer1.Add( self.m_staticline2, 0, wx.EXPAND |wx.ALL, 5 )
1932 bSizer1 = wx.BoxSizer( wx.HORIZONTAL )
1934 self.m_staticText3 = wx.StaticText( self, wx.ID_ANY, u"Hauteur", wx.DefaultPosition, wx.DefaultSize, 0 )
1935 self.m_staticText3.Wrap( -1 )
1936 bSizer1.Add( self.m_staticText3, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
1938 self.spin_H = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size( 100,30 ), wx.SP_ARROW_KEYS, 0, 10000, 600 )
1939 self.spin_H.SetValue( 800 )
1940 bSizer1.Add( self.spin_H, 0, wx.ALL, 5 )
1942 fgSizer1.Add( bSizer1, 1, wx.EXPAND, 5 )
1944 bSizer3 = wx.BoxSizer( wx.HORIZONTAL )
1946 self.m_staticText4 = wx.StaticText( self, wx.ID_ANY, u"Largeur", wx.DefaultPosition, wx.DefaultSize, 0 )
1947 self.m_staticText4.Wrap( -1 )
1948 bSizer3.Add( self.m_staticText4, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
1950 self.spin_L = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size( 100,30 ), wx.SP_ARROW_KEYS, 0, 10000, 600 )
1951 self.spin_L.SetValue( 800 )
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_staticText11 = wx.StaticText( self, wx.ID_ANY, u"Format de l'image", wx.DefaultPosition, wx.DefaultSize, 0 )
1963 self.m_staticText11.Wrap( -1 )
1964 fgSizer1.Add( self.m_staticText11, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1966 formatChoices = [ u"png", u"svg" ]
1967 self.format = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, formatChoices, 0 )
1968 self.format.SetSelection( 0 )
1969 fgSizer1.Add( self.format, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1971 self.m_staticline13 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1972 fgSizer1.Add( self.m_staticline13, 0, wx.EXPAND |wx.ALL, 5 )
1974 self.m_staticline14 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1975 fgSizer1.Add( self.m_staticline14, 0, wx.EXPAND |wx.ALL, 5 )
1977 self.m_staticText5 = wx.StaticText( self, wx.ID_ANY, u"Nombre maximum de formes", wx.DefaultPosition, wx.DefaultSize, 0 )
1978 self.m_staticText5.Wrap( -1 )
1979 fgSizer1.Add( self.m_staticText5, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
1981 self.spin_maxword = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 0, 10000, 600 )
1982 self.spin_maxword.SetValue( 600 )
1983 fgSizer1.Add( self.spin_maxword, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1985 self.m_staticline5 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1986 fgSizer1.Add( self.m_staticline5, 0, wx.EXPAND |wx.ALL, 5 )
1988 self.m_staticline6 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1989 fgSizer1.Add( self.m_staticline6, 0, wx.EXPAND |wx.ALL, 5 )
1991 self.typeformes = wx.StaticText( self, wx.ID_ANY, u"formes retenues", wx.DefaultPosition, wx.DefaultSize, 0 )
1992 self.typeformes.Wrap( -1 )
1993 fgSizer1.Add( self.typeformes, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1995 typeformeschoiceChoices = [ u"actives", u"supplémentaires", u"actives et supplémentaires" ]
1996 self.typeformeschoice = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, typeformeschoiceChoices, 0 )
1997 self.typeformeschoice.SetSelection( 0 )
1998 fgSizer1.Add( self.typeformeschoice, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2000 self.m_staticline11 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
2001 fgSizer1.Add( self.m_staticline11, 0, wx.EXPAND |wx.ALL, 5 )
2003 self.m_staticline12 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
2004 fgSizer1.Add( self.m_staticline12, 0, wx.EXPAND |wx.ALL, 5 )
2006 self.m_staticText6 = wx.StaticText( self, wx.ID_ANY, u"Taille du texte", wx.DefaultPosition, wx.DefaultSize, 0 )
2007 self.m_staticText6.Wrap( -1 )
2008 fgSizer1.Add( self.m_staticText6, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2010 bSizer4 = wx.BoxSizer( wx.VERTICAL )
2012 bSizer5 = wx.BoxSizer( wx.HORIZONTAL )
2014 self.m_staticText7 = wx.StaticText( self, wx.ID_ANY, u"Min", wx.DefaultPosition, wx.DefaultSize, 0 )
2015 self.m_staticText7.Wrap( -1 )
2016 bSizer5.Add( self.m_staticText7, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2018 self.spin_mincex = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 0, 1000, 5 )
2019 self.spin_mincex.SetValue( 5 )
2020 bSizer5.Add( self.spin_mincex, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT|wx.ALL, 5 )
2022 bSizer4.Add( bSizer5, 1, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.EXPAND, 5 )
2024 bSizer6 = wx.BoxSizer( wx.HORIZONTAL )
2026 self.m_staticText8 = wx.StaticText( self, wx.ID_ANY, u"Max", wx.DefaultPosition, wx.DefaultSize, 0 )
2027 self.m_staticText8.Wrap( -1 )
2028 bSizer6.Add( self.m_staticText8, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2030 self.spin_maxcex = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 0, 1000, 50 )
2031 self.spin_maxcex.SetValue( 50 )
2032 bSizer6.Add( self.spin_maxcex, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2034 bSizer4.Add( bSizer6, 1, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.EXPAND, 5 )
2036 fgSizer1.Add( bSizer4, 1, wx.EXPAND, 5 )
2038 self.m_staticline7 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
2039 fgSizer1.Add( self.m_staticline7, 0, wx.EXPAND |wx.ALL, 5 )
2041 self.m_staticline8 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
2042 fgSizer1.Add( self.m_staticline8, 0, wx.EXPAND |wx.ALL, 5 )
2044 bSizer61 = wx.BoxSizer( wx.HORIZONTAL )
2046 self.m_staticText81 = wx.StaticText( self, wx.ID_ANY, u"Couleur du texte", wx.DefaultPosition, wx.DefaultSize, 0 )
2047 self.m_staticText81.Wrap( -1 )
2048 bSizer61.Add( self.m_staticText81, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2050 self.color_text = wx.ColourPickerCtrl( self, wx.ID_ANY, wx.BLACK, wx.DefaultPosition, wx.DefaultSize, wx.CLRP_DEFAULT_STYLE )
2051 bSizer61.Add( self.color_text, 0, wx.ALL, 5 )
2053 fgSizer1.Add( bSizer61, 1, wx.EXPAND, 5 )
2055 bSizer7 = wx.BoxSizer( wx.HORIZONTAL )
2057 self.m_staticText9 = wx.StaticText( self, wx.ID_ANY, u"Couleur du fond", wx.DefaultPosition, wx.DefaultSize, 0 )
2058 self.m_staticText9.Wrap( -1 )
2059 bSizer7.Add( self.m_staticText9, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2061 self.color_bg = wx.ColourPickerCtrl( self, wx.ID_ANY, (255,255,255), wx.DefaultPosition, wx.DefaultSize, wx.CLRP_DEFAULT_STYLE )
2062 bSizer7.Add( self.color_bg, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2064 fgSizer1.Add( bSizer7, 1, wx.EXPAND, 5 )
2066 self.m_staticline9 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
2067 fgSizer1.Add( self.m_staticline9, 0, wx.EXPAND |wx.ALL, 5 )
2069 self.m_staticline10 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
2070 fgSizer1.Add( self.m_staticline10, 0, wx.EXPAND |wx.ALL, 5 )
2072 fgSizer1.AddSpacer( ( 0, 0), 1, wx.EXPAND, 5 )
2074 m_sdbSizer1 = wx.StdDialogButtonSizer()
2075 self.m_sdbSizer1OK = wx.Button( self, wx.ID_OK )
2076 m_sdbSizer1.AddButton( self.m_sdbSizer1OK )
2077 self.m_sdbSizer1Cancel = wx.Button( self, wx.ID_CANCEL )
2078 m_sdbSizer1.AddButton( self.m_sdbSizer1Cancel )
2079 m_sdbSizer1.Realize();
2080 fgSizer1.Add( m_sdbSizer1, 1, wx.EXPAND, 5 )
2082 self.SetSizer( fgSizer1 )
2084 fgSizer1.Fit( self )
2086 self.Centre( wx.BOTH )
2088 def __del__( self ):
2091 class PrefChi(sc.SizedDialog):
2092 def __init__(self, parent, ID, optionchi, title):
2094 sc.SizedDialog.__init__(self, None, -1, u"Paramètres",
2095 style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER)
2096 pane = self.GetContentsPane()
2097 pane.SetSizerType("form")
2098 pane.SetSizerProps(border=("all",5))
2099 self.parent = parent
2100 self.optionchi = optionchi
2103 self.label_obs = wx.StaticText(pane, -1, u'valeurs observée')
2104 self.check1 = wx.CheckBox(pane, -1)
2106 self.label_theo = wx.StaticText(pane, -1, u'valeurs théoriques')
2107 self.check2 = wx.CheckBox(pane, -1)
2109 self.label_resi = wx.StaticText(pane, -1, u'residuals')
2110 self.check3 = wx.CheckBox(pane, -1)
2112 self.label_contrib = wx.StaticText(pane, -1, u'contributions a posteriori')
2113 self.check4 = wx.CheckBox(pane, -1)
2114 # self.label_graph = wx.StaticText(pane, -1, u'graphique')
2115 # self.check8 = wx.CheckBox(pane, -1)
2116 self.label_pourcent = wx.StaticText(pane, -1, u'pourcentage total')
2117 self.check5 = wx.CheckBox(pane, -1)
2119 self.label_prl = wx.StaticText(pane, -1, u'pourcentages en ligne')
2120 self.check6 = wx.CheckBox(pane, -1)
2122 self.label_prc = wx.StaticText(pane, -1, u'pourcentages en colonne')
2123 self.check7 = wx.CheckBox(pane, -1)
2125 self.label_graph = wx.StaticText(pane, -1, u'graphique')
2126 self.check8 = wx.CheckBox(pane, -1)
2128 self.label_graphbw = wx.StaticText(pane, -1, u'graphique en noir et blanc')
2129 self.checkbw = wx.CheckBox(pane, -1)
2131 self.SetButtonSizer(self.CreateStdDialogButtonSizer(wx.OK | wx.CANCEL))
2133 self.__set_properties()
2135 self.SetMinSize(self.GetSize())
2137 def __set_properties(self):
2138 self.check1.SetValue(self.optionchi['valobs'])
2139 self.check2.SetValue(self.optionchi['valtheo'])
2140 self.check3.SetValue(self.optionchi['resi'])
2141 self.check4.SetValue(self.optionchi['contrib'])
2142 self.check5.SetValue(self.optionchi['pourcent'])
2143 self.check6.SetValue(self.optionchi['pourcentl'])
2144 self.check7.SetValue(self.optionchi['pourcentc'])
2145 self.check8.SetValue(self.optionchi['graph'])
2146 self.checkbw.SetValue(self.optionchi['bw'])
2148 class ChiDialog(wx.Dialog):
2150 self, parent, ID, title, optionchi, size=wx.DefaultSize, pos=wx.DefaultPosition,
2151 style=wx.DEFAULT_DIALOG_STYLE
2154 pre = wx.PreDialog()
2155 pre.SetExtraStyle(wx.DIALOG_EX_CONTEXTHELP)
2156 pre.Create(parent, ID, title, pos, size, style)
2158 self.PostCreate(pre)
2159 self.parent = parent
2160 self.optionchi = optionchi
2162 #self.Filename=parent.filename
2163 #self.content=parent.content[:]
2164 self.headers=parent.tableau.get_colnames()
2167 for i in self.headers:
2169 LABELLIST.append(i[0:60])
2174 self.LabelListOK=LABELLIST
2176 self.list_box_1 = wx.ListBox(self, -1, choices=self.LabelListOK, style=wx.LB_EXTENDED|wx.LB_HSCROLL)
2177 self.list_box_2 = wx.ListBox(self, -1, choices=self.LabelListOK, style=wx.LB_EXTENDED|wx.LB_HSCROLL)
2178 self.button_1 = wx.Button(self, wx.ID_OK)
2179 self.button_cancel = wx.Button(self, wx.ID_CANCEL)
2180 self.button_pref = wx.Button(self, wx.ID_PREFERENCES)
2181 self.__set_properties()
2184 self.Bind(wx.EVT_LISTBOX, self.Select1, self.list_box_1)
2185 self.Bind(wx.EVT_BUTTON, self.onparam, self.button_pref)
2187 #-------------------------------
2188 def __set_properties(self):
2189 # begin wxGlade: ConfChi2.__set_properties
2190 self.SetTitle(u"Sélection des variables")
2192 def __do_layout(self):
2193 # begin wxGlade: ConfChi2.__do_layout
2194 sizer_1 = wx.BoxSizer(wx.VERTICAL)
2195 sizer_2 = wx.BoxSizer(wx.VERTICAL)
2196 sizer_3 = wx.BoxSizer(wx.HORIZONTAL)
2197 sizer_4 = wx.BoxSizer(wx.HORIZONTAL)
2198 sizer_3.Add(self.list_box_1, 0, wx.EXPAND, 0)
2199 sizer_3.Add(self.list_box_2, 0, wx.EXPAND|wx.ALIGN_CENTER_HORIZONTAL, 0)
2200 sizer_2.Add(sizer_3, 1, wx.EXPAND, 0)
2201 sizer_4.Add(self.button_cancel, 0, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL, 0)
2202 sizer_4.Add(self.button_pref, 0, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL, 0)
2203 sizer_4.Add(self.button_1, 0, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL, 0)
2204 sizer_2.Add(sizer_4, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL, 0)
2205 sizer_1.Add(sizer_2, 1, wx.EXPAND, 0)
2206 self.SetSizer(sizer_1)
2211 def Select1(self, event): # wxGlade: ConfChi2.<event_handler>
2215 def onparam(self,event):
2216 self.dial = PrefChi(self.parent, -1, self.optionchi, '')
2217 self.dial.CenterOnParent()
2218 self.chiopt = self.dial.ShowModal()
2220 class CorpusPref ( wx.Dialog ):
2222 def __init__( self, parent, parametres ):
2223 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 )
2224 self.parent = parent
2225 langues_n = [u'français', u'english', u'german (expérimentale)', u'italian', u'swedish (expérimentale)', u'portuguese (expérimentale)', u'spanish (expérimentale)', u'greek (expériementale)', u'autre...']
2226 self.langues = [u'french', u'english', u'german', u'italian', u'swedish', u'portuguese', u'spanish', u'greek', u'other']
2227 self.encodages = [enc[0].lower() for enc in encodages]
2229 ucimark = [u'****', u'0000']
2230 ucemethod = [u'charactères', u'occurrences', u'paragraphes']
2232 self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
2234 bSizer1 = wx.BoxSizer( wx.VERTICAL )
2236 self.m_notebook1 = wx.Notebook( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, 0 )
2237 self.m_panel1 = wx.Panel( self.m_notebook1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
2238 fgSizer1 = wx.FlexGridSizer( 0, 2, 0, 0 )
2239 fgSizer1.SetFlexibleDirection( wx.BOTH )
2240 fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
2242 self.m_staticText7 = wx.StaticText( self.m_panel1, wx.ID_ANY, u"Corpus", wx.DefaultPosition, wx.DefaultSize, 0 )
2243 self.m_staticText7.Wrap( -1 )
2244 fgSizer1.Add( self.m_staticText7, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2246 self.txtpath = wx.StaticText( self.m_panel1, wx.ID_ANY, u"path", wx.DefaultPosition, wx.DefaultSize, 0 )
2247 self.txtpath.Wrap( -1 )
2248 fgSizer1.Add( self.txtpath, 0, wx.ALL, 5 )
2250 self.m_staticText1 = wx.StaticText( self.m_panel1, wx.ID_ANY, u"Encodage", wx.DefaultPosition, wx.DefaultSize, 0 )
2251 self.m_staticText1.Wrap( -1 )
2252 fgSizer1.Add( self.m_staticText1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2254 encodage_choicesChoices = [' - '.join(encodage) for encodage in encodages]
2255 self.encodage_choices = wx.Choice( self.m_panel1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, encodage_choicesChoices, 0 )
2256 self.encodage_choices.SetSelection( 0 )
2257 fgSizer1.Add( self.encodage_choices, 0, wx.ALL, 5 )
2259 self.m_staticText2 = wx.StaticText( self.m_panel1, wx.ID_ANY, u"Langue", wx.DefaultPosition, wx.DefaultSize, 0 )
2260 self.m_staticText2.Wrap( -1 )
2261 fgSizer1.Add( self.m_staticText2, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2263 lang_choicesChoices = langues_n
2264 self.lang_choices = wx.Choice( self.m_panel1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, lang_choicesChoices, 0 )
2265 self.lang_choices.SetSelection( 0 )
2266 fgSizer1.Add( self.lang_choices, 0, wx.ALL, 5 )
2268 self.m_staticText3 = wx.StaticText( self.m_panel1, wx.ID_ANY, u"Répertoire en sortie", wx.DefaultPosition, wx.DefaultSize, 0 )
2269 self.m_staticText3.Wrap( -1 )
2270 fgSizer1.Add( self.m_staticText3, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2273 fgSizer41 = wx.FlexGridSizer( 0, 2, 0, 0 )
2274 fgSizer41.SetFlexibleDirection( wx.BOTH )
2275 fgSizer41.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
2277 self.repout_choices = wx.TextCtrl( self.m_panel1, wx.ID_ANY, u"MyLabel", wx.DefaultPosition, wx.DefaultSize, 0 )
2278 self.repout_choices.SetMinSize( wx.Size( 400,-1 ) )
2279 fgSizer41.Add( self.repout_choices, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2281 self.m_button1 = wx.Button( self.m_panel1, wx.ID_ANY, u"Modifier...", wx.DefaultPosition, wx.DefaultSize, 0 )
2282 fgSizer41.Add( self.m_button1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2284 fgSizer1.Add( fgSizer41, 1, wx.EXPAND, 5 )
2286 self.m_staticText12 = wx.StaticText( self.m_panel1, wx.ID_ANY, u"Marqueur de texte", wx.DefaultPosition, wx.DefaultSize, 0 )
2287 self.m_staticText12.Wrap( -1 )
2288 fgSizer1.Add( self.m_staticText12, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2290 ucimark_choicesChoices = ucimark
2291 self.ucimark_choices = wx.Choice( self.m_panel1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, ucimark_choicesChoices, 0 )
2292 self.ucimark_choices.SetSelection( 0 )
2293 fgSizer1.Add( self.ucimark_choices, 0, wx.ALL, 5 )
2295 self.m_staticText6 = wx.StaticText( self.m_panel1, wx.ID_ANY, u"Utiliser le dictionnaire des expressions", wx.DefaultPosition, wx.DefaultSize, 0 )
2296 self.m_staticText6.Wrap( -1 )
2297 fgSizer1.Add( self.m_staticText6, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2299 self.check_expressions = wx.CheckBox( self.m_panel1, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
2300 self.check_expressions.SetValue(True)
2301 fgSizer1.Add( self.check_expressions, 0, wx.ALL, 5 )
2303 self.m_staticText9 = wx.StaticText( self.m_panel1, wx.ID_ANY, u"Construire des segments de texte", wx.DefaultPosition, wx.DefaultSize, 0 )
2304 self.m_staticText9.Wrap( -1 )
2305 fgSizer1.Add( self.m_staticText9, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2307 self.check_makeuce = wx.CheckBox( self.m_panel1, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
2308 self.check_makeuce.SetValue(True)
2309 fgSizer1.Add( self.check_makeuce, 0, wx.ALL, 5 )
2311 self.m_staticText10 = wx.StaticText( self.m_panel1, wx.ID_ANY, u"Mode de construction des segments de texte", wx.DefaultPosition, wx.DefaultSize, 0 )
2312 self.m_staticText10.Wrap( -1 )
2313 fgSizer1.Add( self.m_staticText10, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2315 uce_modeChoices = ucemethod
2316 self.uce_mode = wx.Choice( self.m_panel1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, uce_modeChoices, 0 )
2317 self.uce_mode.SetSelection( 0 )
2318 fgSizer1.Add( self.uce_mode, 0, wx.ALL, 5 )
2320 self.m_staticText13 = wx.StaticText( self.m_panel1, wx.ID_ANY, u"Taille des segments de texte", wx.DefaultPosition, wx.DefaultSize, 0 )
2321 self.m_staticText13.Wrap( -1 )
2322 fgSizer1.Add( self.m_staticText13, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2324 self.uce_size = wx.SpinCtrl( self.m_panel1, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 1, 1000000, 40 )
2325 fgSizer1.Add( self.uce_size, 0, wx.ALL, 5 )
2328 self.m_panel1.SetSizer( fgSizer1 )
2329 self.m_panel1.Layout()
2330 fgSizer1.Fit( self.m_panel1 )
2331 self.m_notebook1.AddPage( self.m_panel1, u"Générale", True )
2332 self.m_panel2 = wx.Panel( self.m_notebook1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
2333 fgSizer3 = wx.FlexGridSizer( 0, 2, 0, 0 )
2334 fgSizer3.SetFlexibleDirection( wx.BOTH )
2335 fgSizer3.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
2337 self.m_staticText4 = wx.StaticText( self.m_panel2, wx.ID_ANY, u"Passer le corpus en minuscule", wx.DefaultPosition, wx.DefaultSize, 0 )
2338 self.m_staticText4.Wrap( -1 )
2339 fgSizer3.Add( self.m_staticText4, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2341 self.check_lower = wx.CheckBox( self.m_panel2, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
2342 self.check_lower.SetValue(True)
2343 fgSizer3.Add( self.check_lower, 0, wx.ALL, 5 )
2345 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 )
2346 self.m_staticText5.Wrap( -1 )
2347 fgSizer3.Add( self.m_staticText5, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2349 fgSizer4 = wx.FlexGridSizer( 0, 2, 0, 0 )
2350 fgSizer4.SetFlexibleDirection( wx.BOTH )
2351 fgSizer4.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
2353 self.check_charact = wx.CheckBox( self.m_panel2, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
2354 self.check_charact.SetValue(True)
2355 fgSizer4.Add( self.check_charact, 0, wx.ALL, 5 )
2357 self.txt_charact = wx.TextCtrl( self.m_panel2, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
2358 self.txt_charact.SetMinSize( wx.Size( 400,-1 ) )
2360 fgSizer4.Add( self.txt_charact, 0, wx.ALL|wx.EXPAND, 5 )
2363 fgSizer3.Add( fgSizer4, 1, wx.ALIGN_CENTER_VERTICAL|wx.EXPAND, 5 )
2365 self.m_staticText14 = wx.StaticText( self.m_panel2, wx.ID_ANY, u"Remplacer les apostrophes par des espaces", wx.DefaultPosition, wx.DefaultSize, 0 )
2366 self.m_staticText14.Wrap( -1 )
2367 fgSizer3.Add( self.m_staticText14, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2369 self.check_apos = wx.CheckBox( self.m_panel2, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
2370 self.check_apos.SetValue(True)
2371 fgSizer3.Add( self.check_apos, 0, wx.ALL, 5 )
2373 self.m_staticText15 = wx.StaticText( self.m_panel2, wx.ID_ANY, u"Remplacer les tirets par des espaces", wx.DefaultPosition, wx.DefaultSize, 0 )
2374 self.m_staticText15.Wrap( -1 )
2375 fgSizer3.Add( self.m_staticText15, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2377 self.check_tirets = wx.CheckBox( self.m_panel2, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
2378 self.check_tirets.SetValue(True)
2379 fgSizer3.Add( self.check_tirets, 0, wx.ALL, 5 )
2381 self.m_staticText17 = wx.StaticText( self.m_panel2, wx.ID_ANY, u"Conserver la ponctuation", wx.DefaultPosition, wx.DefaultSize, 0 )
2382 self.m_staticText17.Wrap( -1 )
2383 fgSizer3.Add( self.m_staticText17, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2385 self.check_ponct = wx.CheckBox( self.m_panel2, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
2386 fgSizer3.Add( self.check_ponct, 0, wx.ALL, 5 )
2388 self.m_staticText16 = wx.StaticText( self.m_panel2, wx.ID_ANY, u"Pas d'espace entre deux formes", wx.DefaultPosition, wx.DefaultSize, 0 )
2389 self.m_staticText16.Wrap( -1 )
2390 fgSizer3.Add( self.m_staticText16, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2392 self.check_tolist = wx.CheckBox( self.m_panel2, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
2393 fgSizer3.Add( self.check_tolist, 0, wx.ALL, 5 )
2396 self.m_panel2.SetSizer( fgSizer3 )
2397 self.m_panel2.Layout()
2398 fgSizer3.Fit( self.m_panel2 )
2399 self.m_notebook1.AddPage( self.m_panel2, u"Nettoyage", False )
2401 bSizer1.Add( self.m_notebook1, 1, wx.EXPAND |wx.ALL, 5 )
2403 m_sdbSizer1 = wx.StdDialogButtonSizer()
2404 self.m_sdbSizer1OK = wx.Button( self, wx.ID_OK )
2405 m_sdbSizer1.AddButton( self.m_sdbSizer1OK )
2406 self.m_sdbSizer1Cancel = wx.Button( self, wx.ID_CANCEL )
2407 m_sdbSizer1.AddButton( self.m_sdbSizer1Cancel )
2408 m_sdbSizer1.Realize();
2410 bSizer1.Add( m_sdbSizer1, 0, wx.EXPAND, 5 )
2413 self.Bind(wx.EVT_BUTTON, self.OnChangeDir, self.m_button1)
2414 self.setparametres(parametres)
2415 self.SetSizer( bSizer1 )
2419 self.Centre( wx.BOTH )
2421 def OnChangeDir(self, evt) :
2422 dlg = wx.DirDialog(self.parent, u"Choisissez un répertoire", style = wx.DD_DEFAULT_STYLE)
2423 if dlg.ShowModal() == wx.ID_OK :
2424 self.repout_choices.SetValue(dlg.GetPath())
2426 def __del__( self ):
2429 def setparametres(self, parametres) :
2430 if locale.getpreferredencoding().lower() == 'mac-roman' :
2431 enc = self.encodages.index('macroman')
2434 enc = self.encodages.index(locale.getpreferredencoding().lower())
2436 enc = self.encodages.index('utf-8')
2437 self.encodage_choices.SetSelection(enc)
2438 self.lang_choices.SetSelection(0)
2439 self.repout_choices.SetValue(parametres['pathout'])
2440 self.ucimark_choices.SetSelection(parametres['ucimark'])
2441 self.check_expressions.SetValue(parametres['expressions'])
2442 self.check_makeuce.SetValue(parametres['douce'])
2443 self.uce_mode.SetSelection(parametres['ucemethod'])
2444 self.uce_size.SetValue(parametres['ucesize'])
2445 self.check_lower.SetValue(parametres['lower'])
2446 #self.check_charact.SetValue(parametres['charact'])
2447 self.txt_charact.SetValue(parametres['keep_caract'])
2448 self.check_apos.SetValue(parametres['apos'])
2449 self.check_tirets.SetValue(parametres['tiret'])
2450 self.check_tolist.SetValue(parametres['tolist'])
2451 self.check_ponct.SetValue(parametres['keep_ponct'])
2453 def doparametres(self) :
2455 parametres['encoding'] = encodages[self.encodage_choices.GetSelection()][0]
2456 parametres['lang'] = self.langues[self.lang_choices.GetSelection()]
2457 parametres['pathout'] = self.repout_choices.GetValue()
2458 parametres['ucimark'] = self.ucimark_choices.GetSelection()
2459 parametres['expressions'] = self.check_expressions.GetValue()
2460 parametres['douce'] = self.check_makeuce.GetValue()
2461 parametres['ucemethod'] = self.uce_mode.GetSelection()
2462 parametres['ucesize'] = self.uce_size.GetValue()
2463 parametres['lower'] = self.check_lower.GetValue()
2464 parametres['charact'] = self.check_charact.GetValue()
2465 parametres['keep_caract'] = self.txt_charact.GetValue()
2466 parametres['apos'] = self.check_apos.GetValue()
2467 parametres['tiret'] = self.check_tirets.GetValue()
2468 parametres['tolist'] = self.check_tolist.GetValue()
2469 parametres['keep_ponct'] = self.check_ponct.GetValue()
2470 for val in parametres :
2471 if isinstance(parametres[val], bool) :
2472 if parametres[val] :
2478 class message(wx.Dialog):
2479 def __init__(self, parent, title, size, save = True):
2480 wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = title, pos = wx.DefaultPosition, size = size, style = wx.DEFAULT_DIALOG_STYLE )
2482 self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
2485 self.HtmlPage=wx.html.HtmlWindow(self, -1)
2486 self.HtmlPage.SetMinSize( size )
2487 if "gtk2" in wx.PlatformInfo:
2488 self.HtmlPage.SetStandardFonts()
2489 self.HtmlPage.SetFonts('Courier','Courier')
2491 self.button_1 = wx.Button(self, wx.ID_CANCEL)
2493 self.Bind(wx.EVT_BUTTON, self.OnCloseMe, self.button_1)
2495 self.button_2 = wx.Button(self, wx.ID_SAVE)
2496 self.Bind(wx.EVT_BUTTON, self.OnSavePage, self.button_2)
2497 self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)
2500 def __do_layout(self):
2501 sizer_2 = wx.BoxSizer(wx.VERTICAL)
2502 sizer_2.Add(self.HtmlPage, 0, wx.EXPAND|wx.ADJUST_MINSIZE, 0)
2503 m_sdbSizer1 = wx.StdDialogButtonSizer()
2504 m_sdbSizer1.AddButton( self.button_1 )
2506 m_sdbSizer1.AddButton( self.button_2 )
2507 m_sdbSizer1.Realize()
2508 sizer_2.Add(m_sdbSizer1, 1, wx.EXPAND, 5)
2509 self.SetSizer(sizer_2)
2513 def OnSavePage(self, evt) :
2514 dlg = wx.FileDialog(
2515 self, message="Enregistrer sous...", defaultDir=os.getcwd(),
2516 defaultFile="concordancier.html", wildcard="html|*.html", style=wx.SAVE | wx.OVERWRITE_PROMPT
2518 dlg.SetFilterIndex(2)
2519 dlg.CenterOnParent()
2520 if dlg.ShowModal() == wx.ID_OK:
2521 path = dlg.GetPath()
2522 with open(path, 'w') as f :
2525 def OnCloseMe(self, event):
2528 def OnCloseWindow(self, event):
2531 class ExtractDialog ( wx.Dialog ):
2533 def __init__( self, parent, option ):
2534 wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = wx.EmptyString, pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.DEFAULT_DIALOG_STYLE )
2536 self.option = option
2538 self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
2540 fgSizer1 = wx.FlexGridSizer( 0, 2, 0, 0 )
2541 fgSizer1.SetFlexibleDirection( wx.BOTH )
2542 fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
2544 self.m_staticText1 = wx.StaticText( self, wx.ID_ANY, u"Corpus", wx.DefaultPosition, wx.DefaultSize, 0 )
2545 self.m_staticText1.Wrap( -1 )
2546 fgSizer1.Add( self.m_staticText1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2548 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 )
2549 self.corpusfile.SetMinSize( wx.Size( 500,-1 ) )
2551 fgSizer1.Add( self.corpusfile, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL|wx.EXPAND, 5 )
2553 self.m_staticText2 = wx.StaticText( self, wx.ID_ANY, u"Encodage", wx.DefaultPosition, wx.DefaultSize, 0 )
2554 self.m_staticText2.Wrap( -1 )
2555 fgSizer1.Add( self.m_staticText2, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2557 encodageChoices = [' - '.join(encodage) for encodage in encodages]
2558 self.encodage = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, encodageChoices, 0 )
2559 self.encodage.SetSelection( 0 )
2560 self.encodage.SetMinSize( wx.Size( 200,-1 ) )
2562 fgSizer1.Add( self.encodage, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL|wx.EXPAND, 5 )
2564 if option == 'splitvar' :
2565 self.m_staticText3 = wx.StaticText( self, wx.ID_ANY, u"Variable (avec * mais sans le _ )", wx.DefaultPosition, wx.DefaultSize, 0 )
2566 self.m_staticText3.Wrap( -1 )
2567 fgSizer1.Add( self.m_staticText3, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2569 self.txtvar = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
2570 self.txtvar.SetMinSize( wx.Size( 200,-1 ) )
2572 fgSizer1.Add( self.txtvar, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL|wx.EXPAND, 5 )
2574 if option == 'mods' :
2575 self.m_staticText4 = wx.StaticText( self, wx.ID_ANY, u"Modalités (une par ligne, avec * )", wx.DefaultPosition, wx.DefaultSize, 0 )
2576 self.m_staticText4.Wrap( -1 )
2577 fgSizer1.Add( self.m_staticText4, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2579 self.txtmods = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.TE_MULTILINE )
2580 self.txtmods.SetMinSize( wx.Size( 200,150 ) )
2582 fgSizer1.Add( self.txtmods, 0, wx.ALL|wx.EXPAND, 5 )
2584 self.m_staticText5 = wx.StaticText( self, wx.ID_ANY, u"Format de l'extraction", wx.DefaultPosition, wx.DefaultSize, 0 )
2585 self.m_staticText5.Wrap( -1 )
2586 fgSizer1.Add( self.m_staticText5, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2588 extractformatChoices = [ u"Un seul fichier", u"Un fichier par modalité" ]
2589 self.extractformat = wx.RadioBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, extractformatChoices, 1, wx.RA_SPECIFY_COLS )
2590 self.extractformat.SetSelection( 0 )
2591 fgSizer1.Add( self.extractformat, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2594 fgSizer1.AddSpacer( ( 0, 0), 1, wx.EXPAND, 5 )
2596 m_sdbSizer1 = wx.StdDialogButtonSizer()
2597 self.m_sdbSizer1OK = wx.Button( self, wx.ID_OK )
2598 m_sdbSizer1.AddButton( self.m_sdbSizer1OK )
2599 self.m_sdbSizer1Cancel = wx.Button( self, wx.ID_CANCEL )
2600 m_sdbSizer1.AddButton( self.m_sdbSizer1Cancel )
2601 m_sdbSizer1.Realize();
2603 fgSizer1.Add( m_sdbSizer1, 1, wx.EXPAND, 5 )
2606 self.SetSizer( fgSizer1 )
2608 fgSizer1.Fit( self )
2610 self.Centre( wx.BOTH )
2612 def make_param(self) :
2614 le = [enc[0].lower() for enc in encodages]
2615 parametres['filein'] = self.corpusfile.GetPath()
2616 encodage = le[self.encodage.GetSelection()]
2617 parametres['encodein'] = encodage
2618 if self.option == 'splitvar' :
2619 parametres['var'] = self.txtvar.GetValue()
2620 if self.option == 'mods' :
2621 parametres['mods'] = self.txtmods.GetValue().splitlines()
2622 if self.extractformat.GetSelection() == 0 :
2623 parametres['onefile'] = True
2625 parametres['onefile'] = False
2626 parametres['encodeout'] = locale.getpreferredencoding()
2629 def __del__( self ):
2632 class FreqDialog(wx.Dialog):
2633 def __init__(self, parent, ID, listcol, title, size) :
2634 wx.Dialog.__init__(self, parent, ID, title, size=size, pos=wx.DefaultPosition,style=wx.DEFAULT_DIALOG_STYLE | wx.CANCEL | wx.OK )
2635 pre = wx.PreDialog()
2636 pre.SetExtraStyle(wx.DIALOG_EX_CONTEXTHELP)
2637 pre.Create(parent, ID, title, wx.DefaultPosition, size, wx.DEFAULT_DIALOG_STYLE | wx.CANCEL | wx.OK)
2638 self.PostCreate(pre)
2639 self.parent = parent
2640 sizer = wx.BoxSizer(wx.VERTICAL)
2641 #self.content = parent.content
2642 self.header = listcol
2644 #for i in self.header:
2646 # if len(forme) > 60 :
2647 # LABELLIST.append(i[0:60])
2649 # LABELLIST.append(i)
2650 self.list_box_1 = wx.ListBox(self, -1, choices=self.header, style=wx.LB_EXTENDED | wx.LB_HSCROLL)
2651 sizer.Add(self.list_box_1, 0, 5)
2653 btnsizer = wx.BoxSizer(wx.HORIZONTAL)
2655 btn = wx.Button(self, wx.ID_CANCEL)
2656 btn.SetHelpText("Annuler")
2659 btn = wx.Button(self, wx.ID_OK)
2660 btn.SetHelpText("Valider")
2664 sizer.Add(btnsizer, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_CENTER_HORIZONTAL, 5)
2665 self.SetSizer(sizer)
2667 self.SetTitle(u"Sélection")