1 # -*- coding: utf-8 -*-
2 #Author: Pierre Ratinaud
3 #Copyright (c) 2008-2020 Pierre Ratinaud
4 #modification pour python 3 : Laurent Mérat, 6x7 - mai 2020
7 #------------------------------------
8 # import des modules python
9 #------------------------------------
12 from shutil import copyfile
15 from KeyFrame import AlcOptFrame
17 #------------------------------------
18 # import des modules wx
19 #------------------------------------
22 import wx.lib.colourselect as csel
23 import wx.lib.sized_controls as sc
24 import wx.lib.filebrowsebutton as filebrowse
25 import wx.lib.agw.hyperlink as hl
27 #------------------------------------
28 # import des fichiers du projet
29 #------------------------------------
30 from functions import DoConf, exec_rcode, translation_languages
31 from PrintRScript import barplot, ChronoChi2Script, ChronoPropScript, ChronoggScript
35 provider = wx.SimpleHelpProvider()
36 wx.HelpProvider.Set(provider)
39 encodages = [['cp1252','Western Europe'],
40 ['utf-8','all languages'],
41 ['MacRoman','Western Europe'],
43 ['big5', 'Traditional Chinese'],
44 ['big5hkscs', 'Traditional Chinese'],
48 ['cp500', 'Western Europe'],
50 ['cp775', 'Baltic languages'],
51 ['cp850', 'Western Europe'],
52 ['cp852', 'Central and Eastern Europe'],
53 ['cp855', 'Bulg, Byelorus, Mace, Rus, Serb'],
56 ['cp860', 'Portuguese'],
57 ['cp861', 'Icelandic'],
59 ['cp863', 'Canadian'],
61 ['cp865', 'Danish, Norwegian'],
66 ['cp932', 'Japanese'],
68 ['cp950', 'Traditional Chinese'],
70 ['cp1026', 'Turkish'],
71 ['cp1140', 'Western Europe'],
72 ['cp1250', 'Central and Eastern Europe'],
73 ['cp1251', 'Bulg, Byelorus, Mace, Rus, Serb'],
75 ['cp1254', 'Turkish'],
78 ['cp1257', 'Baltic languages'],
79 ['cp1258', 'Vietnamese'],
80 ['euc_jp', 'Japanese'],
81 ['euc_jis_2004', 'Japanese'],
82 ['euc_jisx0213', 'Japanese'],
84 ['gb2312', 'Simplified Chinese'],
85 ['gbk', 'Unified Chinese'],
86 ['gb18030', 'Unified Chinese'],
87 ['hz', 'Simplified Chinese'],
88 ['iso2022_jp', 'Japanese'],
89 ['iso2022_jp_1', 'Japanese'],
90 ['iso2022_jp_2', 'Jp, K, S C, WE, G'],
91 ['iso2022_jp_2004', 'Japanese'],
92 ['iso2022_jp_3', 'Japanese'],
93 ['iso2022_jp_ext', 'Japanese'],
94 ['iso2022_kr', 'Korean'],
95 ['latin_1', 'West Europe'],
96 ['iso8859_2', 'Central and Eastern Europe'],
97 ['iso8859_3', 'Esperanto, Maltese'],
98 ['iso8859_4', 'Baltic languages'],
99 ['iso8859_5', 'Bulg, Byelorus, Mace, Rus, Serb'],
100 ['iso8859_6', 'Arabic'],
101 ['iso8859_7', 'Greek'],
102 ['iso8859_8', 'Hebrew'],
103 ['iso8859_9', 'Turkish'],
104 ['iso8859_10', 'Nordic languages'],
105 ['iso8859_13', 'Baltic languages'],
106 ['iso8859_14', 'Celtic languages'],
107 ['iso8859_15', 'Western Europe'],
108 ['iso8859_16', 'South-Eastern Europe'],
110 ['koi8_r', 'Russian'],
111 ['koi8_u', 'Ukrainian'],
112 ['mac_cyrillic', 'Bulg, Byelorus, Mace, Rus, Serb'],
113 ['mac_greek', 'Greek'],
114 ['mac_iceland', 'Icelandic'],
115 ['mac_latin2', 'Central and Eastern Europe'],
116 ['mac_turkish', 'Turkish'],
117 ['ptcp154', 'Kazakh'],
118 ['shift_jis', 'Japanese'],
119 ['shift_jis_2004', 'Japanese'],
120 ['shift_jisx0213', 'Japanese'],
121 ['utf_32', 'all languages'],
122 ['utf_32_be', 'all languages'],
123 ['utf_32_le', 'all languages'],
124 ['utf_16', 'all languages'],
125 ['utf_16_be', 'all languages (BMP only)'],
126 ['utf_16_le', 'all languages (BMP only)'],
127 ['utf_7', 'all languages'],
128 ['utf_8_sig', 'all languages']]
131 class FileOptionDialog(wx.Dialog):
134 self, parent, ID, title, sep=False, sheet = False, size=wx.DefaultSize, pos=wx.DefaultPosition,
135 style=wx.DEFAULT_DIALOG_STYLE
138 wx.Dialog.__init__(self) # 1
139 self.SetExtraStyle(wx.DIALOG_EX_CONTEXTHELP) # 2
140 self.Create(parent, ID, title) # 3
142 sizer = wx.BoxSizer(wx.VERTICAL)
143 grid_sizer = wx.FlexGridSizer(0, 2, 2, 2)
144 label = wx.StaticText(self, -1, _("First line is header"))
145 label.SetHelpText(_("First line is header"))
146 grid_sizer.Add(label, 0, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
147 on = [ _("yes"), _("no") ]
148 self.radio_box_1 = wx.RadioBox(self, -1, "", choices=on, majorDimension=0, style=wx.RA_SPECIFY_ROWS)
149 self.radio_box_1.SetHelpText(_("First line is header"))
150 grid_sizer.Add(self.radio_box_1, 1, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
151 label = wx.StaticText(self, -1, _("First column is an id"))
152 label.SetHelpText(_("First column is an id"))
153 grid_sizer.Add(label, 0, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
154 on = [ _("yes"), _("no") ]
155 self.radio_box_2 = wx.RadioBox(self, -1, "", choices=on, majorDimension=0, style=wx.RA_SPECIFY_ROWS)
156 self.radio_box_2.SetHelpText(_("First column is an id"))
157 grid_sizer.Add(self.radio_box_2, 1, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
159 label = wx.StaticText(self, -1, _("Column separator"))
160 label.SetHelpText(_("Column separator"))
161 grid_sizer.Add(label, 0, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
162 self.colsep = [";", "tabulation", ","]
163 self.choice3 = wx.Choice(self, -1, (100, 50), choices=self.colsep)
164 self.choice3.SetHelpText(_("Column separator"))
165 grid_sizer.Add(self.choice3, 1, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
166 label = wx.StaticText(self, -1, _("Text separator"))
167 label.SetHelpText(_("Text separator"))
168 grid_sizer.Add(label, 0, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
169 self.txtsep = ["\"", "'"]
170 self.choice4 = wx.Choice(self, -1, (100, 50), choices=self.txtsep)
171 self.choice4.SetHelpText(_("Text separator"))
172 grid_sizer.Add(self.choice4, 1, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
173 self.choice3.SetSelection(0)
174 self.choice4.SetSelection(0)
175 self.text = wx.StaticText(self, -1, _("Characters set"))
176 grid_sizer.Add(self.text, 1, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
177 self.le = [enc[0].lower() for enc in encodages]
178 self.list_encodages = wx.Choice(self, -1, (25, 30), choices=[' - '.join(encodage) for encodage in encodages])
179 if locale.getpreferredencoding().lower() == 'mac-roman' :
180 enc = self.le.index('macroman')
183 enc = self.le.index(sys.getdefaultencoding().lower())
185 enc = self.le.index('utf-8')
186 self.list_encodages.SetSelection(enc)
187 grid_sizer.Add(self.list_encodages, 1, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
189 label = wx.StaticText(self, -1, "Feuille ")
190 grid_sizer.Add(label, 0, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
191 self.spin1 = wx.SpinCtrl(self, -1, '',size = wx.DefaultSize, min=1, max=500)
192 grid_sizer.Add(self.spin1, 1, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
193 sizer.Add(grid_sizer, 0, wx.GROW | wx.ALL, 5)
194 line = wx.StaticLine(self, -1, size=(20, -1), style=wx.LI_HORIZONTAL)
195 sizer.Add(line, 0, wx.GROW | wx.RIGHT | wx.TOP, 5)
196 btnsizer = wx.StdDialogButtonSizer()
197 if wx.Platform != "__WXMSW__":
198 btn = wx.ContextHelpButton(self)
199 btnsizer.AddButton(btn)
200 btn = wx.Button(self, wx.ID_OK)
202 btnsizer.AddButton(btn)
203 btn = wx.Button(self, wx.ID_CANCEL)
204 btnsizer.AddButton(btn)
206 sizer.Add(btnsizer, 0, wx.ALIGN_CENTER_HORIZONTAL, 5)
211 class ClusterNbDialog(wx.Dialog):
214 self, LIST_CLASSE, parent, ID, title, size=wx.DefaultSize, pos=wx.DefaultPosition,
215 style=wx.DEFAULT_DIALOG_STYLE
217 wx.Dialog.__init__(self) # 1
218 self.SetExtraStyle(wx.DIALOG_EX_CONTEXTHELP) # 2
219 self.Create(parent, ID, title) # 3
220 sizer = wx.BoxSizer(wx.VERTICAL)
221 label = wx.StaticText(self, -1, "Résultats de la classification")
222 label.SetHelpText("This is the help text for the label")
223 sizer.Add(label, 0, wx.ALIGN_CENTRE | wx.ALL, 5)
224 box = wx.BoxSizer(wx.HORIZONTAL)
225 label = wx.StaticText(self, -1, "Choisissez le nombre de classes")
226 label.SetHelpText("This is the help text for the label")
227 box.Add(label, 0, wx.ALIGN_CENTRE | wx.ALL, 5)
229 if type(LIST_CLASSE) != float :
230 for i in LIST_CLASSE :
231 LIST_CLASSE_OK.append(str(i))
233 LIST_CLASSE_OK.append(str(LIST_CLASSE))
234 self.list_box_1 = wx.ListBox(self, -1, choices=LIST_CLASSE_OK, style=wx.LB_SINGLE | wx.LB_HSCROLL)
235 self.list_box_1.SetHelpText("Here's some help text for field #1")
236 box.Add(self.list_box_1, 1, wx.ALIGN_CENTRE | wx.ALL, 5)
237 sizer.Add(box, 0, wx.GROW | wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5)
238 line = wx.StaticLine(self, -1, size=(20, -1), style=wx.LI_HORIZONTAL)
239 sizer.Add(line, 0, wx.GROW | wx.ALIGN_CENTER_VERTICAL | wx.RIGHT | wx.TOP, 5)
240 btnsizer = wx.StdDialogButtonSizer()
241 if wx.Platform != "__WXMSW__":
242 btn = wx.ContextHelpButton(self)
243 btnsizer.AddButton(btn)
244 btn = wx.Button(self, wx.ID_OK)
246 btnsizer.AddButton(btn)
247 btn = wx.Button(self, wx.ID_CANCEL)
248 btnsizer.AddButton(btn)
250 sizer.Add(btnsizer, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5)
255 class CHDDialog(wx.Dialog):
258 self, parent, ID, title, size=wx.DefaultSize, pos=wx.DefaultPosition,
259 style=wx.DEFAULT_DIALOG_STYLE | wx.CANCEL
261 wx.Dialog.__init__(self) # 1
262 self.SetExtraStyle(wx.DIALOG_EX_CONTEXTHELP) # 2
263 self.Create(parent, ID, title) # 3
264 self.colsep = parent.colsep
266 self.content = parent.content[:]
267 self.header = parent.header[:]
269 for i in self.header:
271 LABELLIST.append(i[0:60])
274 self.LABELLISTTOT = LABELLIST
276 self.text1 = wx.StaticText(self, -1, "Variables Actives (au moins 3)")
277 self.text2 = wx.StaticText(self, -1, "Variables Supplémentaires (au moins 1)")
278 self.list_box_1 = wx.ListBox(self, -1, choices=LABELLIST, style=wx.LB_EXTENDED | wx.LB_HSCROLL)
279 self.list_box_2 = wx.ListBox(self, -1, choices=LABELLIST, style=wx.LB_EXTENDED | wx.LB_HSCROLL)
280 self.button_cancel = wx.Button(self, wx.ID_CANCEL)
281 self.button_back = wx.Button(self, wx.ID_BACKWARD)
282 self.button_forw = wx.Button(self, wx.ID_FORWARD)
283 self.button_ok = wx.Button(self, wx.ID_OK)
284 self.button_pref = wx.Button(self, wx.ID_PROPERTIES)
285 self.button_selectall = wx.Button(self, wx.NewId(), "Sélectionner tout")
286 self.__set_properties()
288 self.Bind(wx.EVT_BUTTON, self.OnPrec, self.button_back)
289 self.Bind(wx.EVT_BUTTON, self.OnSuivant, self.button_forw)
290 self.Bind(wx.EVT_BUTTON, self.OnValider, self.button_ok)
291 self.Bind(wx.EVT_BUTTON, self.OnSelectAll, self.button_selectall)
294 self.TEMPDIR = parent.TEMPDIR
297 def __set_properties(self):
298 # begin wxGlade: ConfChi2.__set_properties
299 self.SetTitle("Sélection des variables")
300 self.list_box_2.Enable(False)
301 self.button_ok.Enable(False)
302 self.button_back.Enable(False)
305 def __do_layout(self):
306 # begin wxGlade: ConfChi2.__do_layout
307 sizer_1 = wx.BoxSizer(wx.VERTICAL)
308 sizer_2 = wx.BoxSizer(wx.VERTICAL)
309 sizer_3 = wx.BoxSizer(wx.HORIZONTAL)
310 sizer_4 = wx.BoxSizer(wx.HORIZONTAL)
311 sizer_5 = wx.BoxSizer(wx.HORIZONTAL)
312 sizer_6 = wx.BoxSizer(wx.HORIZONTAL)
313 sizer_7 = wx.BoxSizer(wx.HORIZONTAL)
314 sizer_5.Add(self.text1, 1, wx.CENTER | wx.ALL, 0)
315 sizer_5.Add(self.text2, 1, wx.CENTER | wx.ALL, 0)
316 sizer_3.Add(self.list_box_1, 0, wx.EXPAND, 0)
317 sizer_3.Add(self.list_box_2, 0, wx.EXPAND, 0)
318 sizer_6.Add(self.button_selectall, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL, 0)
319 sizer_7.Add(self.button_cancel, 0, wx.ALL, 0)
320 sizer_7.Add(self.button_pref, 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
321 sizer_7.Add(self.button_ok, 0, wx.wx.ALIGN_CENTER_HORIZONTAL, 0)
322 sizer_4.Add(self.button_back, 0, wx.ALL, 0)
323 sizer_4.Add(self.button_forw, 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
324 sizer_2.Add(sizer_5, 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
325 sizer_2.Add(sizer_3, 1, wx.EXPAND, 0)
326 sizer_2.Add(sizer_6, 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
327 sizer_2.Add(sizer_4, 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
328 sizer_2.Add(sizer_7, 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
329 sizer_1.Add(sizer_2, 1, wx.EXPAND, 4)
330 self.SetSizer(sizer_1)
335 #--------------FIXME-----------------------
336 #NETTOYAGE des variables inutiles
337 def OnSuivant(self, event):
338 LISTACTIVE = self.list_box_1.GetSelections()
339 if len(LISTACTIVE) != len(self.LABELLISTTOT) and len(LISTACTIVE) >= 3:
340 self.button_ok.Enable(True)
342 self.LISTHEADERINDICE = []
343 self.LISTNUMACTIVE = []
345 header = self.header[:]
346 for i in range(0, len(header)):
347 self.LISTHEADERINDICE.append(i)
348 for i in LISTACTIVE :
349 self.LISTNUMACTIVE.append(i)
350 header.pop(i - COMPT)
351 self.LISTHEADERINDICE.pop(i - COMPT)
356 self.LABELLIST.append(i[0:60])
358 self.LABELLIST.append(i)
359 self.list_box_2.Clear()
360 for i in self.LABELLIST :
361 self.list_box_2.Append(i)
362 self.list_box_1.Enable(False)
363 self.list_box_2.Enable(True)
364 self.button_forw.Enable(False)
365 self.button_back.Enable(True)
367 def OnValider(self, event):
368 LISTVARSUPSEL = self.list_box_2.GetSelections()
369 for i in LISTVARSUPSEL :
370 self.LISTVARSUP.append(self.LISTHEADERINDICE[i])
373 def OnPrec(self, event):
374 self.list_box_1.Enable(True)
375 self.list_box_2.Enable(False)
376 self.button_forw.Enable(True)
377 self.button_back.Enable(False)
378 self.button_ok.Enable(False)
382 def OnSelectAll(self, event):
384 for i in range(len(self.LABELLISTTOT)):
385 self.list_box_1.Select(i)
387 for i in range(len(self.LABELLIST)):
388 self.list_box_2.Select(i)
390 class PrefDialog ( wx.Dialog ):
392 def __init__( self, parent ):
393 wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = _("Settings"), pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.DEFAULT_DIALOG_STYLE )
395 self.SetSizeHints( wx.DefaultSize, wx.DefaultSize )
396 bSizer1 = wx.BoxSizer( wx.VERTICAL )
397 fgSizer1 = wx.FlexGridSizer( 0, 3, 0, 0 )
398 fgSizer1.SetFlexibleDirection( wx.BOTH )
399 fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
400 self.m_staticText1 = wx.StaticText( self, wx.ID_ANY, _("Play a sound at the end of analysis"), wx.DefaultPosition, wx.DefaultSize, 0 )
401 self.m_staticText1.Wrap( -1 )
402 fgSizer1.Add( self.m_staticText1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
403 self.m_staticText2 = wx.StaticText( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
404 self.m_staticText2.Wrap( -1 )
405 fgSizer1.Add( self.m_staticText2, 0, wx.ALL, 5 )
406 m_radioBox1Choices = [ _("yes"), _("no") ]
407 self.m_radioBox1 = wx.RadioBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, m_radioBox1Choices, 1, wx.RA_SPECIFY_COLS )
408 self.m_radioBox1.SetSelection( 0 )
409 fgSizer1.Add( self.m_radioBox1, 0, wx.ALIGN_RIGHT|wx.ALL, 5 )
410 msg = _("""Check for new
411 releases at startup""")
412 self.m_staticText3 = wx.StaticText( self, wx.ID_ANY, msg, wx.DefaultPosition, wx.DefaultSize, 0 )
413 self.m_staticText3.Wrap( -1 )
414 fgSizer1.Add( self.m_staticText3, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
415 self.m_staticText4 = wx.StaticText( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
416 self.m_staticText4.Wrap( -1 )
417 fgSizer1.Add( self.m_staticText4, 0, wx.ALL, 5 )
418 m_radioBox2Choices = [ _("yes"), _("no") ]
419 self.m_radioBox2 = wx.RadioBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, m_radioBox2Choices, 1, wx.RA_SPECIFY_COLS )
420 self.m_radioBox2.SetSelection( 0 )
421 fgSizer1.Add( self.m_radioBox2, 0, wx.ALIGN_RIGHT|wx.ALL, 5 )
422 msg = _("Interface language")
423 self.m_staticText45 = wx.StaticText( self, wx.ID_ANY, msg, wx.DefaultPosition, wx.DefaultSize, 0 )
424 self.m_staticText45.Wrap( -1 )
425 fgSizer1.Add( self.m_staticText45, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
426 self.m_staticText46 = wx.StaticText( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
427 self.m_staticText46.Wrap( -1 )
428 fgSizer1.Add( self.m_staticText46, 0, wx.ALL, 5 )
429 self.listlangues = [ "english","french", "italian", "portuguese", "spanish"]
430 self.langues = wx.Choice( self, wx.ID_ANY, (200, -1), choices = self.listlangues)
431 #self.langues.SetSelection( 0 )
432 fgSizer1.Add( self.langues, 0, wx.ALIGN_RIGHT|wx.ALL, 5 )
433 msg = _("""Check installation
435 self.m_staticText5 = wx.StaticText( self, wx.ID_ANY, msg, wx.DefaultPosition, wx.DefaultSize, 0 )
436 self.m_staticText5.Wrap( -1 )
437 fgSizer1.Add( self.m_staticText5, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
438 self.m_staticText6 = wx.StaticText( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
439 self.m_staticText6.Wrap( -1 )
440 fgSizer1.Add( self.m_staticText6, 0, wx.ALL, 5 )
441 self.m_button1 = wx.Button( self, wx.ID_ANY, _("Check"), wx.DefaultPosition, wx.DefaultSize, 0 )
442 fgSizer1.Add( self.m_button1, 0, wx.ALIGN_RIGHT|wx.ALL, 5 )
443 bSizer1.Add( fgSizer1, 1, wx.EXPAND, 5 )
444 if sys.platform == 'win32' :
445 bSizer2 = wx.BoxSizer( wx.HORIZONTAL )
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 )
451 self.m_checkBox1 = wx.CheckBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
452 bSizer2.Add( self.m_checkBox1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
453 self.m_spinCtrl1 = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 32, 16000, 1535 )
454 bSizer2.Add( self.m_spinCtrl1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
455 self.m_staticline7 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
456 bSizer2.Add( self.m_staticline7, 0, wx.EXPAND |wx.ALL, 5 )
457 bSizer1.Add( bSizer2, 0, wx.EXPAND, 5 )
458 self.m_checkBox1.Bind( wx.EVT_CHECKBOX, self.oncheckmem )
459 bSizer3 = wx.BoxSizer( wx.HORIZONTAL )
460 bSizer4 = wx.BoxSizer( wx.HORIZONTAL )
461 self.text8 = wx.StaticText( self, wx.ID_ANY, _("Use svdlibc"), wx.DefaultPosition, wx.DefaultSize, 0 )
462 self.text8.Wrap( -1 )
463 fgSizer1.Add( self.text8, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
464 self.check_svdc = wx.CheckBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
465 bSizer4.Add( self.check_svdc, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
466 bSizer3.Add( bSizer4, 0, wx.EXPAND, 5 )
467 self.fbb = filebrowse.FileBrowseButton(self, -1, size=(250, -1), fileMode = 2, fileMask = '*')
468 bSizer3.Add( self.fbb, 0, wx.EXPAND, 5 )
469 self.fbb.SetLabel(_("Path : "))
470 fgSizer1.Add( wx.StaticText(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 ), wx.ID_ANY, wx.ALL, 5)
471 fgSizer1.Add( bSizer3, 0, wx.ALIGN_RIGHT|wx.ALL, 5 )
472 Rpath_text = wx.StaticText( self, wx.ID_ANY, _("R path"), wx.DefaultPosition, wx.DefaultSize, 0 )
473 Rpath_text.Wrap( -1 )
474 fgSizer1.Add( Rpath_text, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
475 fgSizer1.Add( wx.StaticText(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 ), wx.ID_ANY, wx.ALL, 5)
476 self.Rpath_value = filebrowse.FileBrowseButton(self, -1, size=(350, -1), fileMode = 2, fileMask = '*')
477 self.Rpath_value.SetLabel(_("Path : "))
478 fgSizer1.Add( self.Rpath_value, 0, wx.ALIGN_RIGHT|wx.ALL, 5 )
479 mirror_text = wx.StaticText( self, wx.ID_ANY, _("Default R mirror"), wx.DefaultPosition, wx.DefaultSize, 0 )
480 mirror_text.Wrap( -1 )
481 fgSizer1.Add( mirror_text, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
482 fgSizer1.Add( wx.StaticText(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 ), wx.ID_ANY, wx.ALL, 5)
483 self.mirror_value = wx.TextCtrl( self, wx.ID_ANY, 'http://cran.univ-lyon1.fr', wx.DefaultPosition, wx.Size( 300,30 ), 0 )
484 fgSizer1.Add( self.mirror_value, 0, wx.ALIGN_RIGHT|wx.ALL, 5 )
485 m_sdbSizer1 = wx.StdDialogButtonSizer()
486 self.m_sdbSizer1OK = wx.Button( self, wx.ID_OK )
487 m_sdbSizer1.AddButton( self.m_sdbSizer1OK )
488 self.m_sdbSizer1Cancel = wx.Button( self, wx.ID_CANCEL )
489 m_sdbSizer1.AddButton( self.m_sdbSizer1Cancel )
490 m_sdbSizer1.Realize()
491 bSizer1.Add( m_sdbSizer1, 0, wx.EXPAND, 5 )
492 self.SetSizer( bSizer1 )
495 self.Centre( wx.BOTH )
497 self.m_sdbSizer1OK.Bind( wx.EVT_BUTTON, self.OnValid )
498 self.m_button1.Bind( wx.EVT_BUTTON, parent.OnVerif )
499 self.check_svdc.Bind( wx.EVT_CHECKBOX, self.OnSVDC )
500 self.__set_properties()
502 def __set_properties(self):
503 self.SetTitle(_("Settings"))
504 if self.parent.pref.getboolean('iramuteq', 'sound'): val1 = 0
506 self.m_radioBox1.SetSelection(val1)
507 if self.parent.pref.getboolean('iramuteq', 'checkupdate') : val2 = 0
509 self.m_radioBox2.SetSelection(val2)
510 self.langues.SetSelection(self.listlangues.index(self.parent.pref.get('iramuteq', 'guilanguage')))
511 if sys.platform == 'win32' :
512 if self.parent.pref.getboolean('iramuteq', 'R_mem') :
513 self.m_checkBox1.SetValue(True)
514 self.m_spinCtrl1.Enable(True)
515 self.m_spinCtrl1.SetValue(self.parent.pref.getint('iramuteq', 'R_max_mem'))
517 self.m_checkBox1.SetValue(False)
518 self.m_spinCtrl1.Enable(False)
519 if self.parent.pref.getboolean('iramuteq', 'libsvdc') :
520 self.check_svdc.SetValue(True)
521 self.fbb.SetValue(self.parent.pref.get('iramuteq', 'libsvdc_path'))
523 self.check_svdc.SetValue(False)
524 self.fbb.SetValue(self.parent.pref.get('iramuteq', 'libsvdc_path'))
525 self.fbb.Enable(False)
526 self.Rpath_value.SetValue(self.parent.PathPath.get('PATHS', 'rpath'))
527 self.mirror_value.SetValue(self.parent.pref.get('iramuteq', 'rmirror'))
529 def oncheckmem(self, evt):
530 if self.m_checkBox1.GetValue() :
531 self.m_spinCtrl1.Enable(True)
533 self.m_spinCtrl1.Enable(False)
535 def OnSVDC(self, evt):
536 if self.check_svdc.GetValue() :
537 self.fbb.Enable(True)
539 self.fbb.Enable(False)
541 def OnValid(self, event):
543 if self.m_radioBox1.GetSelection() == 0 : valsound = 'true'
544 else : valsound = 'false'
545 parent.pref.set('iramuteq', 'sound', valsound)
546 if self.m_radioBox2.GetSelection() == 0 : valcheck = 'true'
547 else : valcheck = 'false'
548 parent.pref.set('iramuteq', 'checkupdate', valcheck)
549 parent.pref.set('iramuteq', 'guilanguage', self.listlangues[self.langues.GetSelection()])
550 if sys.platform == 'win32' :
551 if self.m_checkBox1.GetValue() :
552 parent.pref.set('iramuteq', 'R_mem', 'true')
553 parent.pref.set('iramuteq', 'R_max_mem', str(self.m_spinCtrl1.GetValue()))
555 parent.pref.set('iramuteq', 'R_mem', 'false')
556 if self.check_svdc.GetValue() :
557 parent.pref.set('iramuteq', 'libsvdc', 'true')
559 parent.pref.set('iramuteq', 'libsvdc', 'false')
560 parent.pref.set('iramuteq', 'libsvdc_path', self.fbb.GetValue())
561 self.parent.pref.set('iramuteq', 'rmirror', self.mirror_value.GetValue())
562 file = open(parent.ConfigPath['preferences'], 'w', encoding='utf8')
563 parent.pref.write(file)
565 self.parent.PathPath.set('PATHS', 'rpath', self.Rpath_value.GetValue())
566 with open(self.parent.ConfigPath['path'], 'w', encoding='utf8') as f:
567 self.parent.PathPath.write(f)
570 class PrefGraph(wx.Dialog):
572 def __init__(self, parent, ID, paramgraph, title = '', size=wx.DefaultSize, pos=wx.DefaultPosition, style=wx.DEFAULT_DIALOG_STYLE):
573 wx.Dialog.__init__(self) # 1
574 self.SetExtraStyle(wx.DIALOG_EX_CONTEXTHELP) # 2
575 self.Create(parent, ID, title) # 3
577 self.paramgraph=paramgraph
578 self.labeltype = wx.StaticText(self, -1, _("Graphic type"))
579 if self.paramgraph['clnb'] <= 3 :
580 choix = ['2D', 'web 2D']
582 choix=['2D' ,'3D', 'web 2D', 'web 3D', 'Blender']
583 self.choicetype = wx.Choice(self, -1, (100,50), choices=choix)
584 self.label_format = wx.StaticText(self, -1, _("Picture format"))
585 self.choix_format = wx.Choice(self, -1, (100,50), choices = ['png', 'svg'])
586 self.label_1 = wx.StaticText(self, -1, _("width"))
587 self.spin1 = wx.SpinCtrl(self, -1, '',size = wx.DefaultSize, min=100, max=5000)
588 self.label_2 = wx.StaticText(self, -1, _("height"))
589 self.spin2 = wx.SpinCtrl(self, -1, '', size = wx.DefaultSize, min=100, max=5000)
590 self.label_what = wx.StaticText(self, -1, _("Representation"))
591 self.choice1 = wx.Choice(self, -1, (100,50), choices=[_("coordinates"),_("correlations")])
592 self.label_qui = wx.StaticText(self, -1, 'Variables')
593 self.choice2 = wx.Choice(self, -1, (100,50), choices=[_("actives") ,_("supplementaries"), _("stars"), _("clusters")])
594 self.label_3 = wx.StaticText(self, -1, _("Text size"))
595 self.spin3 = wx.SpinCtrl(self, -1, '', size = wx.DefaultSize, min=1, max=20)
596 txt = _("Take the x first points")
597 self.label_4 = wx.StaticText(self, -1, txt)
598 self.check1 = wx.CheckBox(self, -1)
599 self.spin_nb = wx.SpinCtrl(self, -1, '', size = wx.DefaultSize, min=2, max=1000)
600 txt = _("Take the x first points by cluster")
601 self.label_chic = wx.StaticText(self, -1, txt)
602 self.check_chic = wx.CheckBox(self, -1)
603 self.spin_nbchic = wx.SpinCtrl(self, -1, '', size = wx.DefaultSize, min=2, max=1000)
604 txt = _("Limit points by cluster chi2")
605 self.label_5 = wx.StaticText(self, -1, txt)
606 self.check2 = wx.CheckBox(self, -1)
607 self.spin_chi = wx.SpinCtrl(self, -1, '',size = wx.DefaultSize, min=2, max=1000)
608 self.label_6 = wx.StaticText(self, -1, _("Avoid overlay"))
609 self.check3 = wx.CheckBox(self, -1)
610 txt = _("Text size proportional to frequency")
611 self.label_7 = wx.StaticText(self, -1, txt)
612 self.check4 = wx.CheckBox(self, -1)
613 self.label_min = wx.StaticText(self, -1, 'min')
614 self.spin_min = wx.SpinCtrl(self, -1, '',size = wx.DefaultSize, min = 1, max = 100)
615 self.label_max = wx.StaticText(self, -1, 'max')
616 self.spin_max = wx.SpinCtrl(self, -1, '',size = wx.DefaultSize, min = 1, max = 100)
617 txt = _("Text size proportional to chi2")
618 self.label_tchi = wx.StaticText(self, -1, txt)
619 self.check_tchi = wx.CheckBox(self, -1)
620 self.label_min_tchi = wx.StaticText(self, -1, 'min')
621 self.spin_min_tchi = wx.SpinCtrl(self, -1, '', size = wx.DefaultSize, min = 1, max = 100)
622 self.label_max_tchi = wx.StaticText(self, -1, 'max')
623 self.spin_max_tchi = wx.SpinCtrl(self, -1, '', size = wx.DefaultSize, min = 1, max = 100)
624 self.label_8 = wx.StaticText(self, -1, _("Factor x : "))
625 self.spin_f1 = wx.SpinCtrl(self, -1, '',size = wx.DefaultSize, min=1, max=self.paramgraph['clnb']-1)
626 self.label_9 = wx.StaticText(self, -1, _("Factor y : "))
627 self.spin_f2 = wx.SpinCtrl(self, -1, '',size = wx.DefaultSize, min=1, max=self.paramgraph['clnb']-1)
628 self.label_f3 = wx.StaticText(self, -1, _("Factor z : "))
629 self.spin_f3 = wx.SpinCtrl(self, -1, '',size = wx.DefaultSize, min=1, max=self.paramgraph['clnb']-1)
630 self.label_sphere = wx.StaticText(self, -1, _("Spheres transparency"))
631 self.slider_sphere = wx.Slider(self, -1, 10, 1, 100, size = (255,-1), style = wx.SL_HORIZONTAL | wx.SL_AUTOTICKS | wx.SL_LABELS)
632 self.label_film = wx.StaticText(self, -1, _("Make a movie"))
633 self.film = wx.CheckBox(self, -1)
634 self.btnsizer = wx.StdDialogButtonSizer()
635 if wx.Platform != "__WXMSW__":
636 btn = wx.ContextHelpButton(self)
637 self.btnsizer.AddButton(btn)
638 btn = wx.Button(self, wx.ID_OK)
640 self.btnsizer.AddButton(btn)
641 btn = wx.Button(self, wx.ID_CANCEL)
642 self.btnsizer.AddButton(btn)
643 self.btnsizer.Realize()
644 self.Bind(wx.EVT_CHECKBOX, self.OnCheck1, self.check1)
645 self.Bind(wx.EVT_CHECKBOX, self.OnCheck2, self.check2)
646 self.Bind(wx.EVT_CHECKBOX, self.OnNorm, self.check4)
647 self.Bind(wx.EVT_CHECKBOX, self.OnCheckTchi, self.check_tchi)
648 self.Bind(wx.EVT_CHOICE, self.On3D, self.choicetype)
649 self.Bind(wx.EVT_CHOICE, self.OnPass, self.choice2)
650 self.Bind(wx.EVT_CHECKBOX, self.OnCheckChic, self.check_chic)
651 self.__set_properties()
652 self.OnNorm(wx.EVT_CHECKBOX)
653 self.OnCheckTchi(wx.EVT_CHECKBOX)
656 def __set_properties(self):
657 self.choicetype.SetSelection(self.paramgraph['typegraph'])
658 if self.paramgraph['typegraph'] == 0 or self.paramgraph['typegraph'] == 2:
659 self.film.Enable(False)
660 self.spin_f3.Enable(False)
661 self.slider_sphere.Enable(False)
662 self.choix_format.SetSelection(self.paramgraph['svg'])
663 self.choice1.SetSelection(self.paramgraph['what'])
664 self.choice2.SetSelection(self.paramgraph['qui'])
665 self.spin_chi.SetValue(self.paramgraph['select_nb'])
666 self.spin_nb.SetValue(self.paramgraph['select_chi'])
667 self.spin1.SetValue(self.paramgraph['width'])
668 self.spin2.SetValue(self.paramgraph['height'])
669 self.spin3.SetValue(self.paramgraph['taillecar'])
670 self.spin_nb.SetValue(self.paramgraph['select_nb'])
671 self.spin_chi.SetValue(self.paramgraph['select_chi'])
672 self.spin_nbchic.SetValue(self.paramgraph['nbchic'])
673 self.check1.SetValue(self.paramgraph['do_select_nb'])
674 self.check2.SetValue(self.paramgraph['do_select_chi'])
675 self.check_chic.SetValue(self.paramgraph['do_select_chi_classe'])
676 self.check3.SetValue(self.paramgraph['over'])
677 if self.paramgraph['do_select_nb'] :
678 self.spin_nb.Enable(True)
679 self.spin_chi.Enable(False)
680 self.spin_nbchic.Enable(False)
681 elif self.paramgraph['do_select_chi_classe'] :
682 self.spin_nb.Enable(False)
683 self.spin_chi.Enable(False)
684 self.spin_nbchic.Enable(True)
685 elif self.paramgraph['do_select_chi'] :
686 self.spin_nb.Enable(False)
687 self.spin_chi.Enable(True)
688 self.spin_nbchic.Enable(False)
690 self.spin_nb.Enable(False)
691 self.spin_chi.Enable(False)
692 self.spin_nbchic.Enable(False)
693 self.check4.SetValue(self.paramgraph['cex_txt'])
694 self.spin_min.SetValue(self.paramgraph['txt_min'])
695 self.spin_max.SetValue(self.paramgraph['txt_max'])
696 self.check_tchi.SetValue(self.paramgraph['tchi'])
697 self.spin_min_tchi.SetValue(self.paramgraph['tchi_min'])
698 self.spin_max_tchi.SetValue(self.paramgraph['tchi_max'])
699 self.spin_f1.SetValue(self.paramgraph['facteur'][0])
700 self.spin_f2.SetValue(self.paramgraph['facteur'][1])
701 self.spin_f3.SetValue(self.paramgraph['facteur'][2])
702 self.slider_sphere.SetValue(self.paramgraph['alpha'])
704 def __do_layout(self):
705 sizer_2 = wx.BoxSizer(wx.VERTICAL)
706 fsizer = wx.FlexGridSizer(0,2,0,5)
707 grid_min = wx.FlexGridSizer(0, 2, 0, 0)
708 grid_max = wx.FlexGridSizer(0, 2, 0, 0)
709 grid_minmax = wx.FlexGridSizer(0, 2, 0, 0)
710 grid_min_tchi = wx.FlexGridSizer(0, 2, 0, 0)
711 grid_max_tchi = wx.FlexGridSizer(0, 2, 0, 0)
712 grid_minmax_tchi = wx.FlexGridSizer(0, 2, 0, 0)
713 sizer_3 = wx.BoxSizer(wx.VERTICAL)
714 fsizer.Add(self.labeltype, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
715 fsizer.Add(self.choicetype, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
716 fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
717 fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
718 fsizer.Add(self.label_format, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
719 fsizer.Add(self.choix_format, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
720 fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
721 fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
722 fsizer.Add(self.label_what, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
723 fsizer.Add(self.choice1, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
724 fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
725 fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
726 fsizer.Add(self.label_qui, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
727 fsizer.Add(self.choice2, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
728 fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
729 fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
730 sizer_h1 = wx.BoxSizer(wx.HORIZONTAL)
731 sizer_h1.Add(self.label_1, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
732 sizer_h1.Add(self.spin1, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
733 fsizer.Add(sizer_h1, 0, wx.ALL, 5)
734 sizer_h2 = wx.BoxSizer(wx.HORIZONTAL)
735 sizer_h2.Add(self.label_2, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
736 sizer_h2.Add(self.spin2, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
737 fsizer.Add(sizer_h2, 0, wx.ALL, 5)
738 fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
739 fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
740 fsizer.Add(self.label_3, 0, wx.ALL | wx.LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
741 fsizer.Add(self.spin3, 0, wx.ALL | wx.LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
742 fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
743 fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
744 fsizer.Add(self.label_4, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
745 sizer_nb = wx.BoxSizer(wx.HORIZONTAL)
746 sizer_nb.Add(self.check1, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)
747 sizer_nb.Add(self.spin_nb, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)
748 fsizer.Add(sizer_nb, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
749 fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
750 fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
751 fsizer.Add(self.label_chic, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
752 sizer_nbchic = wx.BoxSizer(wx.HORIZONTAL)
753 sizer_nbchic.Add(self.check_chic, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)
754 sizer_nbchic.Add(self.spin_nbchic, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)
755 fsizer.Add(sizer_nbchic, 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)
758 fsizer.Add(self.label_5, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
759 sizer_chi = wx.BoxSizer(wx.HORIZONTAL)
760 sizer_chi.Add(self.check2, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)
761 sizer_chi.Add(self.spin_chi, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)
762 fsizer.Add(sizer_chi, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
763 fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
764 fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
765 fsizer.Add(self.label_6, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL| wx.ADJUST_MINSIZE, 5)
766 fsizer.Add(self.check3, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 5)
767 fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
768 fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
769 sizer_2.Add(fsizer, 0, wx.EXPAND, 0)
770 bsizer_1 = wx.FlexGridSizer(0,3,0,0)
771 bsizer_1.Add(self.label_7, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
772 bsizer_1.Add(self.check4, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
773 grid_min.Add(self.label_min, 0,wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
774 grid_min.Add(self.spin_min, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
775 grid_max.Add(self.label_max, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
776 grid_max.Add(self.spin_max, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
777 grid_minmax.Add(grid_min, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
778 grid_minmax.Add(grid_max, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
779 bsizer_1.Add(grid_minmax, 0, wx.ALL, 5)
780 bsizer_1.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
781 bsizer_1.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
782 bsizer_1.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
783 bsizer_1.Add(self.label_tchi, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
784 bsizer_1.Add(self.check_tchi, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
785 grid_min_tchi.Add(self.label_min_tchi, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
786 grid_min_tchi.Add(self.spin_min_tchi, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
787 grid_max_tchi.Add(self.label_max_tchi, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
788 grid_max_tchi.Add(self.spin_max_tchi, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
789 grid_minmax_tchi.Add(grid_min_tchi, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
790 grid_minmax_tchi.Add(grid_max_tchi, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
791 bsizer_1.Add(grid_minmax_tchi, 0, wx.ALL, 5)
792 sizer_2.Add(bsizer_1, 0, wx.EXPAND, 5)
793 sizer_2.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
794 sizer_f = wx.BoxSizer(wx.HORIZONTAL)
795 sizer_f.Add(self.label_8, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)
796 sizer_f.Add(self.spin_f1, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)
797 sizer_f.Add(self.label_9, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)
798 sizer_f.Add(self.spin_f2, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)
799 sizer_f.Add(self.label_f3, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)
800 sizer_f.Add(self.spin_f3, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)
801 sizer_2.Add(sizer_f, 0, wx.EXPAND, 5)
802 sizer_2.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 5)
803 fsizer2 = wx.FlexGridSizer(0,2,0,0)
804 fsizer2.Add(self.label_sphere, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
805 fsizer2.Add(self.slider_sphere, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
806 fsizer2.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
807 fsizer2.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
808 fsizer2.Add(self.label_film, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
809 fsizer2.Add(self.film, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
810 sizer_2.Add(fsizer2, 0, wx.EXPAND, 5)
811 sizer_2.Add(self.btnsizer, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_CENTER_HORIZONTAL, 5)
812 self.SetSizer(sizer_2)
816 def OnCheck1(self, event):
817 if self.check1.GetValue() :
818 self.check2.SetValue(False)
819 self.check_chic.SetValue(False)
820 self.spin_chi.Enable(False)
821 self.spin_nb.Enable(True)
822 self.spin_nbchic.Enable(False)
824 self.spin_nb.Enable(False)
826 def OnCheck2(self, event):
827 if self.check2.GetValue() :
828 self.check1.SetValue(False)
829 self.check_chic.SetValue(False)
830 self.spin_chi.Enable(True)
831 self.spin_nb.Enable(False)
832 self.spin_nbchic.Enable(False)
834 self.spin_chi.Enable(False)
836 def OnCheckChic(self, event) :
837 if self.check_chic.GetValue() :
838 self.check1.SetValue(False)
839 self.check2.SetValue(False)
840 self.spin_chi.Enable(False)
841 self.spin_nb.Enable(False)
842 self.spin_nbchic.Enable(True)
844 self.spin_nbchic.Enable(False)
846 def OnNorm(self, event):
847 if not self.check4.GetValue() :
848 self.spin_min.Disable()
849 self.spin_max.Disable()
851 self.spin_min.Enable(True)
852 self.spin_max.Enable(True)
853 self.check_tchi.SetValue(False)
854 self.OnCheckTchi(wx.EVT_CHECKBOX)
856 def OnCheckTchi(self, evt) :
857 if not self.check_tchi.GetValue() :
858 self.spin_min_tchi.Disable()
859 self.spin_max_tchi.Disable()
861 self.spin_min_tchi.Enable(True)
862 self.spin_max_tchi.Enable(True)
863 self.check4.SetValue(False)
864 self.OnNorm(wx.EVT_CHECKBOX)
866 def On3D(self, event) :
867 if event.GetString() == '3D' :
868 self.film.Enable(True)
869 self.spin_f3.Enable(True)
870 self.slider_sphere.Enable(True)
872 self.film.Enable(False)
873 self.spin_f3.Enable(False)
874 self.slider_sphere.Enable(False)
876 def OnPass(self,evt) :
877 if evt.GetString() == _("clusters") :
878 self.check4.SetValue(False)
879 self.check4.Enable(False)
880 self.OnNorm(wx.EVT_CHECKBOX)
885 class SelectColDial ( wx.Dialog ):
887 def __init__( self, parent ):
888 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 )
889 self.SetSizeHints( wx.DefaultSize, wx.DefaultSize )
890 self.bSizer2 = wx.BoxSizer( wx.VERTICAL )
891 #self.m_checkList2 = wx.CheckListBox( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, ['r','t','y'], 0 )
892 #bSizer2.Add( self.m_checkList2, 2, wx.ALL|wx.EXPAND, 5 )
893 self.m_sdbSizer2 = wx.StdDialogButtonSizer()
894 self.m_sdbSizer2OK = wx.Button( self, wx.ID_CANCEL)
895 self.butok = wx.Button( self, wx.ID_OK)
897 #m_sdbSizer2.AddButton( self.m_sdbSizer2OK )
898 #self.m_sdbSizer2Cancel = wx.Button( self, wx.ID_CANCEL )
899 #m_sdbSizer2.AddButton( self.m_sdbSizer2Cancel )
900 #m_sdbSizer2.Realize();
901 #self.bSizer2.Add( m_sdbSizer2, 0, wx.EXPAND, 5 )
902 self.SetSizer( self.bSizer2 )
904 self.Centre( wx.BOTH )
909 class PrefExport(wx.Dialog):
911 def __init__(self, parent, *args, **kwds):
912 kwds['style'] = wx.OK|wx.DEFAULT_DIALOG_STYLE
913 wx.Dialog.__init__(self, *args, **kwds)
916 sizer = wx.BoxSizer(wx.VERTICAL)
917 box = wx.BoxSizer(wx.HORIZONTAL)
918 box3 = wx.BoxSizer(wx.HORIZONTAL)
919 self.label_lem = wx.StaticText(self, -1, _("Lemmatised corpus"))
920 box3.Add(self.label_lem, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
921 self.radio_lem = wx.RadioBox(self, -1, "", choices= [ _("yes"), _("no") ], majorDimension=0, style=wx.RA_SPECIFY_ROWS)
922 box3.Add(self.radio_lem, 0, wx.EXPAND, 5)
923 sizer.Add(box3, 0, wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5)
924 self.label_txt = wx.StaticText(self, -1, _("Export for ..."))
925 box.Add(self.label_txt, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
926 self.radio_type = wx.RadioBox(self, -1, "", choices=['IRaMuTeQ/ALCESTE', 'Lexico'], majorDimension=0, style=wx.RA_SPECIFY_ROWS)
927 box.Add(self.radio_type, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
928 sizer.Add(box, 0, wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5)
929 box2 = wx.BoxSizer(wx.HORIZONTAL)
930 self.txt2 = wx.StaticText(self, -1, _("Output file"))
931 box2.Add(self.txt2, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
932 self.fbb = filebrowse.FileBrowseButton(self, -1, size=(450, -1), fileMode = 2)
933 box2.Add(self.fbb, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
934 self.fbb.SetLabel("")
935 sizer.Add(box2, 0, wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5)
936 btnsizer = wx.StdDialogButtonSizer()
937 btn = wx.Button(self, wx.ID_CANCEL)
938 btnsizer.AddButton(btn)
939 btn_ok = wx.Button(self, wx.ID_OK)
941 btnsizer.AddButton(btn_ok)
943 sizer.Add(btnsizer, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL|wx.ALIGN_RIGHT, 5)
944 self.Bind(wx.EVT_BUTTON, self.check_file, btn_ok)
948 def check_file(self, evt) :
949 if evt.GetId() == wx.ID_OK :
950 if os.path.exists(self.fbb.GetValue()):
951 dlg = wx.MessageDialog(self, '\n'.join(["%s" % self.fbb.GetValue(), _("This file already exists. Continue anyway ?")]), _("Attention"), wx.NO | wx.YES | wx.ICON_WARNING)
953 if dlg.ShowModal() not in [wx.ID_NO, wx.ID_CANCEL]:
954 self.EndModal(wx.ID_OK)
956 self.EndModal(wx.ID_OK)
958 self.EndModal(wx.ID_CANCEL)
960 class PrefProfTypes(wx.Dialog):
962 def __init__(self, parent, *args, **kwds):
963 kwds['style'] = wx.OK|wx.DEFAULT_DIALOG_STYLE
964 wx.Dialog.__init__(self, parent, *args, **kwds)
967 sizer = wx.BoxSizer(wx.VERTICAL)
968 box = wx.BoxSizer(wx.HORIZONTAL)
969 box3 = wx.BoxSizer(wx.HORIZONTAL)
970 self.label_txt = wx.StaticText(self, -1, _("Settings"))
971 box.Add(self.label_txt, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
972 self.radio_type = wx.RadioBox(self, -1, "", choices=[_("Like ALCESTE"), _("Like Lexico")], majorDimension=0, style=wx.RA_SPECIFY_ROWS)
973 box.Add(self.radio_type, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
974 sizer.Add(box, 0, wx.GROW|wx.ALL, 5)
975 box2 = wx.BoxSizer(wx.HORIZONTAL)
976 self.txt2 = wx.StaticText(self, -1, _("Output file"))
977 box2.Add(self.txt2, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
978 self.fbb = filebrowse.FileBrowseButton(self, -1, size=(450, -1), fileMode = 2)
979 box2.Add(self.fbb, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
980 self.fbb.SetLabel("")
981 sizer.Add(box2, 0, wx.GROW|wx.ALL, 5)
982 btnsizer = wx.StdDialogButtonSizer()
983 btn = wx.Button(self, wx.ID_CANCEL)
984 btnsizer.AddButton(btn)
985 btn_ok = wx.Button(self, wx.ID_OK)
987 btnsizer.AddButton(btn_ok)
989 sizer.Add(btnsizer, 0, wx.ALL|wx.ALIGN_RIGHT, 5)
990 #self.Bind(wx.EVT_BUTTON, self.check_file, btn_ok)
994 class PrefSimpleFile(wx.Dialog):
996 def __init__(self, parent, *args, **kwds):
997 kwds['style'] = wx.OK|wx.DEFAULT_DIALOG_STYLE
999 self.mask = kwds['mask']
1001 else : self.mask = '*.*'
1002 wx.Dialog.__init__(self, *args, **kwds)
1004 self.parent = parent
1005 sizer = wx.BoxSizer(wx.VERTICAL)
1006 box2 = wx.BoxSizer(wx.HORIZONTAL)
1007 self.txt2 = wx.StaticText(self, -1, _("Output file"))
1008 box2.Add(self.txt2, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
1009 self.fbb = filebrowse.FileBrowseButton(self, -1, size=(450, -1), fileMode = 2, fileMask = self.mask)
1010 box2.Add(self.fbb, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
1011 self.fbb.SetLabel("")
1012 sizer.Add(box2, 0, wx.GROW|wx.ALL, 5)
1013 btnsizer = wx.StdDialogButtonSizer()
1014 btn = wx.Button(self, wx.ID_CANCEL)
1015 btnsizer.AddButton(btn)
1016 btn_ok = wx.Button(self, wx.ID_OK)
1018 btnsizer.AddButton(btn_ok)
1020 sizer.Add(btnsizer, 0, wx.ALL|wx.ALIGN_RIGHT, 5)
1021 self.Bind(wx.EVT_BUTTON, self.check_file, btn_ok)
1022 self.SetSizer(sizer)
1025 def check_file(self, evt) :
1026 if evt.GetId() == wx.ID_OK :
1027 if os.path.exists(self.fbb.GetValue()):
1028 dlg = wx.MessageDialog(self, '\n'.join(["%s" % self.fbb.GetValue(), _("This file already exists. Continue anyway ?")]), _("Attention"), wx.NO | wx.YES | wx.ICON_WARNING)
1029 dlg.CenterOnParent()
1030 if dlg.ShowModal() not in [wx.ID_NO, wx.ID_CANCEL]:
1031 self.EndModal(wx.ID_OK)
1033 self.EndModal(wx.ID_OK)
1035 self.EndModal(wx.ID_CANCEL)
1037 class StatDialog ( wx.Dialog ):
1039 def __init__( self, parent, keys ):
1040 wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = _("Settings"), pos = wx.DefaultPosition, size = wx.Size( -1,-1 ), style = wx.DEFAULT_DIALOG_STYLE )
1042 self.parent = parent
1044 self.SetSizeHints( wx.DefaultSize, wx.DefaultSize )
1045 bSizer1 = wx.BoxSizer( wx.VERTICAL )
1046 gSizer1 = wx.GridSizer( 0, 2, 0, 0 )
1047 self.m_staticText1 = wx.StaticText( self, wx.ID_ANY, _("Lemmatization"), wx.DefaultPosition, wx.DefaultSize, 0 )
1048 self.m_staticText1.Wrap( -1 )
1049 gSizer1.Add( self.m_staticText1, 0, wx.ALIGN_CENTER_VERTICAL, 1 )
1050 radio_lemChoices = [ _("yes"), _("no") ]
1051 self.radio_lem = wx.RadioBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, radio_lemChoices, 1, wx.RA_SPECIFY_COLS )
1052 self.radio_lem.SetSelection( 0 )
1053 gSizer1.Add( self.radio_lem, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 1 )
1054 self.m_staticText2 = wx.StaticText( self, wx.ID_ANY, _("Keys properties"), wx.DefaultPosition, wx.DefaultSize, 0 )
1055 self.m_staticText2.Wrap( -1 )
1056 gSizer1.Add( self.m_staticText2, 0, wx.ALIGN_CENTER_VERTICAL, 1 )
1057 self.button_5 = wx.Button( self, wx.ID_PREFERENCES, _("properties"), wx.DefaultPosition, wx.DefaultSize, 0 )
1058 gSizer1.Add( self.button_5, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 1 )
1059 self.m_staticText3 = wx.StaticText( self, wx.ID_ANY, _("Dictionary"), wx.DefaultPosition, wx.DefaultSize, 0 )
1060 self.m_staticText3.Wrap( -1 )
1061 gSizer1.Add( self.m_staticText3, 0, wx.ALIGN_CENTER_VERTICAL, 1 )
1062 radio_dictchoiceChoices = [ _("indexation"), _("other") ]
1063 self.radio_dictchoice = wx.RadioBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, radio_dictchoiceChoices, 1, wx.RA_SPECIFY_COLS )
1064 self.radio_dictchoice.SetSelection( 0 )
1065 gSizer1.Add( self.radio_dictchoice, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 1 )
1066 bSizer1.Add( gSizer1, 1, wx.EXPAND, 1 )
1067 self.dictpath = filebrowse.FileBrowseButton(self, -1, labelText = _("Path"), fileMode = 2, fileMask = '*')
1068 bSizer1.Add( self.dictpath, 0, wx.EXPAND, 1 )
1069 self.dictpath.Enable(False)
1070 m_sdbSizer1 = wx.StdDialogButtonSizer()
1071 self.m_sdbSizer1OK = wx.Button( self, wx.ID_OK )
1072 m_sdbSizer1.AddButton( self.m_sdbSizer1OK )
1073 self.m_sdbSizer1Cancel = wx.Button( self, wx.ID_CANCEL )
1074 m_sdbSizer1.AddButton( self.m_sdbSizer1Cancel )
1075 m_sdbSizer1.Realize();
1076 bSizer1.Add( m_sdbSizer1, 0, wx.EXPAND, 0 )
1077 self.SetSizer( bSizer1 )
1080 self.Centre( wx.BOTH )
1082 self.button_5.Bind( wx.EVT_BUTTON, self.OnKeys )
1083 self.radio_dictchoice.Bind( wx.EVT_RADIOBOX, self.OnOther )
1085 def __del__( self ):
1088 # Virtual event handlers, overide them in your derived class
1089 def OnKeys( self, event ):
1090 dial = AlcOptFrame(self, self.parent)
1091 dial.corpus = self.corpus
1092 dial.CenterOnParent()
1094 for i in range(0,len(dial.listlabel)):
1095 dial.keys[dial.listcle[i]] = dial.listspin[i].GetValue()
1096 DoConf().makeoptions(['KEY'], [dial.keys], outfile = self.parent.ConfigPath['key'])
1099 def OnOther( self, event ):
1100 if self.radio_dictchoice.GetSelection() :
1101 self.dictpath.Enable(True)
1103 self.dictpath.Enable(False)
1105 # class StatDialog(wx.Dialog):
1107 # def __init__(self, parent, *args, **kwds):
1108 # kwds['style'] = wx.DEFAULT_DIALOG_STYLE
1109 # wx.Dialog.__init__(self, *args, **kwds)
1111 # self.parent = parent
1112 # self.label_lem = wx.StaticText(self, -1, _("Lemmatization"))
1113 # self.radio_lem = wx.RadioBox(self, -1, "", choices=[_('oui'), _('non')], majorDimension=0, style=wx.RA_SPECIFY_ROWS)
1114 # #txt = """Fréquence minimum d'une forme
1115 # #analysée (0 = non utilisé)"""
1116 # #self.label_8 = wx.StaticText(self, -1, txt)
1117 # #self.spin_ctrl_5 = wx.SpinCtrl(self, -1, "",size = (100,30), min=0, max=1000, initial=0)
1118 # #self.label_max_actives = wx.StaticText(self, -1, "Nombre maximum de formes analysées")
1119 # #self.spin_max_actives = wx.SpinCtrl(self, -1, "",size = (100,30), min=20, max=10000, initial=1500)
1120 # self.label_4 = wx.StaticText(self, -1, _("Keys settings"))
1121 # self.button_5 = wx.Button(self, wx.ID_PREFERENCES, "")
1122 # self.labeldictchoice = wx.StaticText(self, -1, _("Dictionary"))
1123 # self.radio_dictchoice = wx.RadioBox(self, -1, "", choices=[_('indexation'), _('other')], majorDimension=0, style=wx.RA_SPECIFY_ROWS)
1124 # #self.labeldictpath = wx.StaticText(self, -1, _("Path"))
1125 # self.dictpath = filebrowse.FileBrowseButton(self, -1, size=(350, -1), labelText = _("Path"), fileMode = 2, fileMask = '*')
1126 # self.dictpath.Enable(False)
1127 # #self.Bind(wx.EVT_CHECKBOX, self.OnCheckUce, self.check_uce)
1128 # #self.Bind(wx.EVT_SPINCTRL, self.OnSpin, self.spin_ctrl_5)
1129 # self.Bind(wx.EVT_BUTTON, self.OnKeys, self.button_5)
1130 # self.Bind(wx.EVT_RADIOBOX, self.OnOther, self.radio_dictchoice)
1131 # self.__do_layout()
1132 # self.__set_properties()
1134 # def __do_layout(self) :
1135 # first = wx.BoxSizer(wx.VERTICAL)
1136 # sizer = wx.FlexGridSizer(0,2,0,0)
1137 # sizer.Add(self.label_lem, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
1138 # sizer.Add(self.radio_lem, 0, wx.ALIGN_LEFT, 5)
1139 # sizer.Add(wx.StaticLine(self),0, wx.ALIGN_LEFT, 5)
1140 # sizer.Add(wx.StaticLine(self),0, wx.ALIGN_LEFT, 5)
1141 # #sizer.Add(self.txt_exp, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
1142 # #sizer.Add(self.exp, 0, wx.ALIGN_RIGHT, 5)
1143 # #sizer.Add(self.label_uce, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
1144 # #sizer.Add(self.check_uce, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
1145 # #sizer.Add(self.label_occuce, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
1146 # #sizer.Add(self.spin_ctrl_4, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
1147 # #sizer.Add(self.label_8, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
1148 # #sizer.Add(self.spin_ctrl_5, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
1149 # #sizer.Add(self.label_max_actives, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
1150 # #sizer.Add(self.spin_max_actives, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
1151 # sizer.Add(self.label_4, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
1152 # sizer.Add(self.button_5, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
1153 # sizer.Add(wx.StaticLine(self),0, wx.ALIGN_LEFT, 5)
1154 # sizer.Add(wx.StaticLine(self),0, wx.ALIGN_LEFT, 5)
1155 # sizer.Add(self.labeldictchoice, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
1156 # sizer.Add(self.radio_dictchoice, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
1157 # sizer.Add(wx.StaticLine(self),0, wx.ALIGN_LEFT, 5)
1158 # sizer.Add(wx.StaticLine(self),0, wx.ALIGN_LEFT, 5)
1159 # #sizer.Add(self.labeldictpath, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
1160 # sizer.Add(self.dictpath, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
1161 # sizer.Add(wx.StaticLine(self),0, wx.ALIGN_LEFT, 5)
1162 # sizer.Add(wx.StaticLine(self),0, wx.ALIGN_LEFT, 5)
1163 # #sizer.Add(box2, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT, 5)
1164 # first.Add(sizer, 0, wx.ALL, 5)
1165 # btnsizer = wx.StdDialogButtonSizer()
1166 # btn = wx.Button(self, wx.ID_CANCEL)
1167 # btnsizer.AddButton(btn)
1168 # btn_ok = wx.Button(self, wx.ID_OK)
1169 # btn_ok.SetDefault()
1170 # btnsizer.AddButton(btn_ok)
1171 # btnsizer.Realize()
1172 # first.Add(btnsizer, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT, 5)
1173 # self.SetSizer(first)
1176 # def __set_properties(self) :
1177 # self.SetTitle(_(u"Settings"))
1179 # def OnKeys(self, evt):
1180 # dial = AlcOptFrame(self, self.parent.parent)
1181 # dial.CenterOnParent()
1183 # for i in range(0,len(dial.listlabel)):
1184 # dial.keys[dial.listcle[i]] = dial.listspin[i].GetValue()
1185 # DoConf().makeoptions(['KEY'], [dial.keys], outfile = self.parent.parent.ConfigPath['key'])
1188 # def OnOther(self, evt):
1189 # if self.radio_dictchoice.GetSelection() :
1190 # self.dictpath.Enable(True)
1192 # self.dictpath.Enable(False)
1195 class PrefUCECarac(wx.Dialog):
1197 def __init__(self, parent, *args, **kwds):
1198 kwds['style'] = wx.DEFAULT_DIALOG_STYLE
1199 kwds['title'] = _("Characteristic text segments")
1200 wx.Dialog.__init__(self, *args, **kwds)
1201 self.parent = parent
1202 first = wx.BoxSizer(wx.VERTICAL)
1203 sizer = wx.FlexGridSizer(0,2,0,0)
1204 self.label_type = wx.StaticText(self, -1, _("Ranking score"))
1205 sizer.Add(self.label_type, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
1206 self.radio_type = wx.RadioBox(self, -1, "", choices=[_("absolute (sum of chi2 of marked forms in segment)"), _("relative (mean of chi2 of marked forms in segment)")], majorDimension=0, style=wx.RA_SPECIFY_ROWS)
1207 sizer.Add(self.radio_type, 0, wx.ALIGN_RIGHT, 5)
1208 self.txt_eff = wx.StaticText(self, -1, _("Maximum number of text segments"))
1209 sizer.Add(self.txt_eff, 0, wx.ALIGN_CENTRE, 5)
1210 self.spin_eff = wx.SpinCtrl(self, -1, '', size = (100, 30), min = 1, max = 100000, initial = 50)
1211 self.spin_eff.SetValue(50)
1212 sizer.Add(self.spin_eff, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
1213 first.Add(sizer, 0, wx.ALL, 5)
1214 btnsizer = wx.StdDialogButtonSizer()
1215 btn = wx.Button(self, wx.ID_CANCEL)
1216 btnsizer.AddButton(btn)
1217 btn_ok = wx.Button(self, wx.ID_OK)
1219 btnsizer.AddButton(btn_ok)
1221 first.Add(btnsizer, 0, wx.ALIGN_RIGHT, 5)
1222 self.SetSizer(first)
1226 class PrefSegProf(wx.Dialog) :
1228 def __init__( self, parent ):
1229 wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = _("Repeated segments profiles"), pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.DEFAULT_DIALOG_STYLE )
1230 self.SetSizeHints( wx.DefaultSize, wx.DefaultSize )
1231 bSizer1 = wx.BoxSizer( wx.VERTICAL )
1232 txt = _("Be carefull : computation of repeated segments profiles can be very long on large corpus")
1233 self.label = wx.StaticText( self, wx.ID_ANY, txt, wx.DefaultPosition, wx.DefaultSize, 0 )
1234 bSizer1.Add( self.label, 0, wx.ALL, 5 )
1235 fgSizer1 = wx.FlexGridSizer( 0, 2, 0, 0 )
1236 fgSizer1.SetFlexibleDirection( wx.BOTH )
1237 fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
1238 self.m_staticText1 = wx.StaticText( self, wx.ID_ANY, _("Lemmatised corpus"), wx.DefaultPosition, wx.DefaultSize, 0 )
1239 self.m_staticText1.Wrap( -1 )
1240 fgSizer1.Add( self.m_staticText1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1241 box_lemChoices = [ _("yes"), _("no") ]
1242 self.box_lem = wx.RadioBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, box_lemChoices, 1, wx.RA_SPECIFY_COLS )
1243 self.box_lem.SetSelection( 1 )
1244 fgSizer1.Add( self.box_lem, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1245 #self.box_lem.Enable(False)
1246 self.m_staticText3 = wx.StaticText( self, wx.ID_ANY, _("Minimum size of segments"), wx.DefaultPosition, wx.DefaultSize, 0 )
1247 self.m_staticText3.Wrap( -1 )
1248 fgSizer1.Add( self.m_staticText3, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1249 self.spin_min = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 2, 30, 2 )
1250 self.spin_min.SetValue(2)
1251 fgSizer1.Add( self.spin_min, 0, wx.ALL, 5 )
1252 self.m_staticText4 = wx.StaticText( self, wx.ID_ANY, _("Maxmum size of segments"), wx.DefaultPosition, wx.DefaultSize, 0 )
1253 self.m_staticText4.Wrap( -1 )
1254 fgSizer1.Add( self.m_staticText4, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1255 self.spin_max = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 2, 30, 10 )
1256 self.spin_max.SetValue(10)
1257 fgSizer1.Add( self.spin_max, 0, wx.ALL, 5 )
1258 self.m_staticText5 = wx.StaticText( self, wx.ID_ANY, _("Minimum frequency of segments"), wx.DefaultPosition, wx.DefaultSize, 0 )
1259 self.m_staticText5.Wrap( -1 )
1260 fgSizer1.Add( self.m_staticText5, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1261 self.spin_eff = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 4, 1000, 4 )
1262 self.spin_eff.SetValue(4)
1263 fgSizer1.Add( self.spin_eff, 0, wx.ALL, 5 )
1264 bSizer1.Add( fgSizer1, 1, wx.EXPAND, 5 )
1265 btnsizer = wx.StdDialogButtonSizer()
1266 btn = wx.Button(self, wx.ID_CANCEL)
1267 btnsizer.AddButton(btn)
1268 btn_ok = wx.Button(self, wx.ID_OK)
1270 btnsizer.AddButton(btn_ok)
1272 bSizer1.Add(btnsizer, 0, wx.ALIGN_RIGHT, 5)
1273 self.SetSizer( bSizer1 )
1276 self.Centre( wx.BOTH )
1279 class PrefQuestAlc ( wx.Dialog ):
1281 def __init__( self, parent, tableau, sim = False):
1282 wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = _("Clustering"), pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.DEFAULT_DIALOG_STYLE )
1283 self.SetSizeHints( wx.DefaultSize, wx.DefaultSize )
1284 #---------------------------------------------------------------
1285 #self.content = parent.content[:]
1286 self.header = tableau.get_colnames()
1287 labels = [val for val in self.header]
1288 self.labels_tot = labels
1291 #---------------------------------------------------------------
1292 bSizer2 = wx.BoxSizer( wx.VERTICAL )
1293 fgSizer1 = wx.FlexGridSizer( 0, 2, 0, 0 )
1294 fgSizer1.SetFlexibleDirection( wx.BOTH )
1295 fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
1297 self.lab_format = wx.StaticText( self, wx.ID_ANY, _("Supplementary variables are marked with a *"), wx.DefaultPosition, wx.DefaultSize, 0 )
1298 self.lab_format.Wrap( -1 )
1299 fgSizer1.Add( self.lab_format, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1300 m_radioBox1Choices = [ _("yes"), _("no") ]
1301 self.m_radioBox1 = wx.RadioBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, m_radioBox1Choices, 1, wx.RA_SPECIFY_COLS )
1302 self.m_radioBox1.SetSelection( 0 )
1303 fgSizer1.Add( self.m_radioBox1, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1304 self.m_staticText3 = wx.StaticText( self, wx.ID_ANY, _("Actives variables (almost 3)"), wx.DefaultPosition, wx.DefaultSize, 0 )
1305 self.m_staticText3.Wrap( -1 )
1306 fgSizer1.Add( self.m_staticText3, 0, wx.ALL, 5 )
1307 self.m_staticText2 = wx.StaticText( self, wx.ID_ANY, _("Supplementaries variables (almost 1)"), wx.DefaultPosition, wx.DefaultSize, 0 )
1308 self.m_staticText2.Wrap( -1 )
1309 fgSizer1.Add( self.m_staticText2, 0, wx.ALL, 5 )
1310 self.ListActive = wx.ListBox( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, labels, wx.LB_EXTENDED )
1311 self.ListActive.SetMinSize( wx.Size( 300,250 ) )
1312 fgSizer1.Add( self.ListActive, 0, wx.EXPAND, 5 )
1313 self.ListSup = wx.ListBox( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, labels, wx.LB_EXTENDED )
1314 self.ListSup.SetMinSize( wx.Size( 300,250 ) )
1315 fgSizer1.Add( self.ListSup, 0, wx.EXPAND, 5 )
1316 self.but_suiv = wx.Button( self, wx.ID_ANY, _("Next"), wx.DefaultPosition, wx.DefaultSize, 0 )
1317 fgSizer1.Add( self.but_suiv, 0, wx.EXPAND, 5 )
1318 self.but_prec = wx.Button( self, wx.ID_ANY, _("Previous"), wx.DefaultPosition, wx.DefaultSize, 0 )
1319 fgSizer1.Add( self.but_prec, 0, wx.EXPAND, 5 )
1321 self.lab_nbcl = wx.StaticText( self, wx.ID_ANY, _("Number of terminal clusters on phase 1"), wx.DefaultPosition, wx.DefaultSize, 0 )
1322 self.lab_nbcl.Wrap( -1 )
1323 fgSizer1.Add( self.lab_nbcl, 0, wx.ALL, 5 )
1324 self.spin_nbcl = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 2, 100, 10 )
1325 self.spin_nbcl.SetValue(10)
1326 self.spin_nbcl.SetMinSize( wx.Size( 100,30 ) )
1327 fgSizer1.Add( self.spin_nbcl, 0, wx.EXPAND, 5 )
1328 self.lab_mincl = wx.StaticText( self, wx.ID_ANY, _("Minimum text segments frenquency in clusters (2= automatic)"), wx.DefaultPosition, wx.DefaultSize, 0 )
1329 self.lab_mincl.Wrap( -1 )
1330 fgSizer1.Add( self.lab_mincl, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
1331 self.spin_mincl = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 2, 1000, 0 )
1332 self.spin_mincl.SetValue(2)
1333 self.spin_mincl.SetMinSize( wx.Size( 100,30 ) )
1334 fgSizer1.Add( self.spin_mincl, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1335 bSizer2.Add( fgSizer1, 1, wx.EXPAND, 5 )
1336 m_sdbSizer2 = wx.StdDialogButtonSizer()
1337 self.m_sdbSizer2OK = wx.Button( self, wx.ID_OK )
1338 m_sdbSizer2.AddButton( self.m_sdbSizer2OK )
1339 self.m_sdbSizer2Cancel = wx.Button( self, wx.ID_CANCEL )
1340 m_sdbSizer2.AddButton( self.m_sdbSizer2Cancel )
1341 m_sdbSizer2.Realize();
1342 bSizer2.Add( m_sdbSizer2, 0, wx.ALIGN_RIGHT|wx.ALL, 5 )
1343 self.SetSizer( bSizer2 )
1346 self.Centre( wx.BOTH )
1348 self.ListActive.Enable(False)
1349 self.ListSup.Enable(False)
1350 self.but_suiv.Enable(False)
1351 self.but_prec.Enable(False)
1353 self.ListSup.Enable(False)
1354 self.but_prec.Enable(False)
1357 self.m_radioBox1.Bind( wx.EVT_RADIOBOX, self.onformat )
1358 self.but_suiv.Bind(wx.EVT_BUTTON, self.onsuivant)
1359 self.but_prec.Bind(wx.EVT_BUTTON, self.onprec)
1360 self.m_sdbSizer2OK.Bind(wx.EVT_BUTTON, self.onvalid)
1362 def __del__( self ):
1365 # Virtual event handlers, overide them in your derived class
1366 def onformat( self, event ):
1367 if self.m_radioBox1.GetSelection() == 0 :
1368 self.ListActive.Enable(False)
1369 self.ListSup.Enable(False)
1370 self.but_suiv.Enable(False)
1371 self.m_sdbSizer2OK.Enable(True)
1373 self.ListActive.Enable(True)
1374 self.but_suiv.Enable(True)
1375 self.m_sdbSizer2OK.Enable(False)
1377 def onsuivant(self, evt) :
1378 actives = list(self.ListActive.GetSelections())
1380 if len(actives)>=3 and len(actives) != len(self.header) :
1384 header = self.header[:]
1385 for i in range(0, len(header)):
1386 self.hindices.append(i)
1388 self.nactives.append(i)
1389 header.pop(i - compt)
1390 self.hindices.pop(i - compt)
1392 self.labels = [val for val in header]
1393 self.ListSup.Clear()
1395 self.ListSup.Append(i)
1396 self.ListActive.Enable(False)
1397 self.ListSup.Enable(True)
1398 self.but_suiv.Enable(False)
1399 self.but_prec.Enable(True)
1401 self.m_sdbSizer2OK.Enable(True)
1403 def onprec(self, evt) :
1404 self.ListActive.Enable(True)
1405 self.ListSup.Enable(False)
1406 self.but_suiv.Enable(True)
1407 self.but_prec.Enable(False)
1409 self.m_sdbSizer2OK.Enable(False)
1411 def onvalid(self, evt) :
1412 for i in self.ListSup.GetSelections() :
1413 self.varsup.append(self.hindices[i])
1415 if len(self.varsup) >= 1 or self.m_radioBox1.GetSelection() == 0 :
1418 if len(self.varsup) >= 1 :
1422 class FindInCluster(wx.Frame):
1424 def __init__(self, parent, id, result, style = wx.DEFAULT_FRAME_STYLE):
1425 # begin wxGlade: MyFrame.__init__
1426 wx.Frame.__init__(self, parent, id)
1427 self.spanel = wx.ScrolledWindow(self, -1, style=wx.TAB_TRAVERSAL)
1428 self.sizer1 = wx.FlexGridSizer(0,4,0,0)
1429 self.parent = parent
1431 txt = [_("form"),_("cluster"),_("Chi2"), _("see")]
1433 self.sizer1.Add( wx.StaticText(self.spanel, -1, val), 0, wx.ALL, 5)
1435 self.sizer1.Add(wx.StaticLine(self.spanel, -1), 0, wx.ALL, 5)
1436 for i,val in enumerate(result) :
1440 pan = wx.Panel(self.spanel, -1, style=wx.SIMPLE_BORDER)
1441 siz = wx.BoxSizer(wx.VERTICAL)
1442 txt = wx.StaticText(pan, -1, forme)
1443 siz.Add(txt, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5)
1445 self.sizer1.Add(pan, 0, wx.ALL|wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 5)
1446 pan = wx.Panel(self.spanel, -1, style=wx.SIMPLE_BORDER)
1447 siz = wx.BoxSizer(wx.VERTICAL)
1448 txt = wx.StaticText(pan, -1, str(cl))
1449 siz.Add(txt, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5)
1451 self.sizer1.Add(pan, 0, wx.ALL|wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 5)
1452 pan = wx.Panel(self.spanel, -1, style=wx.SIMPLE_BORDER)
1453 siz = wx.BoxSizer(wx.VERTICAL)
1454 txt = wx.StaticText(pan, -1, str(chi))
1455 siz.Add(txt, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5)
1457 self.sizer1.Add(pan, 0, wx.ALL|wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 5)
1459 self.formes[idbut] = [forme, cl]
1460 but = wx.Button(self.spanel, idbut, "voir")
1461 self.sizer1.Add(but, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5)
1462 self.Bind(wx.EVT_BUTTON, self.showitem, but)
1463 self.button_1 = wx.Button(self, -1, "Fermer")
1464 self.Bind(wx.EVT_BUTTON, self.OnCloseMe, self.button_1)
1465 self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)
1466 self.__set_properties()
1470 def __set_properties(self):
1471 self.SetTitle(_("Results"))
1472 self.spanel.EnableScrolling(True,True)
1473 #self.panel_1.SetSize((1000,1000))
1474 self.spanel.SetScrollRate(20, 20)
1475 h = 60 * len(self.formes)
1480 self.SetSize(wx.Size(400,h))
1482 def __do_layout(self):
1483 # begin wxGlade: MyFrame.__do_layout
1484 sizer_1 = wx.BoxSizer(wx.VERTICAL)
1485 sizer_2 = wx.BoxSizer(wx.VERTICAL)
1486 self.spanel.SetSizer(self.sizer1)
1487 sizer_1.Add(self.spanel, 4, wx.EXPAND, 0)
1488 sizer_1.Add(self.button_1, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ADJUST_MINSIZE, 0)
1489 #sizer_1.Add(sizer_2, 1, wx.EXPAND, 0)
1490 self.SetAutoLayout(True)
1491 self.SetSizer(sizer_1)
1495 def showitem(self, evt) :
1496 idb = evt.GetEventObject().GetId()
1498 profile = nb.GetPage(nb.GetSelection())
1499 cl = self.formes[idb][1] - 1
1500 forme = self.formes[idb][0]
1501 profile.ProfNB.SetSelection(cl)
1502 UnSelectList(profile.ProfNB.GetPage(cl))
1503 datas = dict([[profile.ProfNB.GetPage(cl).getColumnText(i,6),i] for i in range(profile.ProfNB.GetPage(cl).GetItemCount())])
1504 profile.ProfNB.GetPage(cl).SetItemState(datas[self.formes[idb][0]], wx.LIST_STATE_SELECTED, wx.LIST_STATE_SELECTED)
1505 profile.ProfNB.GetPage(cl).Focus(datas[forme])
1506 profile.ProfNB.GetPage(cl).SetFocus()
1508 def OnCloseMe(self, evt) :
1511 def OnCloseWindow(self, evt):
1515 class SearchDial ( wx.Frame ):
1517 def __init__( self, parent, listctrl, col, shown):
1518 wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = wx.EmptyString, pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.DEFAULT_FRAME_STYLE | wx.STAY_ON_TOP )
1519 self.parent = parent
1520 self.listctrl = listctrl
1523 self.SetSizeHints( wx.DefaultSize, wx.DefaultSize )
1524 bSizer1 = wx.BoxSizer( wx.VERTICAL )
1525 self.search = wx.SearchCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.TE_PROCESS_ENTER )
1526 self.search.ShowSearchButton( True )
1527 self.search.ShowCancelButton( True )
1528 bSizer1.Add( self.search, 0, wx.ALL|wx.EXPAND, 5 )
1529 sizer2 = wx.BoxSizer(wx.HORIZONTAL)
1530 self.backward = wx.Button(self, wx.ID_BACKWARD, _("Previous"))
1531 self.forward = wx.Button(self, wx.ID_FORWARD, _("Next"))
1532 sizer2.Add(self.backward, 0, wx.ALL, 5)
1533 sizer2.Add(self.forward, 0, wx.ALL, 5)
1534 bSizer1.Add( sizer2, 0, wx.ALL, 5 )
1535 self.SetSizer( bSizer1 )
1538 self.Bind(wx.EVT_SEARCHCTRL_SEARCH_BTN, self.OnSearch, self.search)
1539 self.Bind(wx.EVT_SEARCHCTRL_CANCEL_BTN, self.OnCancel, self.search)
1540 self.Bind(wx.EVT_TEXT_ENTER, self.OnSearch, self.search)
1541 self.Bind(wx.EVT_BUTTON, self.onforward, self.forward)
1542 self.Bind(wx.EVT_BUTTON, self.onbackward, self.backward)
1543 self.search.SetFocus()
1544 self.forward.Enable(False)
1545 self.backward.Enable(False)
1546 self.Centre( wx.BOTH )
1548 def __del__( self ):
1551 def OnSearch(self, evt):
1552 UnSelectList(self.listctrl)
1553 search_word = self.search.GetValue()
1554 if search_word.strip() != '' :
1555 formes = [self.listctrl.getColumnText(i, self.col) for i in range(self.listctrl.GetItemCount())]
1556 if search_word.endswith('*') :
1557 search_word = search_word[0:-1]
1558 result = [j for j, forme in enumerate(formes) if forme.startswith(search_word)]
1560 result = [j for j, forme in enumerate(formes) if forme == search_word]
1563 elif self.shown == True :
1564 self.showitems(result)
1566 self.showresult(result)
1570 def showitems(self, items) :
1571 if len(items) == 1 :
1572 self.listctrl.SetItemState(items[0], wx.LIST_STATE_SELECTED, wx.LIST_STATE_SELECTED)
1573 self.listctrl.Focus(items[0])
1574 self.listctrl.SetFocus()
1578 self.listctrl.SetItemState(i, wx.LIST_STATE_SELECTED, wx.LIST_STATE_SELECTED)
1579 self.listctrl.Focus(items[0])
1580 self.listctrl.SetFocus()
1581 self.forward.Enable(True)
1582 self.backward.Enable(False)
1587 def showresult(self, result) :
1588 toshow = [self.listctrl.itemDataMap[int(self.listctrl.getColumnText(i,0))] for i in result]
1589 proflist = [[[line[1], i+1, val] for i, val in enumerate(line[2:]) if val>=2] for line in toshow]
1590 #FIXME: intervenir en aval en virant les forme avec chi<2
1591 if proflist != [[]] :
1592 proflist = [val for line in proflist for val in line if line !=[]]
1593 nb = self.parent.parent.nb
1594 profile = nb.GetPage(nb.GetSelection())
1595 first_forme = proflist[0]
1596 cl = first_forme[1] - 1
1597 profile.ProfNB.SetSelection(cl)
1598 profile.ProfNB.GetPage(cl).SetFocus()
1599 UnSelectList(profile.ProfNB.GetPage(cl))
1600 datas = dict([[profile.ProfNB.GetPage(cl).getColumnText(i,6),i] for i in range(profile.ProfNB.GetPage(cl).GetItemCount())])
1601 profile.ProfNB.GetPage(cl).SetItemState(datas[first_forme[0]], wx.LIST_STATE_SELECTED, wx.LIST_STATE_SELECTED)
1602 profile.ProfNB.GetPage(cl).Focus(datas[first_forme[0]])
1603 profile.ProfNB.GetPage(cl).SetFocus()
1604 if len(proflist) == 1 :
1607 SearchResult = FindInCluster(self.parent.parent, -1, proflist)
1613 def onforward(self, evt) :
1614 self.listctrl.Focus(self.items[self.forwitem])
1615 self.listctrl.SetFocus()
1617 if self.forwitem == len(self.items) :
1618 self.forward.Enable(False)
1619 self.backward.Enable(True)
1623 self.backward.Enable(True)
1625 def onbackward(self, evt) :
1626 self.listctrl.Focus(self.items[self.backitem])
1627 self.listctrl.SetFocus()
1629 if self.backitem == -1 :
1631 self.forward.Enable(True)
1632 self.backward.Enable(False)
1635 self.forward.Enable(True)
1637 def noresult(self) :
1638 msg = _("Absent form")
1639 dial = wx.MessageDialog(self, _("Absent form"),_("Absent form"), wx.OK | wx.ICON_INFORMATION)
1640 dial.CenterOnParent()
1644 def OnCancel(self, evt) :
1647 def UnSelectList(liste) :
1648 if liste.GetFirstSelected() != -1 :
1649 last = liste.GetFirstSelected()
1650 liste.Select(liste.GetFirstSelected(), False)
1651 while liste.GetNextSelected(last) != -1 :
1652 last = liste.GetNextSelected(last)
1653 liste.Select(liste.GetFirstSelected(),False)
1656 class SearchCorpus(SearchDial):
1658 def OnSearch(self, evt):
1659 search_word = self.search.GetValue()
1660 if search_word.strip() != '' :
1661 self.corpus_ok = self.listctrl.GetCorpusByName(search_word)
1662 if self.corpus_ok != [] :
1663 if len(self.corpus_ok) == 1 :
1664 self.listctrl.GiveFocus(None, self.corpus_ok[0]['uuid'])
1667 self.listctrl.GiveFocus(None, self.corpus_ok[-1]['uuid'])
1668 self.forward.Enable(True)
1669 self.backward.Enable(False)
1672 #for corpus in corpus_ok :
1673 # self.listctrl.SetContentBackground(uuid = corpus['uuid'])
1679 def onforward(self, evt) :
1681 self.listctrl.GiveFocus(uuid=self.corpus_ok[-self.forwitem]['uuid'])
1682 if self.forwitem == len(self.corpus_ok) :
1683 self.forward.Enable(False)
1684 self.backward.Enable(True)
1685 self.backitem = self.forwitem - 1
1687 self.backitem = self.forwitem - 1
1688 self.backward.Enable(True)
1690 def onbackward(self, evt) :
1691 self.listctrl.GiveFocus(uuid=self.corpus_ok[-self.backitem]['uuid'])
1693 if self.backitem == 0 :
1695 self.forward.Enable(True)
1696 self.backward.Enable(False)
1699 self.forward.Enable(True)
1702 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 | wx.RESIZE_BORDER)
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 if not self.force_chi :
1714 self.label_typeformes = wx.StaticText(self, -1, _("Used forms"))
1715 typeformeschoiceChoices = [ _("actives and supplementaries"), _("actives"), _("supplementaries")]
1716 self.typeformes = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, typeformeschoiceChoices, 0 )
1717 self.typeformes.SetSelection( 0 )
1718 self.label_var = wx.StaticText(self, -1, _("Select by"))
1719 self.choice = wx.Choice(self, -1, (100,50), choices = [_("variables"), _("modalities")])
1720 self.label1 = wx.StaticText(self, -1, _("Choice"))
1721 self.list_box_1 = wx.ListBox(self, -1, choices=[], size = wx.Size( 300,200 ), style=wx.LB_EXTENDED | wx.LB_HSCROLL)
1722 self.button_2 = wx.Button(self, wx.ID_CANCEL, "")
1723 self.button_1 = wx.Button(self, wx.ID_OK, "")
1724 if not self.force_chi :
1725 indices = [_("hypergeometrical law"), _("chi2")]
1727 indices = [_("chi2")]
1728 self.label_indice = wx.StaticText(self, -1, _("Score"))
1729 self.choice_indice = wx.Choice(self, -1, (100,50), choices = indices)
1730 if not self.force_chi :
1731 self.label = wx.StaticText(self, -1, _("Minimum frequency"))
1732 self.spin = wx.SpinCtrl(self, -1, min = 1, max = 10000, initial = 10, size=wx.DefaultSize)
1733 self.Bind(wx.EVT_CHOICE, self.onselect, self.choice)
1734 self.Bind(wx.EVT_LISTBOX, self.onchoose, self.list_box_1)
1735 self.__set_properties()
1739 def __set_properties(self):
1740 # begin wxGlade: MyDialog.__set_properties
1741 self.SetTitle(_("Variables choice"))
1742 if not self.force_chi :
1743 self.spin.SetValue(10)
1744 self.choice.SetSelection(0)
1745 self.choice_indice.SetSelection(0)
1746 self.button_1.Enable(False)
1747 #self.SetMinSize(wx.Size(300, 400))
1750 def __do_layout(self):
1751 # begin wxGlade: MyDialog.__do_layout
1752 sizer_1 = wx.BoxSizer(wx.VERTICAL)
1753 sizer_2 = wx.FlexGridSizer(0,2,0,0)
1754 sizer_3 = wx.BoxSizer(wx.HORIZONTAL)
1755 #sizer_2.Add(self.labellem, 0, wx.ALIGN_CENTER_VERTICAL, 3)
1756 #sizer_2.Add(self.checklem, 0, wx.ALIGN_CENTER_VERTICAL, 3)
1757 if not self.force_chi :
1758 sizer_2.Add(self.label_typeformes, 0, wx.ALIGN_CENTER_VERTICAL, 3)
1759 sizer_2.Add(self.typeformes, 0, wx.ALIGN_CENTER_VERTICAL, 3)
1760 sizer_2.Add(self.label_var, 0, wx.ALIGN_CENTER_VERTICAL, 3)
1761 sizer_2.Add(self.choice, 0, wx.ALIGN_CENTER_VERTICAL, 3)
1762 sizer_2.Add(self.label1, 0, wx.ALIGN_CENTER_VERTICAL, 3)
1763 sizer_2.Add(self.list_box_1, 0, wx.ALIGN_RIGHT|wx.EXPAND, 3)
1764 sizer_3.Add(self.button_2, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 3)
1765 sizer_3.Add(self.button_1, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 3)
1766 sizer_2.Add(self.label_indice, 0, wx.ALIGN_CENTER_VERTICAL, 3)
1767 sizer_2.Add(self.choice_indice, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 3)
1768 if not self.force_chi :
1769 sizer_2.Add(self.label, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 3)
1770 sizer_2.Add(self.spin, 0, wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 3)
1771 sizer_1.Add(sizer_2, 0, wx.ALIGN_CENTER_HORIZONTAL, 3)
1772 sizer_1.Add(sizer_3, 0, wx.ALIGN_RIGHT, 3)
1773 self.SetSizer(sizer_1)
1778 def onselect(self, evt):
1779 self.list_box_1.Clear()
1780 if self.choice.GetSelection() == 0 :
1781 for var in self.variables :
1782 self.list_box_1.Append(var)
1784 for et in self.listet :
1785 self.list_box_1.Append(et)
1787 def onchoose(self, evt):
1788 if self.choice.GetSelection()== 0 :
1789 if len(self.list_box_1.GetSelections()) > 0 :
1790 self.button_1.Enable(True)
1792 self.button_1.Enable(False)
1793 elif self.choice.GetSelection() == 1 :
1794 if len(self.list_box_1.GetSelections()) > 1 :
1795 self.button_1.Enable(True)
1797 self.button_1.Enable(False)
1800 class PrefDendro ( wx.Dialog ):
1802 def __init__( self, parent, parametres ):
1803 wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = _("Dendrogram"), pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.DEFAULT_DIALOG_STYLE )
1804 self.parametres = parametres
1805 self.SetSizeHints( wx.DefaultSize, wx.DefaultSize )
1806 fgSizer1 = wx.FlexGridSizer( 0, 2, 0, 0 )
1807 fgSizer1.SetFlexibleDirection( wx.BOTH )
1808 fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
1809 self.m_staticText1 = wx.StaticText( self, wx.ID_ANY, _("Picture size"), wx.DefaultPosition, wx.DefaultSize, 0 )
1810 self.m_staticText1.Wrap( -1 )
1811 fgSizer1.Add( self.m_staticText1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1812 bSizer2 = wx.BoxSizer( wx.VERTICAL )
1813 bSizer3 = wx.BoxSizer( wx.HORIZONTAL )
1814 self.m_staticText2 = wx.StaticText( self, wx.ID_ANY, _("height"), wx.DefaultPosition, wx.DefaultSize, 0 )
1815 self.m_staticText2.Wrap( -1 )
1816 bSizer3.Add( self.m_staticText2, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1817 self.m_spinCtrl1 = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 50, 10000, 600 )
1818 bSizer3.Add( self.m_spinCtrl1, 0, wx.ALL, 5 )
1819 bSizer2.Add( bSizer3, 1, wx.EXPAND, 5 )
1820 bSizer31 = wx.BoxSizer( wx.HORIZONTAL )
1821 self.m_staticText3 = wx.StaticText( self, wx.ID_ANY, _("width"), wx.DefaultPosition, wx.DefaultSize, 0 )
1822 self.m_staticText3.Wrap( -1 )
1823 bSizer31.Add( self.m_staticText3, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1824 self.m_spinCtrl2 = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 50, 10000, 600 )
1825 bSizer31.Add( self.m_spinCtrl2, 0, wx.ALL, 5 )
1826 bSizer2.Add( bSizer31, 1, wx.EXPAND, 5 )
1827 fgSizer1.Add( bSizer2, 1, wx.EXPAND, 5 )
1828 self.m_staticline1 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1829 fgSizer1.Add( self.m_staticline1, 0, wx.EXPAND |wx.ALL, 5 )
1830 self.m_staticline2 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1831 fgSizer1.Add( self.m_staticline2, 0, wx.EXPAND |wx.ALL, 5 )
1832 self.m_staticText4 = wx.StaticText( self, wx.ID_ANY, _("Dendrogram type"), wx.DefaultPosition, wx.DefaultSize, 0 )
1833 self.m_staticText4.Wrap( -1 )
1834 fgSizer1.Add( self.m_staticText4, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1835 m_choice1Choices = [ "phylogram", "cladogram", "fan", "unrooted", "radial" ]
1836 self.m_choice1 = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, m_choice1Choices, 0 )
1837 self.m_choice1.SetSelection( 0 )
1838 fgSizer1.Add( self.m_choice1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT|wx.ALL, 5 )
1839 self.m_staticline3 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1840 fgSizer1.Add( self.m_staticline3, 0, wx.EXPAND |wx.ALL, 5 )
1841 self.m_staticline4 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1842 fgSizer1.Add( self.m_staticline4, 0, wx.EXPAND |wx.ALL, 5 )
1843 self.text_format_image = wx.StaticText( self, wx.ID_ANY, _("Image format"), wx.DefaultPosition, wx.DefaultSize, 0 )
1844 self.text_format_image.Wrap( -1 )
1845 fgSizer1.Add( self.text_format_image, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1846 self.choice_format = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, ['png', 'svg'], 0 )
1847 self.choice_format.SetSelection( 0 )
1848 fgSizer1.Add( self.choice_format, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT|wx.ALL, 5 )
1849 self.m_staticline31 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1850 fgSizer1.Add( self.m_staticline31, 0, wx.EXPAND |wx.ALL, 5 )
1851 self.m_staticline41 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1852 fgSizer1.Add( self.m_staticline41, 0, wx.EXPAND |wx.ALL, 5 )
1853 if self.parametres['typedendro'] == 'classique' :
1854 self.m_staticText5 = wx.StaticText( self, wx.ID_ANY, _("Color or black and white"), wx.DefaultPosition, wx.DefaultSize, 0 )
1855 self.m_staticText5.Wrap( -1 )
1856 fgSizer1.Add( self.m_staticText5, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1857 m_radioBox1Choices = [ _("color"), _("black and white") ]
1858 self.m_radioBox1 = wx.RadioBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, m_radioBox1Choices, 1, wx.RA_SPECIFY_COLS )
1859 self.m_radioBox1.SetSelection( 0 )
1860 fgSizer1.Add( self.m_radioBox1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT|wx.ALL, 5 )
1861 self.m_staticline5 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1862 fgSizer1.Add( self.m_staticline5, 0, wx.EXPAND |wx.ALL, 5 )
1863 self.m_staticline6 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1864 fgSizer1.Add( self.m_staticline6, 0, wx.EXPAND |wx.ALL, 5 )
1865 bSizer4 = wx.BoxSizer( wx.HORIZONTAL )
1866 self.m_staticText6 = wx.StaticText( self, wx.ID_ANY, _("Add cluster size"), wx.DefaultPosition, wx.DefaultSize, 0 )
1867 self.m_staticText6.Wrap( -1 )
1868 bSizer4.Add( self.m_staticText6, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1869 self.m_checkBox1 = wx.CheckBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
1870 self.m_checkBox1.SetValue(True)
1871 bSizer4.Add( self.m_checkBox1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1872 fgSizer1.Add( bSizer4, 1, wx.EXPAND, 5 )
1873 m_radioBox2Choices = [ _("circular diagram"), _("bar") ]
1874 self.m_radioBox2 = wx.RadioBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, m_radioBox2Choices, 1, wx.RA_SPECIFY_COLS )
1875 self.m_radioBox2.SetSelection( 0 )
1876 fgSizer1.Add( self.m_radioBox2, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT|wx.ALL, 5 )
1877 self.m_staticline7 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1878 fgSizer1.Add( self.m_staticline7, 0, wx.EXPAND |wx.ALL, 5 )
1879 self.m_staticline8 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1880 fgSizer1.Add( self.m_staticline8, 0, wx.EXPAND |wx.ALL, 5 )
1881 if self.parametres.get('translation', False) :
1882 self.m_staticText66 = wx.StaticText( self, wx.ID_ANY, _("Translation"), wx.DefaultPosition, wx.DefaultSize, 0 )
1883 self.m_staticText66.Wrap( -1 )
1884 fgSizer1.Add( self.m_staticText66, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1885 m_choice1Choices = [ "phylogram", "cladogram", "fan", "unrooted", "radial" ]
1886 self.trans = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, ['None'] + [val[0] for val in self.parametres['translation']], 0 )
1887 self.trans.SetSelection( 0 )
1888 fgSizer1.Add( self.trans, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT|wx.ALL, 5 )
1889 fgSizer1.AddStretchSpacer(wx.EXPAND)
1890 m_sdbSizer2 = wx.StdDialogButtonSizer()
1891 self.m_sdbSizer2OK = wx.Button( self, wx.ID_OK )
1892 m_sdbSizer2.AddButton( self.m_sdbSizer2OK )
1893 self.m_sdbSizer2Cancel = wx.Button( self, wx.ID_CANCEL )
1894 m_sdbSizer2.AddButton( self.m_sdbSizer2Cancel )
1895 m_sdbSizer2.Realize();
1896 fgSizer1.Add( m_sdbSizer2, 1, wx.EXPAND, 5 )
1897 self.__set_properties()
1898 self.SetSizer( fgSizer1 )
1900 fgSizer1.Fit( self )
1901 self.Centre( wx.BOTH )
1903 def __set_properties(self):
1904 self.m_spinCtrl2.SetValue(self.parametres['width'])
1905 self.m_spinCtrl1.SetValue(self.parametres['height'])
1906 self.m_choice1.SetSelection(self.parametres['type_dendro'])
1907 self.choice_format.SetSelection(self.parametres['svg'])
1908 if self.parametres['typedendro'] == 'classique' :
1909 self.m_radioBox1.SetSelection(self.parametres['color_nb'])
1910 self.m_checkBox1.SetValue(self.parametres['taille_classe'])
1911 self.m_radioBox2.SetSelection(self.parametres['type_tclasse'])
1913 def __del__( self ):
1917 class PrefWordCloud ( wx.Dialog ):
1919 def __init__( self, parent, fromcluster = False ):
1920 wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = _("Wordcloud settings"), pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.DEFAULT_DIALOG_STYLE)
1921 self.SetSizeHints( wx.DefaultSize, wx.DefaultSize )
1922 fgSizer1 = wx.FlexGridSizer( 0, 2, 0, 0 )
1923 fgSizer1.SetFlexibleDirection( wx.BOTH )
1924 fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
1925 #self.m_staticText1 = wx.StaticText( self, wx.ID_ANY, "Sélectionner les formes", wx.DefaultPosition, wx.DefaultSize, 0 )
1926 #self.m_staticText1.Wrap( -1 )
1927 #fgSizer1.Add( self.m_staticText1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
1928 #self.but_selectcol = wx.Button( self, wx.ID_ANY, "Sélectionner", wx.DefaultPosition, wx.DefaultSize, 0 )
1929 #fgSizer1.Add( self.but_selectcol, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1930 #self.m_staticline1 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1931 #fgSizer1.Add( self.m_staticline1, 0, wx.EXPAND |wx.ALL, 5 )
1932 #self.m_staticline2 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1933 #fgSizer1.Add( self.m_staticline2, 0, wx.EXPAND |wx.ALL, 5 )
1934 bSizer1 = wx.BoxSizer( wx.HORIZONTAL )
1935 self.m_staticText3 = wx.StaticText( self, wx.ID_ANY, _("height"), wx.DefaultPosition, wx.DefaultSize, 0 )
1936 self.m_staticText3.Wrap( -1 )
1937 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.DefaultSize, wx.SP_ARROW_KEYS, 0, 10000, 600 )
1939 self.spin_H.SetValue( 800 )
1940 bSizer1.Add( self.spin_H, 0, wx.ALL, 5 )
1941 fgSizer1.Add( bSizer1, 1, wx.EXPAND, 5 )
1942 bSizer3 = wx.BoxSizer( wx.HORIZONTAL )
1943 self.m_staticText4 = wx.StaticText( self, wx.ID_ANY, _("width"), wx.DefaultPosition, wx.DefaultSize, 0 )
1944 self.m_staticText4.Wrap( -1 )
1945 bSizer3.Add( self.m_staticText4, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
1946 self.spin_L = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 0, 10000, 600 )
1947 self.spin_L.SetValue( 800 )
1948 bSizer3.Add( self.spin_L, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1949 fgSizer1.Add( bSizer3, 1, wx.EXPAND, 5 )
1950 self.m_staticline3 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1951 fgSizer1.Add( self.m_staticline3, 0, wx.EXPAND |wx.ALL, 5 )
1952 self.m_staticline4 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1953 fgSizer1.Add( self.m_staticline4, 0, wx.EXPAND |wx.ALL, 5 )
1954 self.m_staticText11 = wx.StaticText( self, wx.ID_ANY, _("Picture format"), wx.DefaultPosition, wx.DefaultSize, 0 )
1955 self.m_staticText11.Wrap( -1 )
1956 fgSizer1.Add( self.m_staticText11, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1957 formatChoices = [ "png", "svg" ]
1958 self.format = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, formatChoices, 0 )
1959 self.format.SetSelection( 0 )
1960 fgSizer1.Add( self.format, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1962 self.m_staticText111 = wx.StaticText( self, wx.ID_ANY, _("Word size proportional to ..."), wx.DefaultPosition, wx.DefaultSize, 0 )
1963 self.m_staticText11.Wrap( -1 )
1964 fgSizer1.Add( self.m_staticText111, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1965 IndiceChoices = [ _("chi2"), _("frequency") ]
1966 self.indice = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, IndiceChoices, 0 )
1967 self.indice.SetSelection( 0 )
1968 fgSizer1.Add( self.indice, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1969 self.m_staticline13 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1970 fgSizer1.Add( self.m_staticline13, 0, wx.EXPAND |wx.ALL, 5 )
1971 self.m_staticline14 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1972 fgSizer1.Add( self.m_staticline14, 0, wx.EXPAND |wx.ALL, 5 )
1973 self.m_staticText5 = wx.StaticText( self, wx.ID_ANY, _("Maximum number of forms"), wx.DefaultPosition, wx.DefaultSize, 0 )
1974 self.m_staticText5.Wrap( -1 )
1975 fgSizer1.Add( self.m_staticText5, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
1976 self.spin_maxword = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 0, 10000, 600 )
1977 self.spin_maxword.SetValue( 600 )
1978 fgSizer1.Add( self.spin_maxword, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1979 self.m_staticline5 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1980 fgSizer1.Add( self.m_staticline5, 0, wx.EXPAND |wx.ALL, 5 )
1981 self.m_staticline6 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1982 fgSizer1.Add( self.m_staticline6, 0, wx.EXPAND |wx.ALL, 5 )
1983 self.typeformes = wx.StaticText( self, wx.ID_ANY, _("Used forms"), wx.DefaultPosition, wx.DefaultSize, 0 )
1984 self.typeformes.Wrap( -1 )
1985 fgSizer1.Add( self.typeformes, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1986 typeformeschoiceChoices = [ _("actives"), _("supplementaries"), _("actives and supplementaries") ]
1987 self.typeformeschoice = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, typeformeschoiceChoices, 0 )
1988 self.typeformeschoice.SetSelection( 0 )
1989 fgSizer1.Add( self.typeformeschoice, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1990 self.m_staticline11 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1991 fgSizer1.Add( self.m_staticline11, 0, wx.EXPAND |wx.ALL, 5 )
1992 self.m_staticline12 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1993 fgSizer1.Add( self.m_staticline12, 0, wx.EXPAND |wx.ALL, 5 )
1994 self.m_staticText6 = wx.StaticText( self, wx.ID_ANY, _("Text size"), wx.DefaultPosition, wx.DefaultSize, 0 )
1995 self.m_staticText6.Wrap( -1 )
1996 fgSizer1.Add( self.m_staticText6, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
1997 bSizer4 = wx.BoxSizer( wx.VERTICAL )
1998 bSizer5 = wx.BoxSizer( wx.HORIZONTAL )
1999 self.m_staticText7 = wx.StaticText( self, wx.ID_ANY, "Min", wx.DefaultPosition, wx.DefaultSize, 0 )
2000 self.m_staticText7.Wrap( -1 )
2001 bSizer5.Add( self.m_staticText7, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2002 self.spin_mincex = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 0, 1000, 5 )
2003 self.spin_mincex.SetValue( 5 )
2004 bSizer5.Add( self.spin_mincex, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2005 bSizer4.Add( bSizer5, 1, wx.EXPAND, 5 )
2006 bSizer6 = wx.BoxSizer( wx.HORIZONTAL )
2007 self.m_staticText8 = wx.StaticText( self, wx.ID_ANY, "Max", wx.DefaultPosition, wx.DefaultSize, 0 )
2008 self.m_staticText8.Wrap( -1 )
2009 bSizer6.Add( self.m_staticText8, 0,wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2010 self.spin_maxcex = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 0, 1000, 50 )
2011 self.spin_maxcex.SetValue( 50 )
2012 bSizer6.Add( self.spin_maxcex, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2013 bSizer4.Add( bSizer6, 1, wx.EXPAND, 5 )
2014 fgSizer1.Add( bSizer4, 1, wx.EXPAND, 5 )
2015 self.m_staticline7 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
2016 fgSizer1.Add( self.m_staticline7, 0, wx.EXPAND |wx.ALL, 5 )
2017 self.m_staticline8 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
2018 fgSizer1.Add( self.m_staticline8, 0, wx.EXPAND |wx.ALL, 5 )
2019 bSizer61 = wx.BoxSizer( wx.HORIZONTAL )
2020 self.m_staticText81 = wx.StaticText( self, wx.ID_ANY, _("Text color"), wx.DefaultPosition, wx.DefaultSize, 0 )
2021 self.m_staticText81.Wrap( -1 )
2022 bSizer61.Add( self.m_staticText81, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2023 self.color_text = wx.ColourPickerCtrl( self, wx.ID_ANY, wx.BLACK, wx.DefaultPosition, wx.DefaultSize, wx.CLRP_DEFAULT_STYLE )
2024 bSizer61.Add( self.color_text, 0, wx.ALL, 5 )
2025 fgSizer1.Add( bSizer61, 1, wx.EXPAND, 5 )
2026 bSizer7 = wx.BoxSizer( wx.HORIZONTAL )
2027 self.m_staticText9 = wx.StaticText( self, wx.ID_ANY, _("Background color"), wx.DefaultPosition, wx.DefaultSize, 0 )
2028 self.m_staticText9.Wrap( -1 )
2029 bSizer7.Add( self.m_staticText9, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2030 self.color_bg = wx.ColourPickerCtrl( self, wx.ID_ANY, (255,255,255), wx.DefaultPosition, wx.DefaultSize, wx.CLRP_DEFAULT_STYLE )
2031 bSizer7.Add( self.color_bg, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2032 fgSizer1.Add( bSizer7, 1, wx.EXPAND, 5 )
2033 self.m_staticline9 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
2034 fgSizer1.Add( self.m_staticline9, 0, wx.EXPAND |wx.ALL, 5 )
2035 self.m_staticline10 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
2036 fgSizer1.Add( self.m_staticline10, 0, wx.EXPAND |wx.ALL, 5 )
2037 fgSizer1.AddStretchSpacer(wx.EXPAND)
2038 m_sdbSizer1 = wx.StdDialogButtonSizer()
2039 self.m_sdbSizer1OK = wx.Button( self, wx.ID_OK )
2040 m_sdbSizer1.AddButton( self.m_sdbSizer1OK )
2041 self.m_sdbSizer1Cancel = wx.Button( self, wx.ID_CANCEL )
2042 m_sdbSizer1.AddButton( self.m_sdbSizer1Cancel )
2043 m_sdbSizer1.Realize();
2044 fgSizer1.Add( m_sdbSizer1, 1, wx.EXPAND, 5 )
2045 self.SetSizer( fgSizer1 )
2047 fgSizer1.Fit( self )
2048 self.Centre( wx.BOTH )
2050 def __del__( self ):
2054 class PrefChi(sc.SizedDialog):
2056 def __init__(self, parent, ID, optionchi, title):
2057 sc.SizedDialog.__init__(self, None, -1, _("Settings"),
2058 style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER)
2059 pane = self.GetContentsPane()
2060 pane.SetSizerType("form")
2061 pane.SetSizerProps(border=("all",5))
2062 self.parent = parent
2063 self.optionchi = optionchi
2064 self.label_obs = wx.StaticText(pane, -1, _("observed values"))
2065 self.check1 = wx.CheckBox(pane, -1)
2066 self.label_theo = wx.StaticText(pane, -1, _("expected values"))
2067 self.check2 = wx.CheckBox(pane, -1)
2068 self.label_resi = wx.StaticText(pane, -1, _("residuals"))
2069 self.check3 = wx.CheckBox(pane, -1)
2070 self.label_contrib = wx.StaticText(pane, -1, _("standardized residuals"))
2071 self.check4 = wx.CheckBox(pane, -1)
2072 # self.label_graph = wx.StaticText(pane, -1, 'graphique')
2073 # self.check8 = wx.CheckBox(pane, -1)
2074 self.label_pourcent = wx.StaticText(pane, -1, _("total percentage"))
2075 self.check5 = wx.CheckBox(pane, -1)
2076 self.label_prl = wx.StaticText(pane, -1, _("row percentage"))
2077 self.check6 = wx.CheckBox(pane, -1)
2078 self.label_prc = wx.StaticText(pane, -1, _("column percentage"))
2079 self.check7 = wx.CheckBox(pane, -1)
2080 self.label_graph = wx.StaticText(pane, -1, _("graphical"))
2081 self.check8 = wx.CheckBox(pane, -1)
2082 self.label_graphbw = wx.StaticText(pane, -1, _("black and white graphical"))
2083 self.checkbw = wx.CheckBox(pane, -1)
2084 self.SetButtonSizer(self.CreateStdDialogButtonSizer(wx.OK | wx.CANCEL))
2085 self.__set_properties()
2087 self.SetMinSize(self.GetSize())
2089 def __set_properties(self):
2090 self.check1.SetValue(self.optionchi['valobs'])
2091 self.check2.SetValue(self.optionchi['valtheo'])
2092 self.check3.SetValue(self.optionchi['resi'])
2093 self.check4.SetValue(self.optionchi['contrib'])
2094 self.check5.SetValue(self.optionchi['pourcent'])
2095 self.check6.SetValue(self.optionchi['pourcentl'])
2096 self.check7.SetValue(self.optionchi['pourcentc'])
2097 self.check8.SetValue(self.optionchi['graph'])
2098 self.checkbw.SetValue(self.optionchi['bw'])
2101 class ChiDialog(wx.Dialog):
2104 self, parent, ID, title, optionchi, tableau, size=wx.DefaultSize, pos=wx.DefaultPosition,
2105 style=wx.DEFAULT_DIALOG_STYLE
2107 wx.Dialog.__init__(self) # 1
2108 self.SetExtraStyle(wx.DIALOG_EX_CONTEXTHELP) # 2
2109 self.Create(parent, ID, title) # 3
2110 self.parent = parent
2111 self.optionchi = optionchi
2113 self.tableau = tableau
2114 #self.Filename=parent.filename
2115 #self.content=parent.content[:]
2116 self.headers=self.tableau.get_colnames()
2118 for i in self.headers:
2120 LABELLIST.append(i[0:60])
2124 self.LabelListOK=LABELLIST
2125 self.list_box_1 = wx.ListBox(self, -1, choices=self.LabelListOK, style=wx.LB_EXTENDED|wx.LB_HSCROLL)
2126 self.list_box_2 = wx.ListBox(self, -1, choices=self.LabelListOK, style=wx.LB_EXTENDED|wx.LB_HSCROLL)
2127 self.button_1 = wx.Button(self, wx.ID_OK)
2128 self.button_cancel = wx.Button(self, wx.ID_CANCEL)
2129 self.button_pref = wx.Button(self, wx.ID_PREFERENCES)
2130 self.__set_properties()
2132 self.Bind(wx.EVT_LISTBOX, self.selchange, self.list_box_1)
2133 self.Bind(wx.EVT_LISTBOX, self.selchange, self.list_box_2)
2134 self.Bind(wx.EVT_BUTTON, self.onparam, self.button_pref)
2135 self.button_1.Enable(False)
2138 def __set_properties(self):
2139 # begin wxGlade: ConfChi2.__set_properties
2140 self.SetTitle(_("Variables selection"))
2142 def __do_layout(self):
2143 # begin wxGlade: ConfChi2.__do_layout
2144 sizer_1 = wx.BoxSizer(wx.VERTICAL)
2145 sizer_2 = wx.BoxSizer(wx.VERTICAL)
2146 sizer_3 = wx.BoxSizer(wx.HORIZONTAL)
2147 sizer_4 = wx.BoxSizer(wx.HORIZONTAL)
2148 sizer_3.Add(self.list_box_1, 0, wx.EXPAND, 0)
2149 sizer_3.Add(self.list_box_2, 0, wx.EXPAND, 0)
2150 sizer_2.Add(sizer_3, 1, wx.EXPAND, 0)
2151 sizer_4.Add(self.button_cancel, 0, wx.ALL, 0)
2152 sizer_4.Add(self.button_pref, 0, wx.ALL, 0)
2153 sizer_4.Add(self.button_1, 0, wx.ALL, 0)
2154 sizer_2.Add(sizer_4, 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
2155 sizer_1.Add(sizer_2, 1, wx.EXPAND, 0)
2156 self.SetSizer(sizer_1)
2161 def selchange(self, event): # wxGlade: ConfChi2.<event_handler>
2162 if (len(self.list_box_1.GetSelections()) == 0) or (len(self.list_box_2.GetSelections()) == 0) :
2163 self.button_1.Enable(False)
2165 self.button_1.Enable(True)
2167 def onparam(self,event):
2168 self.dial = PrefChi(self.parent, -1, self.optionchi, '')
2169 self.dial.CenterOnParent()
2170 self.chiopt = self.dial.ShowModal()
2173 class CorpusPref ( wx.Dialog ):
2175 def __init__( self, parent, parametres ):
2176 wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = _("Settings"), pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.DEFAULT_DIALOG_STYLE | wx.STAY_ON_TOP )
2177 self.parent = parent
2178 langues_n = ['français', 'english', 'german (expérimentale)', 'italian', 'swedish (expérimentale)', 'portuguese', 'spanish', 'greek (expériementale)', 'galician (expérimentale)', 'autre...']
2179 self.langues = ['french', 'english', 'german', 'italian', 'swedish', 'portuguese', 'spanish', 'greek', 'galician', 'other']
2180 self.encodages = [enc[0].lower() for enc in encodages]
2181 ucimark = ['****', '0000']
2182 ucemethod = [_("characters"), _("occurrences"), _("paragraphs")]
2183 self.SetSizeHints( wx.DefaultSize, wx.DefaultSize )
2184 bSizer1 = wx.BoxSizer( wx.VERTICAL )
2185 self.m_notebook1 = wx.Notebook( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, 0 )
2186 self.m_panel1 = wx.Panel( self.m_notebook1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
2187 fgSizer1 = wx.FlexGridSizer( 0, 2, 0, 0 )
2188 fgSizer1.SetFlexibleDirection( wx.BOTH )
2189 fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
2190 self.m_staticText7 = wx.StaticText( self.m_panel1, wx.ID_ANY, _("corpus"), wx.DefaultPosition, wx.DefaultSize, 0 )
2191 self.m_staticText7.Wrap( -1 )
2192 fgSizer1.Add( self.m_staticText7, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2193 self.txtpath = wx.StaticText( self.m_panel1, wx.ID_ANY, _("Path"), wx.DefaultPosition, wx.DefaultSize, 0 )
2194 self.txtpath.Wrap( -1 )
2195 fgSizer1.Add( self.txtpath, 0, wx.ALL, 5 )
2196 self.m_staticText18 = wx.StaticText( self.m_panel1, wx.ID_ANY, _("Corpus' name"), wx.DefaultPosition, wx.DefaultSize, 0 )
2197 self.m_staticText18.Wrap( -1 )
2198 fgSizer1.Add( self.m_staticText18, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2199 self.corpusname = wx.TextCtrl( self.m_panel1, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size( 200,-1 ), 0 )
2200 fgSizer1.Add( self.corpusname, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2201 self.m_staticText1 = wx.StaticText( self.m_panel1, wx.ID_ANY, _("Characters set"), wx.DefaultPosition, wx.DefaultSize, 0 )
2202 self.m_staticText1.Wrap( -1 )
2203 fgSizer1.Add( self.m_staticText1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2204 encodage_choicesChoices = [' - '.join(encodage) for encodage in encodages]
2205 self.encodage_choices = wx.Choice( self.m_panel1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, encodage_choicesChoices, 0 )
2206 self.encodage_choices.SetSelection( 0 )
2207 fgSizer1.Add( self.encodage_choices, 0, wx.ALL, 5 )
2208 self.m_staticText2 = wx.StaticText( self.m_panel1, wx.ID_ANY, _("Language"), wx.DefaultPosition, wx.DefaultSize, 0 )
2209 self.m_staticText2.Wrap( -1 )
2210 fgSizer1.Add( self.m_staticText2, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2211 lang_choicesChoices = langues_n
2212 self.lang_choices = wx.Choice( self.m_panel1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, lang_choicesChoices, 0 )
2213 self.lang_choices.SetSelection( 0 )
2214 fgSizer1.Add( self.lang_choices, 0, wx.ALL, 5 )
2215 self.m_staticText19 = wx.StaticText( self.m_panel1, wx.ID_ANY, _("Dictionary"), wx.DefaultPosition, wx.DefaultSize, 0 )
2216 self.m_staticText19.Wrap( -1 )
2217 fgSizer1.Add( self.m_staticText19, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2218 bSizer2 = wx.BoxSizer( wx.HORIZONTAL )
2219 fgSizer5 = wx.FlexGridSizer( 2, 2, 0, 0 )
2220 fgSizer5.SetFlexibleDirection( wx.BOTH )
2221 fgSizer5.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
2222 self.radio_default_dict = wx.RadioButton( self.m_panel1, wx.ID_ANY, _("Default"), wx.DefaultPosition, wx.DefaultSize, 0 )
2223 fgSizer5.Add( self.radio_default_dict, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2224 self.defaultdictpath = wx.TextCtrl( self.m_panel1, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size( 300,-1 ), wx.TE_READONLY )
2225 self.defaultdictpath.Enable( False )
2226 fgSizer5.Add( self.defaultdictpath, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2227 self.radio_other_dict = wx.RadioButton( self.m_panel1, wx.ID_ANY, _("Other"), wx.DefaultPosition, wx.DefaultSize, 0 )
2228 fgSizer5.Add( self.radio_other_dict, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2229 self.otherdictpath = wx.FilePickerCtrl( self.m_panel1, wx.ID_ANY, wx.EmptyString, _("Select a file"), "*.*", wx.DefaultPosition, wx.Size( 300,-1 ), wx.FLP_DEFAULT_STYLE )
2230 self.otherdictpath.SetMinSize(wx.Size(300, -1))
2231 fgSizer5.Add( self.otherdictpath, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2232 self.otherdictpath.Enable( False )
2233 bSizer2.Add( fgSizer5, 1, wx.EXPAND, 5 )
2234 fgSizer1.Add( bSizer2, 1, wx.EXPAND, 5 )
2235 self.m_staticText3 = wx.StaticText( self.m_panel1, wx.ID_ANY, _("Output folder"), wx.DefaultPosition, wx.DefaultSize, 0 )
2236 self.m_staticText3.Wrap( -1 )
2237 fgSizer1.Add( self.m_staticText3, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2238 fgSizer41 = wx.FlexGridSizer( 0, 2, 0, 0 )
2239 fgSizer41.SetFlexibleDirection( wx.BOTH )
2240 fgSizer41.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
2241 self.repout_choices = wx.TextCtrl( self.m_panel1, wx.ID_ANY, "MyLabel", wx.DefaultPosition, wx.DefaultSize, 0 )
2242 self.repout_choices.SetMinSize( wx.Size( 400,-1 ) )
2243 fgSizer41.Add( self.repout_choices, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2244 self.m_button1 = wx.Button( self.m_panel1, wx.ID_ANY, _("Change ..."), wx.DefaultPosition, wx.DefaultSize, 0 )
2245 fgSizer41.Add( self.m_button1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2246 fgSizer1.Add( fgSizer41, 1, wx.EXPAND, 5 )
2247 self.m_staticText12 = wx.StaticText( self.m_panel1, wx.ID_ANY, _("Text mark"), wx.DefaultPosition, wx.DefaultSize, 0 )
2248 self.m_staticText12.Wrap( -1 )
2249 fgSizer1.Add( self.m_staticText12, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2250 ucimark_choicesChoices = ucimark
2251 self.ucimark_choices = wx.Choice( self.m_panel1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, ucimark_choicesChoices, 0 )
2252 self.ucimark_choices.SetSelection( 0 )
2253 fgSizer1.Add( self.ucimark_choices, 0, wx.ALL, 5 )
2254 self.m_staticText6 = wx.StaticText( self.m_panel1, wx.ID_ANY, _("Use the expression dictionary"), wx.DefaultPosition, wx.DefaultSize, 0 )
2255 self.m_staticText6.Wrap( -1 )
2256 fgSizer1.Add( self.m_staticText6, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2257 self.check_expressions = wx.CheckBox( self.m_panel1, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
2258 self.check_expressions.SetValue(True)
2259 fgSizer1.Add( self.check_expressions, 0, wx.ALL, 5 )
2260 self.m_staticText9 = wx.StaticText( self.m_panel1, wx.ID_ANY, _("Make text segments"), wx.DefaultPosition, wx.DefaultSize, 0 )
2261 self.m_staticText9.Wrap( -1 )
2262 fgSizer1.Add( self.m_staticText9, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2263 self.check_makeuce = wx.CheckBox( self.m_panel1, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
2264 self.check_makeuce.SetValue(True)
2265 fgSizer1.Add( self.check_makeuce, 0, wx.ALL, 5 )
2266 self.m_staticText10 = wx.StaticText( self.m_panel1, wx.ID_ANY, _("Text segments build process"), wx.DefaultPosition, wx.DefaultSize, 0 )
2267 self.m_staticText10.Wrap( -1 )
2268 fgSizer1.Add( self.m_staticText10, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2269 uce_modeChoices = ucemethod
2270 self.uce_mode = wx.Choice( self.m_panel1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, uce_modeChoices, 0 )
2271 self.uce_mode.SetSelection( 0 )
2272 fgSizer1.Add( self.uce_mode, 0, wx.ALL, 5 )
2273 self.m_staticText13 = wx.StaticText( self.m_panel1, wx.ID_ANY, _("Text segments size"), wx.DefaultPosition, wx.DefaultSize, 0 )
2274 self.m_staticText13.Wrap( -1 )
2275 fgSizer1.Add( self.m_staticText13, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2276 self.uce_size = wx.SpinCtrl( self.m_panel1, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 1, 1000000, 40 )
2277 fgSizer1.Add( self.uce_size, 0, wx.ALL, 5 )
2278 self.m_panel1.SetSizer( fgSizer1 )
2279 self.m_panel1.Layout()
2280 fgSizer1.Fit( self.m_panel1 )
2281 self.m_notebook1.AddPage( self.m_panel1, _("General"), True )
2282 self.m_panel2 = wx.Panel( self.m_notebook1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
2283 fgSizer3 = wx.FlexGridSizer( 0, 2, 0, 0 )
2284 fgSizer3.SetFlexibleDirection( wx.BOTH )
2285 fgSizer3.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
2286 self.m_staticText4 = wx.StaticText( self.m_panel2, wx.ID_ANY, _("Put text in lowercase"), wx.DefaultPosition, wx.DefaultSize, 0 )
2287 self.m_staticText4.Wrap( -1 )
2288 fgSizer3.Add( self.m_staticText4, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2289 self.check_lower = wx.CheckBox( self.m_panel2, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
2290 self.check_lower.SetValue(True)
2291 fgSizer3.Add( self.check_lower, 0, wx.ALL, 5 )
2292 self.m_staticText5 = wx.StaticText( self.m_panel2, wx.ID_ANY, _("Delete characters not in this list"), wx.DefaultPosition, wx.DefaultSize, 0 )
2293 self.m_staticText5.Wrap( -1 )
2294 fgSizer3.Add( self.m_staticText5, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2295 fgSizer4 = wx.FlexGridSizer( 0, 2, 0, 0 )
2296 fgSizer4.SetFlexibleDirection( wx.BOTH )
2297 fgSizer4.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
2298 self.check_charact = wx.CheckBox( self.m_panel2, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
2299 self.check_charact.SetValue(True)
2300 fgSizer4.Add( self.check_charact, 0, wx.ALL, 5 )
2301 self.txt_charact = wx.TextCtrl( self.m_panel2, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
2302 self.txt_charact.SetMinSize( wx.Size( 400,-1 ) )
2303 fgSizer4.Add( self.txt_charact, 0, wx.ALL|wx.EXPAND, 5 )
2304 fgSizer3.Add( fgSizer4, 1, wx.ALIGN_CENTER_VERTICAL|wx.EXPAND, 5 )
2305 self.m_staticText14 = wx.StaticText( self.m_panel2, wx.ID_ANY, _("Replace apostrophe by space"), wx.DefaultPosition, wx.DefaultSize, 0 )
2306 self.m_staticText14.Wrap( -1 )
2307 fgSizer3.Add( self.m_staticText14, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2308 self.check_apos = wx.CheckBox( self.m_panel2, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
2309 self.check_apos.SetValue(True)
2310 fgSizer3.Add( self.check_apos, 0, wx.ALL, 5 )
2311 self.m_staticText15 = wx.StaticText( self.m_panel2, wx.ID_ANY, _("Replace dash by space"), wx.DefaultPosition, wx.DefaultSize, 0 )
2312 self.m_staticText15.Wrap( -1 )
2313 fgSizer3.Add( self.m_staticText15, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2314 self.check_tirets = wx.CheckBox( self.m_panel2, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
2315 self.check_tirets.SetValue(True)
2316 fgSizer3.Add( self.check_tirets, 0, wx.ALL, 5 )
2317 self.m_staticText17 = wx.StaticText( self.m_panel2, wx.ID_ANY, _("Keep punctuation"), wx.DefaultPosition, wx.DefaultSize, 0 )
2318 self.m_staticText17.Wrap( -1 )
2319 fgSizer3.Add( self.m_staticText17, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2320 self.check_ponct = wx.CheckBox( self.m_panel2, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
2321 fgSizer3.Add( self.check_ponct, 0, wx.ALL, 5 )
2322 self.m_staticText16 = wx.StaticText( self.m_panel2, wx.ID_ANY, _("No space between two forms"), wx.DefaultPosition, wx.DefaultSize, 0 )
2323 self.m_staticText16.Wrap( -1 )
2324 fgSizer3.Add( self.m_staticText16, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2325 self.check_tolist = wx.CheckBox( self.m_panel2, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
2326 fgSizer3.Add( self.check_tolist, 0, wx.ALL, 5 )
2327 self.m_panel2.SetSizer( fgSizer3 )
2328 self.m_panel2.Layout()
2329 fgSizer3.Fit( self.m_panel2 )
2330 self.m_notebook1.AddPage( self.m_panel2, _("Cleaning"), False )
2331 bSizer1.Add( self.m_notebook1, 1, wx.EXPAND |wx.ALL, 5 )
2332 m_sdbSizer1 = wx.StdDialogButtonSizer()
2333 self.m_sdbSizer1OK = wx.Button( self, wx.ID_OK )
2334 m_sdbSizer1.AddButton( self.m_sdbSizer1OK )
2335 self.m_sdbSizer1Cancel = wx.Button( self, wx.ID_CANCEL )
2336 m_sdbSizer1.AddButton( self.m_sdbSizer1Cancel )
2337 m_sdbSizer1.Realize();
2338 bSizer1.Add( m_sdbSizer1, 0, wx.EXPAND, 5 )
2340 self.Bind(wx.EVT_BUTTON, self.OnChangeDir, self.m_button1)
2341 self.lang_choices.Bind( wx.EVT_CHOICE, self.OnChangeLangage )
2342 self.radio_other_dict.Bind( wx.EVT_RADIOBUTTON, self.changedictchoice )
2343 self.radio_default_dict.Bind( wx.EVT_RADIOBUTTON, self.changedictchoice )
2344 self.otherdictpath.Bind( wx.EVT_FILEPICKER_CHANGED, self.selectdict)
2345 self.setparametres(parametres)
2346 self.SetSizer( bSizer1 )
2349 self.Centre( wx.BOTH )
2351 def OnChangeDir(self, evt) :
2352 sdlg = wx.DirDialog(self.parent, _("Choose a folder"), style = wx.DD_DEFAULT_STYLE)
2353 if sdlg.ShowModal() == wx.ID_OK :
2354 self.repout_choices.SetValue(dlg.GetPath())
2357 def __del__( self ):
2360 def setparametres(self, parametres) :
2361 if locale.getpreferredencoding().lower() == 'mac-roman' :
2362 enc = self.encodages.index('macroman')
2365 enc = self.encodages.index(locale.getpreferredencoding().lower())
2367 enc = self.encodages.index('utf-8')
2368 self.encodage_choices.SetSelection(enc)
2369 self.lang_choices.SetSelection(0)
2370 self.repout_choices.SetValue(parametres['pathout'])
2371 self.corpusname.SetValue(parametres['corpus_name'])
2372 self.ucimark_choices.SetSelection(parametres['ucimark'])
2373 self.check_expressions.SetValue(parametres['expressions'])
2374 self.check_makeuce.SetValue(parametres['douce'])
2375 self.uce_mode.SetSelection(parametres['ucemethod'])
2376 self.uce_size.SetValue(parametres['ucesize'])
2377 self.check_lower.SetValue(parametres['lower'])
2378 #self.check_charact.SetValue(parametres['charact'])
2379 self.txt_charact.SetValue(parametres['keep_caract'])
2380 self.check_apos.SetValue(parametres['apos'])
2381 self.check_tirets.SetValue(parametres['tiret'])
2382 self.check_tolist.SetValue(parametres['tolist'])
2383 self.check_ponct.SetValue(parametres['keep_ponct'])
2384 self.defaultdictpath.SetValue(self.langues[0])
2386 def doparametres(self) :
2388 parametres['encoding'] = encodages[self.encodage_choices.GetSelection()][0]
2389 parametres['lang'] = self.langues[self.lang_choices.GetSelection()]
2390 parametres['pathout'] = self.repout_choices.GetValue()
2391 parametres['corpus_name'] = self.corpusname.GetValue()
2392 parametres['ucimark'] = self.ucimark_choices.GetSelection()
2393 parametres['expressions'] = self.check_expressions.GetValue()
2394 parametres['douce'] = self.check_makeuce.GetValue()
2395 parametres['ucemethod'] = self.uce_mode.GetSelection()
2396 parametres['ucesize'] = self.uce_size.GetValue()
2397 parametres['lower'] = self.check_lower.GetValue()
2398 parametres['charact'] = self.check_charact.GetValue()
2399 parametres['keep_caract'] = self.txt_charact.GetValue()
2400 parametres['apos'] = self.check_apos.GetValue()
2401 parametres['tiret'] = self.check_tirets.GetValue()
2402 parametres['tolist'] = self.check_tolist.GetValue()
2403 parametres['keep_ponct'] = self.check_ponct.GetValue()
2404 if self.radio_other_dict.GetValue() :
2405 parametres['dictionary'] = self.otherdictpath.GetPath()
2406 for val in parametres :
2407 if isinstance(parametres[val], bool) :
2408 if parametres[val] :
2414 def OnChangeLangage(self, evt):
2415 self.defaultdictpath.SetValue(self.langues[self.lang_choices.GetSelection()])
2417 def changedictchoice(self, evt):
2418 if self.radio_default_dict.GetValue() :
2419 self.otherdictpath.Enable( False )
2420 self.m_sdbSizer1OK.Enable( True )
2422 self.otherdictpath.Enable( True )
2423 if self.otherdictpath.GetPath() == '' :
2424 self.m_sdbSizer1OK.Enable( False )
2426 def selectdict(self, evt):
2427 if self.otherdictpath.GetPath() != '' :
2428 self.m_sdbSizer1OK.Enable( True )
2431 class ConcordList(wx.html.HtmlListBox):
2433 def __init__(self, parent, concord):
2434 self.concord = concord
2435 #self.script_status = dict()
2436 wx.html.HtmlListBox.__init__(self, parent, -1, size = (900, 600))
2437 self.SetItemCount(len(concord))
2438 #self.Bind(wx.EVT_LISTBOX, self.RefreshMe)
2439 #self.Bind(wx.EVT_LISTBOX_DCLICK, self.Download)
2441 def OnGetItem(self, index):
2442 return self.concord[index] #+ '<br>'
2444 class message(wx.Frame):
2445 def __init__(self, parent, items, title, size, save = True, uceids = None):
2446 wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = title, pos = wx.DefaultPosition, size = size, style = wx.CLOSE_BOX|wx.DEFAULT_FRAME_STYLE|wx.FRAME_FLOAT_ON_PARENT|wx.TAB_TRAVERSAL )
2447 self.parent = parent
2449 self.uceids = uceids
2450 self.ira = wx.GetApp().GetTopWindow()
2451 self.SetIcon(self.ira._icon)
2452 #self.SetSizeHints( wx.DefaultSize, wx.DefaultSize )
2455 #self.HtmlPage=wx.html.HtmlWindow(self, -1)
2456 self.panel = wx.Panel(self, wx.ID_ANY)
2457 self.HtmlPage = ConcordList(self.panel, items)
2458 #self.HtmlPage.SetMinSize( size )
2459 #if "gtk2" in wx.PlatformInfo:
2460 # self.HtmlPage.SetStandardFonts()
2461 #self.HtmlPage.SetFonts('Courier','Courier')
2462 self.button_1 = wx.Button(self.panel, wx.ID_CANCEL)
2463 self.Bind(wx.EVT_BUTTON, self.OnCloseMe, self.button_1)
2464 #self.HtmlPage.Bind(wx.wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, self.Download)
2465 self.HtmlPage.Bind(wx.html.EVT_HTML_LINK_CLICKED, self.OnLink)
2467 self.button_2 = wx.Button(self.panel, wx.ID_SAVE)
2468 self.Bind(wx.EVT_BUTTON, self.OnSavePage, self.button_2)
2469 if self.uceids is not None :
2470 self.butsub = wx.Button(self.panel, -1, _("Build sub corpus"))
2471 self.Bind(wx.EVT_BUTTON, self.OnSub, self.butsub)
2472 self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)
2475 def __do_layout(self):
2476 sizer_2 = wx.BoxSizer(wx.VERTICAL)
2477 sizer_2.Add(self.HtmlPage, 1, wx.EXPAND|wx.ADJUST_MINSIZE, 0)
2478 #m_sdbSizer1 = wx.StdDialogButtonSizer()
2479 m_sdbSizer1 = wx.BoxSizer(wx.HORIZONTAL)
2480 m_sdbSizer1.Add( self.button_1 , 0, wx.EXPAND)
2482 m_sdbSizer1.Add( self.button_2 , 0, wx.EXPAND)
2483 if self.uceids is not None :
2484 m_sdbSizer1.Add( self.butsub , 0, wx.EXPAND)
2485 #m_sdbSizer1.Realize()
2486 #self.panel.SetSizer( m_sdbSizer1 )
2487 sizer_2.Add( m_sdbSizer1, 0, wx.ALIGN_RIGHT, 5)
2488 self.panel.SetSizer(sizer_2)
2492 def OnSavePage(self, evt) :
2493 dlg = wx.FileDialog(
2494 self, message=_("Save as ..."), defaultDir=os.getcwd(),
2495 defaultFile="concordancier.html", wildcard="html|*.html", style=wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT
2497 #dlg.SetFilterIndex(2)
2498 dlg.CenterOnParent()
2499 self.html = '<br>'.join([self.items[i] for i in range(0,len(self.items))])
2500 if dlg.ShowModal() == wx.ID_OK:
2501 path = dlg.GetPath()
2502 with open(path, 'w', encoding='utf8') as f :
2505 def OnLink(self, evt):
2506 corpus = self.ira.tree.page.corpus
2507 link = evt.GetLinkInfo().GetHref().split('_')
2508 uciid = int(link[0])
2509 uceid = int(link[1])
2510 et = '<b>' + ' '.join(corpus.ucis[uciid].etoiles) + '</b><br>\n'
2511 txt = corpus.getuciconcorde_uces(uciid, uceid)
2512 txt = '\n'.join([row[1] + '<br>' if row[0] != uceid else '<font color=red><b>%s</b></font><br>' % row[1] for row in txt])
2513 txt = '<html>\n<body>\n' + et + txt + '\n</body>\n</html>'
2514 fullframe = FullText(self.ira)
2515 fullframe.m_htmlWin1.SetPage(txt)
2518 def OnCloseMe(self, event):
2521 def OnCloseWindow(self, event):
2524 def OnSub(self ,evt):
2525 parametres = {'fromuceids' : True, 'uceids' : self.uceids, 'isempty' : True}
2526 self.ira.OnSubText(wx.MenuEvent(), None, parametres)
2529 class ExtractDialog ( wx.Dialog ):
2531 def __init__( self, parent, option ):
2532 wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = wx.EmptyString, pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.DEFAULT_DIALOG_STYLE )
2533 self.option = option
2534 self.SetSizeHints( wx.DefaultSize, wx.DefaultSize )
2535 fgSizer1 = wx.FlexGridSizer( 0, 2, 0, 0 )
2536 fgSizer1.SetFlexibleDirection( wx.BOTH )
2537 fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
2538 self.m_staticText1 = wx.StaticText( self, wx.ID_ANY, _("corpus"), wx.DefaultPosition, wx.DefaultSize, 0 )
2539 self.m_staticText1.Wrap( -1 )
2540 fgSizer1.Add( self.m_staticText1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2541 self.corpusfile = wx.FilePickerCtrl( self, wx.ID_ANY, wx.EmptyString, _("Select a file"), "*.txt", wx.DefaultPosition, wx.Size( -1,-1 ), wx.FLP_DEFAULT_STYLE|wx.FLP_FILE_MUST_EXIST|wx.FLP_OPEN )
2542 self.corpusfile.SetMinSize( wx.Size( 500,-1 ) )
2543 fgSizer1.Add( self.corpusfile, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL|wx.EXPAND, 5 )
2544 self.m_staticText2 = wx.StaticText( self, wx.ID_ANY, _("Characters set"), wx.DefaultPosition, wx.DefaultSize, 0 )
2545 self.m_staticText2.Wrap( -1 )
2546 fgSizer1.Add( self.m_staticText2, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2547 encodageChoices = [' - '.join(encodage) for encodage in encodages]
2548 self.encodage = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, encodageChoices, 0 )
2549 self.encodage.SetSelection( 0 )
2550 self.encodage.SetMinSize( wx.Size( 200,-1 ) )
2551 fgSizer1.Add( self.encodage, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL|wx.EXPAND, 5 )
2552 if option == 'splitvar' :
2553 self.m_staticText3 = wx.StaticText( self, wx.ID_ANY, _("Variables (with the * but without the _)"), wx.DefaultPosition, wx.DefaultSize, 0 )
2554 self.m_staticText3.Wrap( -1 )
2555 fgSizer1.Add( self.m_staticText3, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2556 self.txtvar = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
2557 self.txtvar.SetMinSize( wx.Size( 200,-1 ) )
2558 fgSizer1.Add( self.txtvar, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL|wx.EXPAND, 5 )
2559 if option == 'mods' :
2560 self.m_staticText4 = wx.StaticText( self, wx.ID_ANY, _("Modalities (one by line, with the *)"), wx.DefaultPosition, wx.DefaultSize, 0 )
2561 self.m_staticText4.Wrap( -1 )
2562 fgSizer1.Add( self.m_staticText4, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2563 self.txtmods = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.TE_MULTILINE )
2564 self.txtmods.SetMinSize( wx.Size( 200,150 ) )
2565 fgSizer1.Add( self.txtmods, 0, wx.ALL|wx.EXPAND, 5 )
2566 self.m_staticText5 = wx.StaticText( self, wx.ID_ANY, _("Extraction type"), wx.DefaultPosition, wx.DefaultSize, 0 )
2567 self.m_staticText5.Wrap( -1 )
2568 fgSizer1.Add( self.m_staticText5, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2569 extractformatChoices = [ _("Only one file"), _("One file by modality") ]
2570 self.extractformat = wx.RadioBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, extractformatChoices, 1, wx.RA_SPECIFY_COLS )
2571 self.extractformat.SetSelection( 0 )
2572 fgSizer1.Add( self.extractformat, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2573 if option == 'them' :
2574 self.m_staticText4 = wx.StaticText( self, wx.ID_ANY, _("thematics (one by line, with the -*)"), wx.DefaultPosition, wx.DefaultSize, 0 )
2575 self.m_staticText4.Wrap( -1 )
2576 fgSizer1.Add( self.m_staticText4, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2577 self.txtmods = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.TE_MULTILINE )
2578 self.txtmods.SetMinSize( wx.Size( 200,150 ) )
2579 fgSizer1.Add( self.txtmods, 0, wx.ALL|wx.EXPAND, 5 )
2580 #self.m_staticText5 = wx.StaticText( self, wx.ID_ANY, _(u"Extraction type"), wx.DefaultPosition, wx.DefaultSize, 0 )
2581 #self.m_staticText5.Wrap( -1 )
2582 #fgSizer1.Add( self.m_staticText5, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2583 #extractformatChoices = [ _(u"Only one file"), _(u"One file by thematic") ]
2584 #self.extractformat = wx.RadioBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, extractformatChoices, 1, wx.RA_SPECIFY_COLS )
2585 #self.extractformat.SetSelection( 0 )
2586 #fgSizer1.Add( self.extractformat, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2587 fgSizer1.AddStretchSpacer(wx.EXPAND)
2588 m_sdbSizer1 = wx.StdDialogButtonSizer()
2589 self.m_sdbSizer1OK = wx.Button( self, wx.ID_OK )
2590 m_sdbSizer1.AddButton( self.m_sdbSizer1OK )
2591 self.m_sdbSizer1Cancel = wx.Button( self, wx.ID_CANCEL )
2592 m_sdbSizer1.AddButton( self.m_sdbSizer1Cancel )
2593 m_sdbSizer1.Realize()
2594 fgSizer1.Add( m_sdbSizer1, 1, wx.EXPAND, 5 )
2595 self.SetSizer( fgSizer1 )
2597 fgSizer1.Fit( self )
2598 self.Centre( wx.BOTH )
2600 def make_param(self) :
2602 le = [enc[0].lower() for enc in encodages]
2603 parametres['filein'] = self.corpusfile.GetPath()
2604 encodage = le[self.encodage.GetSelection()]
2605 parametres['encodein'] = encodage
2606 if self.option == 'splitvar' :
2607 parametres['var'] = self.txtvar.GetValue()
2608 if self.option == 'mods' :
2609 parametres['mods'] = self.txtmods.GetValue().splitlines()
2610 if self.extractformat.GetSelection() == 0 :
2611 parametres['onefile'] = True
2613 parametres['onefile'] = False
2614 if self.option == 'them' :
2615 parametres['them'] = self.txtmods.GetValue().splitlines()
2616 # if self.extractformat.GetSelection() == 0 :
2617 # parametres['onefile'] = True
2619 # parametres['onefile'] = False
2620 parametres['encodeout'] = le[self.encodage.GetSelection()]
2623 def __del__( self ):
2627 class FreqDialog ( wx.Dialog ):
2629 def __init__( self, parent, listcol, title, size = wx.Size( -1,-1 ), showNA = True):
2630 wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = wx.EmptyString, pos = wx.DefaultPosition, size = wx.Size( -1,-1 ), style = wx.DEFAULT_DIALOG_STYLE )
2631 self.header = listcol
2632 self.SetSizeHints( wx.DefaultSize, wx.DefaultSize )
2633 bSizer1 = wx.BoxSizer( wx.VERTICAL )
2634 m_listBox1Choices = self.header
2635 self.m_listBox1 = wx.ListBox( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, m_listBox1Choices, wx.LB_EXTENDED|wx.LB_HSCROLL )
2636 self.m_listBox1.SetMinSize( wx.Size( 500,-1 ) )
2637 bSizer1.Add( self.m_listBox1, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2639 fgSizer1 = wx.FlexGridSizer( 0, 2, 0, 0 )
2640 fgSizer1.SetFlexibleDirection( wx.BOTH )
2641 fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
2642 self.m_staticText1 = wx.StaticText( self, wx.ID_ANY, _("Include empty cells (NA)"), wx.DefaultPosition, wx.DefaultSize, 0 )
2643 self.m_staticText1.Wrap( -1 )
2644 fgSizer1.Add( self.m_staticText1, 0, wx.ALL, 5 )
2645 self.includeNA = wx.CheckBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
2646 fgSizer1.Add( self.includeNA, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2647 bSizer1.Add( fgSizer1, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL, 5 )
2648 m_sdbSizer1 = wx.StdDialogButtonSizer()
2649 self.m_sdbSizer1OK = wx.Button( self, wx.ID_OK )
2650 m_sdbSizer1.AddButton( self.m_sdbSizer1OK )
2651 self.m_sdbSizer1Cancel = wx.Button( self, wx.ID_CANCEL )
2652 m_sdbSizer1.AddButton( self.m_sdbSizer1Cancel )
2653 m_sdbSizer1.Realize();
2654 bSizer1.Add( m_sdbSizer1, 0, wx.EXPAND, 5 )
2655 self.SetSizer( bSizer1 )
2658 self.Centre( wx.BOTH )
2659 self.Bind(wx.EVT_LISTBOX, self.selchange, self.m_listBox1)
2660 self.m_sdbSizer1OK.Enable(False)
2662 def __del__( self ):
2665 def selchange(self, evt):
2666 if len(self.m_listBox1.GetSelections()) == 0 :
2667 self.m_sdbSizer1OK.Enable(False)
2669 self.m_sdbSizer1OK.Enable(True)
2672 class ProtoDial ( wx.Dialog ):
2674 def __init__( self, parent, headers ):
2675 wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = _("Settings"), pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.DEFAULT_DIALOG_STYLE )
2676 self.SetSizeHints( wx.Size( -1,-1 ), wx.DefaultSize )
2677 bSizer1 = wx.BoxSizer( wx.VERTICAL )
2678 fgSizer1 = wx.FlexGridSizer( 0, 2, 0, 0 )
2679 fgSizer1.SetFlexibleDirection( wx.BOTH )
2680 fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
2681 self.m_staticText1 = wx.StaticText( self, wx.ID_ANY, _("Variables"), wx.DefaultPosition, wx.DefaultSize, 0 )
2682 self.m_staticText1.Wrap( -1 )
2683 fgSizer1.Add( self.m_staticText1, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALL, 5 )
2684 self.m_staticText2 = wx.StaticText( self, wx.ID_ANY, _("Ranks"), wx.DefaultPosition, wx.DefaultSize, 0 )
2685 self.m_staticText2.Wrap( -1 )
2686 fgSizer1.Add( self.m_staticText2, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALL, 5 )
2687 variablesChoices = headers
2688 self.variables = wx.ListBox( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, variablesChoices, wx.LB_HSCROLL|wx.LB_MULTIPLE )
2689 self.variables.SetMinSize( wx.Size( 350,-1 ) )
2690 fgSizer1.Add( self.variables, 0, wx.EXPAND, 5 )
2691 rangsChoices = headers
2692 self.rangs = wx.ListBox( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, rangsChoices, wx.LB_HSCROLL|wx.LB_MULTIPLE )
2693 self.rangs.SetMinSize( wx.Size( 350,-1 ) )
2694 fgSizer1.Add( self.rangs, 0, wx.EXPAND, 5 )
2695 bSizer1.Add( fgSizer1, 1, wx.ALIGN_CENTER_HORIZONTAL, 5 )
2696 fgSizer3 = wx.FlexGridSizer( 0, 2, 0, 0 )
2697 fgSizer3.SetFlexibleDirection( wx.BOTH )
2698 fgSizer3.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
2699 self.m_staticText3 = wx.StaticText( self, wx.ID_ANY, _("Limit frequency"), wx.DefaultPosition, wx.DefaultSize, 0 )
2700 self.m_staticText3.Wrap( -1 )
2701 fgSizer3.Add( self.m_staticText3, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2702 bSizer2 = wx.BoxSizer( wx.HORIZONTAL )
2703 choix_freqChoices = [ _("automatic (mean)"), _("manual") ]
2704 self.choix_freq = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, choix_freqChoices, 0 )
2705 self.choix_freq.SetSelection( 0 )
2706 bSizer2.Add( self.choix_freq, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2707 self.freqlim = wx.TextCtrl( self, wx.ID_ANY, "0", wx.DefaultPosition, wx.DefaultSize, wx.TE_CENTRE )
2708 self.freqlim.Enable( False )
2709 self.freqlim.SetMinSize( wx.Size( 100,-1 ) )
2710 bSizer2.Add( self.freqlim, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2711 fgSizer3.Add( bSizer2, 1, wx.EXPAND, 5 )
2712 self.m_staticText4 = wx.StaticText( self, wx.ID_ANY, _("Limit rank"), wx.DefaultPosition, wx.DefaultSize, 0 )
2713 self.m_staticText4.Wrap( -1 )
2714 fgSizer3.Add( self.m_staticText4, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2715 bSizer21 = wx.BoxSizer( wx.HORIZONTAL )
2716 choix_rangChoices = [ _("automatic (mean)"), _("manual")]
2717 self.choix_rang = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, choix_rangChoices, 0 )
2718 self.choix_rang.SetSelection( 0 )
2719 bSizer21.Add( self.choix_rang, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2720 self.ranglim = wx.TextCtrl( self, wx.ID_ANY, "0", wx.DefaultPosition, wx.DefaultSize, wx.TE_CENTRE )
2721 self.ranglim.Enable( False )
2722 self.ranglim.SetMinSize( wx.Size( 100,-1 ) )
2723 bSizer21.Add( self.ranglim, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2724 fgSizer3.Add( bSizer21, 1, wx.EXPAND, 5 )
2725 self.m_staticText5 = wx.StaticText( self, wx.ID_ANY, _("Minimum frequency"), wx.DefaultPosition, wx.DefaultSize, 0 )
2726 self.m_staticText5.Wrap( -1 )
2727 fgSizer3.Add( self.m_staticText5, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2728 self.m_textCtrl4 = wx.TextCtrl( self, wx.ID_ANY, "2", wx.DefaultPosition, wx.DefaultSize, wx.TE_CENTRE )
2729 fgSizer3.Add( self.m_textCtrl4, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALL, 5 )
2730 self.m_staticText6 = wx.StaticText( self, wx.ID_ANY, "Type de représentation", wx.DefaultPosition, wx.DefaultSize, 0 )
2731 self.m_staticText6.Wrap( -1 )
2732 fgSizer3.Add( self.m_staticText6, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2733 m_choice3Choices = [ "Classical - List", "Classical - Cloud", "Plan" ]
2734 self.typegraph = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, m_choice3Choices, 0 )
2735 self.typegraph.SetSelection( 0 )
2736 fgSizer3.Add( self.typegraph, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALL, 5 )
2737 bSizer1.Add( fgSizer3, 0, wx.ALIGN_CENTER_HORIZONTAL, 5 )
2738 m_sdbSizer1 = wx.StdDialogButtonSizer()
2739 self.m_sdbSizer1OK = wx.Button( self, wx.ID_OK )
2740 m_sdbSizer1.AddButton( self.m_sdbSizer1OK )
2741 self.m_sdbSizer1Cancel = wx.Button( self, wx.ID_CANCEL )
2742 m_sdbSizer1.AddButton( self.m_sdbSizer1Cancel )
2743 m_sdbSizer1.Realize();
2744 bSizer1.Add( m_sdbSizer1, 0, wx.EXPAND, 5 )
2745 self.SetSizer( bSizer1 )
2748 self.Centre( wx.BOTH )
2750 self.choix_freq.Bind( wx.EVT_CHOICE, self.UpdateText )
2751 self.choix_rang.Bind( wx.EVT_CHOICE, self.UpdateText )
2752 self.Bind(wx.EVT_LISTBOX, self.selchange, self.variables)
2753 self.Bind(wx.EVT_LISTBOX, self.selchange, self.rangs)
2754 self.m_sdbSizer1OK.Enable(False)
2756 def __del__( self ):
2759 def selchange(self, evt):
2760 if (len(self.variables.GetSelections()) == 0) or (len(self.rangs.GetSelections()) == 0) or (len(self.variables.GetSelections()) != len(self.rangs.GetSelections())) :
2761 self.m_sdbSizer1OK.Enable(False)
2763 self.m_sdbSizer1OK.Enable(True)
2765 # Virtual event handlers, overide them in your derived class
2766 def UpdateText( self, event ):
2770 class SimpleDialog ( wx.Dialog ):
2772 def __init__( self, parent ):
2773 wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = wx.EmptyString, pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.DEFAULT_DIALOG_STYLE )
2774 self.SetSizeHints( wx.DefaultSize, wx.DefaultSize )
2775 bSizer1 = wx.BoxSizer( wx.VERTICAL )
2776 self.m_panel1 = wx.Panel( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
2777 bSizer2 = wx.BoxSizer( wx.VERTICAL )
2778 self.m_staticText1 = wx.StaticText( self.m_panel1, wx.ID_ANY, _("Export finished. Open in a web browser :"), wx.DefaultPosition, wx.DefaultSize, 0 )
2779 self.m_staticText1.Wrap( -1 )
2780 bSizer2.Add( self.m_staticText1, 0, wx.ALL, 5 )
2781 self.link = wx.HyperlinkCtrl( self.m_panel1, wx.ID_ANY, "wxFB Website", "http://www.wxformbuilder.org", wx.DefaultPosition, wx.DefaultSize, wx.HL_DEFAULT_STYLE )
2782 bSizer2.Add( self.link, 0, wx.ALL, 5 )
2783 self.m_panel1.SetSizer( bSizer2 )
2784 self.m_panel1.Layout()
2785 bSizer2.Fit( self.m_panel1 )
2786 bSizer1.Add( self.m_panel1, 1, wx.EXPAND |wx.ALL, 5 )
2787 m_sdbSizer1 = wx.StdDialogButtonSizer()
2788 self.m_sdbSizer1OK = wx.Button( self, wx.ID_OK )
2789 m_sdbSizer1.AddButton( self.m_sdbSizer1OK )
2790 m_sdbSizer1.Realize();
2791 bSizer1.Add( m_sdbSizer1, 0, wx.EXPAND, 5 )
2792 self.SetSizer( bSizer1 )
2795 self.Centre( wx.BOTH )
2797 def __del__( self ):
2801 class SubTextFromMetaDial ( wx.Dialog ):
2803 def __init__( self, parent, parametres ):
2804 wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = _("Subcorpus"), pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.DEFAULT_DIALOG_STYLE )
2805 self.SetSizeHints( wx.DefaultSize, wx.DefaultSize )
2806 bSizer1 = wx.BoxSizer( wx.VERTICAL )
2807 fgSizer1 = wx.FlexGridSizer( 0, 2, 0, 0 )
2808 fgSizer1.SetFlexibleDirection( wx.BOTH )
2809 fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
2810 self.m_staticText1 = wx.StaticText( self, wx.ID_ANY, _("Name"), wx.DefaultPosition, wx.DefaultSize, 0 )
2811 self.m_staticText1.Wrap( -1 )
2812 fgSizer1.Add( self.m_staticText1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2813 self.subcorpusname = wx.TextCtrl( self, wx.ID_ANY, parametres['corpus_name'], wx.DefaultPosition, wx.Size( 300,-1 ), 0 )
2814 fgSizer1.Add( self.subcorpusname, 0, wx.ALL, 5 )
2815 self.m_staticText2 = wx.StaticText( self, wx.ID_ANY, _("Select one or more metadata"), wx.DefaultPosition, wx.DefaultSize, 0 )
2816 self.m_staticText2.Wrap( -1 )
2817 fgSizer1.Add( self.m_staticText2, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2818 m_listBox1Choices = parametres['meta']
2819 self.m_listBox1 = wx.ListBox( self, wx.ID_ANY, wx.DefaultPosition, wx.Size( -1,-1 ), m_listBox1Choices, wx.LB_HSCROLL|wx.LB_MULTIPLE )
2820 self.m_listBox1.SetMinSize( wx.Size( -1,200 ) )
2821 self.m_listBox1.SetMaxSize( wx.Size( -1,500 ) )
2822 fgSizer1.Add( self.m_listBox1, 0, wx.ALL|wx.EXPAND, 5 )
2823 bSizer1.Add( fgSizer1, 1, wx.EXPAND, 5 )
2824 m_sdbSizer1 = wx.StdDialogButtonSizer()
2825 self.m_sdbSizer1OK = wx.Button( self, wx.ID_OK )
2826 m_sdbSizer1.AddButton( self.m_sdbSizer1OK )
2827 self.m_sdbSizer1Cancel = wx.Button( self, wx.ID_CANCEL )
2828 m_sdbSizer1.AddButton( self.m_sdbSizer1Cancel )
2829 m_sdbSizer1.Realize();
2830 bSizer1.Add( m_sdbSizer1, 0, wx.EXPAND, 5 )
2831 self.SetSizer( bSizer1 )
2834 self.Centre( wx.BOTH )
2835 self.Bind(wx.EVT_LISTBOX, self.onchoose, self.m_listBox1)
2836 if not parametres.get('isempty', False) :
2837 self.m_sdbSizer1OK.Enable(False)
2839 def __del__( self ):
2842 def onchoose(self, evt):
2843 if len(self.m_listBox1.GetSelections()) > 0 :
2844 self.m_sdbSizer1OK.Enable(True)
2846 self.m_sdbSizer1OK.Enable(False)
2848 class BarGraphDialog ( wx.Dialog ):
2850 def __init__( self, parent, width, height ):
2851 wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = _("Preferences"), pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.DEFAULT_DIALOG_STYLE )
2852 self.SetSizeHints( wx.DefaultSize, wx.DefaultSize )
2853 bSizer1 = wx.BoxSizer( wx.VERTICAL )
2854 bSizer2 = wx.BoxSizer( wx.HORIZONTAL )
2855 self.m_staticText1 = wx.StaticText( self, wx.ID_ANY, _("Size"), wx.DefaultPosition, wx.DefaultSize, 0 )
2856 self.m_staticText1.Wrap( -1 )
2857 bSizer2.Add( self.m_staticText1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2858 sizeradioChoices = [ _("automatic"), _("manual") ]
2859 self.sizeradio = wx.RadioBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, sizeradioChoices, 1, wx.RA_SPECIFY_COLS )
2860 self.sizeradio.SetSelection( 0 )
2861 bSizer2.Add( self.sizeradio, 0, wx.ALIGN_TOP|wx.ALL, 5 )
2862 fgSizer1 = wx.FlexGridSizer( 0, 2, 0, 0 )
2863 fgSizer1.SetFlexibleDirection( wx.BOTH )
2864 fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
2865 self.m_staticText2 = wx.StaticText( self, wx.ID_ANY, _("width"), wx.DefaultPosition, wx.DefaultSize, 0 )
2866 self.m_staticText2.Wrap( -1 )
2867 fgSizer1.Add( self.m_staticText2, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2868 self.widthsp = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 0, 1000000, 600 )
2869 fgSizer1.Add( self.widthsp, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2870 self.m_staticText3 = wx.StaticText( self, wx.ID_ANY, _("height"), wx.DefaultPosition, wx.DefaultSize, 0 )
2871 self.m_staticText3.Wrap( -1 )
2872 fgSizer1.Add( self.m_staticText3, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2873 self.heightsp = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 1, 10000000, 400 )
2874 fgSizer1.Add( self.heightsp, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2875 bSizer2.Add( fgSizer1, 1, wx.EXPAND, 5 )
2876 bSizer1.Add( bSizer2, 1, wx.EXPAND, 5 )
2877 bSizer3 = wx.BoxSizer( wx.HORIZONTAL )
2878 self.m_staticText4 = wx.StaticText( self, wx.ID_ANY, _("Image format"), wx.DefaultPosition, wx.DefaultSize, 0 )
2879 self.m_staticText4.Wrap( -1 )
2880 bSizer3.Add( self.m_staticText4, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2881 formatChoices = [ "png", "svg" ]
2882 self.format = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, formatChoices, 0 )
2883 self.format.SetSelection( 0 )
2884 bSizer3.Add( self.format, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2885 bSizer1.Add( bSizer3, 1, wx.EXPAND, 5 )
2886 m_sdbSizer1 = wx.StdDialogButtonSizer()
2887 self.m_sdbSizer1OK = wx.Button( self, wx.ID_OK )
2888 m_sdbSizer1.AddButton( self.m_sdbSizer1OK )
2889 self.m_sdbSizer1Cancel = wx.Button( self, wx.ID_CANCEL )
2890 m_sdbSizer1.AddButton( self.m_sdbSizer1Cancel )
2891 m_sdbSizer1.Realize();
2892 bSizer1.Add( m_sdbSizer1, 0, wx.EXPAND, 5 )
2893 self.SetSizer( bSizer1 )
2896 self.Centre( wx.BOTH )
2898 self.sizeradio.Bind( wx.EVT_RADIOBOX, self.OnSizeRadio )
2899 self.widthsp.SetValue(width)
2900 self.heightsp.SetValue(height)
2901 self.widthsp.Enable(False)
2902 self.heightsp.Enable(False)
2903 self.m_sdbSizer1OK.SetFocus()
2905 def __del__( self ):
2908 # Virtual event handlers, overide them in your derived class
2909 def OnSizeRadio( self, event ):
2910 if self.sizeradio.GetSelection() == 0 :
2911 self.widthsp.Enable(False)
2912 self.heightsp.Enable(False)
2914 self.widthsp.Enable(True)
2915 self.heightsp.Enable(True)
2919 class ImageViewer ( wx.Frame ):
2921 def __init__( self, parent, parametres, title, size ):
2922 wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = title, pos = wx.DefaultPosition, size = size, style = wx.DEFAULT_FRAME_STYLE|wx.MAXIMIZE_BOX|wx.MINIMIZE_BOX|wx.STAY_ON_TOP|wx.TAB_TRAVERSAL )
2923 self.ira = wx.GetApp().GetTopWindow()
2924 self.SetIcon(self.ira._icon)
2925 self.parametres = parametres
2926 self.imageFile = self.parametres['tmpgraph']
2927 if parametres['svg'] == 'TRUE' :
2928 self.imagename = "image.svg"
2930 self.imagename = "image.png"
2931 self.SetSizeHints( wx.DefaultSize, wx.DefaultSize )
2932 bSizer1 = wx.BoxSizer( wx.VERTICAL )
2933 self.m_panel1 = wx.ScrolledWindow(self, -1)# wx.Panel( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.HSCROLL|wx.TAB_TRAVERSAL|wx.VSCROLL )
2934 self.m_panel1.SetScrollbars(1, 1, 200, 300)
2935 bSizer2 = wx.BoxSizer( wx.VERTICAL )
2936 if parametres['svg'] == 'FALSE' :
2937 image = wx.Image(self.imageFile, wx.BITMAP_TYPE_PNG)
2938 W = image.GetWidth()
2939 H = image.GetHeight()
2944 image = image.ConvertToBitmap()
2945 self.m_bitmap1 = wx.StaticBitmap( self.m_panel1, wx.ID_ANY, image, wx.DefaultPosition, wx.DefaultSize, 0 )
2946 bSizer2.Add( self.m_bitmap1, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2948 link = hl.HyperLinkCtrl(self.m_panel1, wx.ID_ANY, "Click on this link", URL=self.imageFile )
2949 bSizer2.Add( link, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2950 self.m_panel1.SetSizer( bSizer2 )
2951 self.m_panel1.Layout()
2952 bSizer2.Fit( self.m_panel1 )
2953 bSizer1.Add( self.m_panel1, 1, wx.EXPAND |wx.ALL, 5 )
2954 panel = wx.Panel(self, -1)
2955 m_sdbSizer1 = wx.StdDialogButtonSizer()
2956 self.m_sdbSizer1Save = wx.Button( panel, wx.ID_SAVE )
2957 m_sdbSizer1.AddButton( self.m_sdbSizer1Save )
2958 self.m_sdbSizer1Cancel = wx.Button( panel, wx.ID_CANCEL )
2959 m_sdbSizer1.AddButton( self.m_sdbSizer1Cancel )
2960 m_sdbSizer1.Realize();
2961 panel.SetSizer( m_sdbSizer1 )
2962 bSizer1.Add( panel, 0, wx.EXPAND, 5 )
2963 self.SetSizer( bSizer1 )
2965 self.Centre( wx.BOTH )
2966 if parametres['svg'] == 'FALSE' :
2967 self.SetSize((W + 30,H + 30))
2968 self.Bind(wx.EVT_BUTTON, self.OnCloseMe, self.m_sdbSizer1Cancel)
2969 self.Bind(wx.EVT_BUTTON, self.OnSaveImage, self.m_sdbSizer1Save)
2971 def __del__( self ):
2974 def OnCloseMe(self, event):
2977 def OnSaveImage(self, event) :
2978 dlg = wx.FileDialog(
2979 self, message=_("Save as..."), defaultDir=self.parametres.get('pathout',os.getcwd()),
2980 defaultFile= self.imagename, wildcard=self.parametres['wildcard'], style=wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT
2982 dlg.SetFilterIndex(0)
2983 dlg.CenterOnParent()
2984 if dlg.ShowModal() == wx.ID_OK:
2985 path = dlg.GetPath()
2986 copyfile(self.imageFile, path)
2991 def __init__(self, ira, table, colnames, rownames, tree = False):
2993 width = 100 + (10*len(rownames)) + (100 * len(colnames))
2994 height = len(rownames) * 15
2999 height = (35 * len(colnames)) + (15 * len(rownames))
3000 dial = BarGraphDialog(ira, width, height)
3001 val = dial.ShowModal()
3002 if val == wx.ID_OK :
3003 tmpgraph = tempfile.mktemp(dir=ira.TEMPDIR)
3004 if dial.format.GetSelection() == 0 :
3006 wildcard = "png|*.png"
3010 wildcard = "svg|*.svg"
3012 pathout = ira.tree.page.pathout[fout]
3013 parametres = {'width' : dial.widthsp.GetValue(),
3014 'height': dial.heightsp.GetValue(),
3015 'colnames' : colnames,
3016 'rownames' : rownames,
3017 'tmpgraph' : tmpgraph,
3018 'rgraph' : ira.RscriptsPath['Rgraph'],
3020 'wildcard' : wildcard,
3024 parametres['tree'] = tree
3025 txt = barplot(table, parametres)
3026 tmpscript = tempfile.mktemp(dir=ira.TEMPDIR)
3027 with open(tmpscript,'w', encoding='utf8') as f :
3029 exec_rcode(ira.RPath, tmpscript, wait = True)
3030 win = ImageViewer(ira, parametres, _("Graphic"), size=(700, 500))
3037 def __init__(self, ira, parametres, pathout, which = 'chi2'):
3040 self.parametres = parametres
3041 self.pathout = pathout
3043 dial = BarGraphDialog(ira, width, height)
3044 val = dial.ShowModal()
3045 if val == wx.ID_OK :
3046 tmpgraph = tempfile.mktemp(dir=ira.TEMPDIR)
3047 if dial.format.GetSelection() == 0 :
3049 wildcard = "png|*.png"
3052 wildcard = "svg|*.svg"
3053 parametres = {'width' : dial.widthsp.GetValue(),
3054 'height': dial.heightsp.GetValue(),
3055 'tmpgraph' : tmpgraph,
3057 'wildcard' : wildcard}
3058 self.parametres.update(parametres)
3059 if which == 'chi2' :
3060 script = ChronoChi2Script(self)
3061 elif which == 'prop' :
3062 script = ChronoPropScript(self)
3063 elif which == 'gg' :
3064 script = ChronoggScript(self)
3065 script.make_script()
3066 exec_rcode(ira.RPath, script.scriptout, wait = True)
3067 win = ImageViewer(ira, self.parametres, _("Graphic"), size=(700, 500))
3072 class MergeDialog ( wx.Dialog ):
3074 def __init__( self, parent ):
3075 wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = wx.EmptyString, pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.DEFAULT_DIALOG_STYLE|wx.MINIMIZE_BOX )
3076 self.SetSizeHints( wx.DefaultSize, wx.DefaultSize )
3077 bSizer1 = wx.BoxSizer( wx.VERTICAL )
3078 self.m_scrolledWindow1 = wx.ScrolledWindow( self, wx.ID_ANY, wx.DefaultPosition, wx.Size( 600,200 ), wx.HSCROLL|wx.VSCROLL )
3079 self.m_scrolledWindow1.SetScrollRate( 5, 5 )
3080 #self.m_scrolledWindow1.SetMinSize( wx.Size( 500,200 ) )
3081 fgSizer2 = wx.FlexGridSizer( 0, 2, 0, 0 )
3082 fgSizer2.AddGrowableCol( 1 )
3083 fgSizer2.SetFlexibleDirection( wx.BOTH )
3084 fgSizer2.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_ALL )
3085 self.m_staticText3 = wx.StaticText( self.m_scrolledWindow1, wx.ID_ANY, "graphe 1", wx.DefaultPosition, wx.DefaultSize, 0 )
3086 self.m_staticText3.Wrap( -1 )
3087 fgSizer2.Add( self.m_staticText3, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
3088 self.m_filePicker3 = wx.FilePickerCtrl( self.m_scrolledWindow1, wx.ID_ANY, wx.EmptyString, "Select a file", "*.*", wx.DefaultPosition, wx.DefaultSize, wx.FLP_DEFAULT_STYLE|wx.FLP_FILE_MUST_EXIST|wx.FLP_USE_TEXTCTRL )
3089 self.m_filePicker3.SetMinSize( wx.Size( 400,-1 ) )
3090 fgSizer2.Add( self.m_filePicker3, 1, wx.ALIGN_CENTER_VERTICAL|wx.ALL|wx.EXPAND, 5 )
3091 self.m_staticText4 = wx.StaticText( self.m_scrolledWindow1, wx.ID_ANY, "graphe 2", wx.DefaultPosition, wx.DefaultSize, 0 )
3092 self.m_staticText4.Wrap( -1 )
3093 fgSizer2.Add( self.m_staticText4, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
3094 self.m_filePicker4 = wx.FilePickerCtrl( self.m_scrolledWindow1, wx.ID_ANY, wx.EmptyString, "Select a file", "*.*", wx.DefaultPosition, wx.DefaultSize, wx.FLP_DEFAULT_STYLE|wx.FLP_FILE_MUST_EXIST|wx.FLP_USE_TEXTCTRL )
3095 self.m_filePicker4.SetMinSize( wx.Size( 400,-1 ) )
3096 fgSizer2.Add( self.m_filePicker4, 1, wx.ALL|wx.EXPAND, 5 )
3097 self.m_scrolledWindow1.SetSizer( fgSizer2 )
3098 self.m_scrolledWindow1.Layout()
3099 bSizer1.Add( self.m_scrolledWindow1, 0, wx.ALL, 5 )
3100 self.button_add = wx.Button( self, wx.ID_ANY, "Add graphe", wx.DefaultPosition, wx.DefaultSize, 0 )
3101 bSizer1.Add( self.button_add, 1, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
3102 m_sdbSizer1 = wx.StdDialogButtonSizer()
3103 self.m_sdbSizer1OK = wx.Button( self, wx.ID_OK )
3104 m_sdbSizer1.AddButton( self.m_sdbSizer1OK )
3105 self.m_sdbSizer1Cancel = wx.Button( self, wx.ID_CANCEL )
3106 m_sdbSizer1.AddButton( self.m_sdbSizer1Cancel )
3107 m_sdbSizer1.Realize();
3108 bSizer1.Add( m_sdbSizer1, 1, wx.EXPAND, 5 )
3109 self.SetSizer( bSizer1 )
3112 self.Centre( wx.BOTH )
3114 self.button_add.Bind( wx.EVT_BUTTON, self.OnAddGraphe )
3115 self.m_filePicker3.Bind(wx.EVT_FILEPICKER_CHANGED, self.OnFileChange)
3116 self.m_filePicker4.Bind(wx.EVT_FILEPICKER_CHANGED, self.OnFileChange)
3117 self.finish(fgSizer2, bSizer1)
3119 def __del__( self ):
3122 def finish(self, fgSizer2, bSizer1):
3123 self.graphs = [self.m_filePicker3, self.m_filePicker4]
3124 self.fgSizer2 = fgSizer2
3125 self.bSizer1 = bSizer1
3127 def OnFileChange(self, evt):
3128 obj = evt.GetEventObject()
3129 if obj.GetPath() != '' :
3130 for graph in self.graphs :
3131 graph.SetInitialDirectory(os.path.dirname(obj.GetPath()))
3133 # Virtual event handlers, overide them in your derived class
3134 def OnAddGraphe( self, event ):
3135 lab = wx.StaticText( self.m_scrolledWindow1, wx.ID_ANY, ' '.join(['graphe', repr(len(self.graphs) + 1)]), wx.DefaultPosition, wx.DefaultSize, 0 )
3137 self.graphs.append( wx.FilePickerCtrl( self.m_scrolledWindow1, wx.ID_ANY, wx.EmptyString, "Select a file", "*.*", wx.DefaultPosition, wx.DefaultSize, wx.FLP_DEFAULT_STYLE|wx.FLP_FILE_MUST_EXIST|wx.FLP_USE_TEXTCTRL ) )
3138 self.graphs[-1].SetMinSize( wx.Size( 400, -1))
3139 if self.graphs[-2].GetPath() != '' :
3140 self.graphs[-1].SetInitialDirectory(os.path.dirname(self.graphs[-2].GetPath()))
3141 self.graphs[-1].Bind(wx.EVT_FILEPICKER_CHANGED, self.OnFileChange)
3142 self.fgSizer2.Add( lab, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
3143 self.fgSizer2.Add( self.graphs[-1], 1, wx.ALIGN_CENTER_VERTICAL|wx.ALL|wx.EXPAND, 5 )
3144 self.m_scrolledWindow1.Layout()
3145 self.m_scrolledWindow1.SetSizer( self.fgSizer2 )
3146 #self.fgSizer2.Fit( self.m_scrolledWindow1 )
3148 #self.bSizer1.Fit(self)
3151 def RemoveGraphe(self, evt ):
3155 class translate_dialog ( wx.Dialog ):
3157 def __init__( self, parent ):
3158 wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = _('Translate Profile'), pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.DEFAULT_DIALOG_STYLE )
3159 self.SetSizeHints( wx.DefaultSize, wx.DefaultSize )
3160 bSizer7 = wx.BoxSizer( wx.VERTICAL )
3161 bSizer1 = wx.BoxSizer( wx.HORIZONTAL )
3162 from_lChoices = list(translation_languages.keys())
3163 from_lChoices.sort()
3164 self.from_l = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, from_lChoices, 0 )
3165 self.from_l.SetSelection( 0 )
3166 bSizer1.Add( self.from_l, 0, wx.ALL, 5 )
3167 self.m_staticText1 = wx.StaticText( self, wx.ID_ANY, _("to"), wx.DefaultPosition, wx.DefaultSize, 0 )
3168 self.m_staticText1.Wrap( -1 )
3169 bSizer1.Add( self.m_staticText1, 0, wx.ALL, 5 )
3170 to_lChoices = from_lChoices
3171 self.to_l = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, to_lChoices, 0 )
3172 self.to_l.SetSelection( 0 )
3173 bSizer1.Add( self.to_l, 0, wx.ALL, 5 )
3174 bSizer7.Add( bSizer1, 1, wx.EXPAND, 5 )
3175 m_sdbSizer1 = wx.StdDialogButtonSizer()
3176 self.m_sdbSizer1OK = wx.Button( self, wx.ID_OK )
3177 m_sdbSizer1.AddButton( self.m_sdbSizer1OK )
3178 self.m_sdbSizer1Cancel = wx.Button( self, wx.ID_CANCEL )
3179 m_sdbSizer1.AddButton( self.m_sdbSizer1Cancel )
3180 m_sdbSizer1.Realize();
3181 bSizer7.Add( m_sdbSizer1, 1, wx.EXPAND, 5 )
3182 self.SetSizer( bSizer7 )
3185 self.Centre( wx.BOTH )
3187 def __del__( self ):
3190 def getfrom_l(self) :
3191 return translation_languages[self.from_l.GetStringSelection()]
3194 return translation_languages[self.to_l.GetStringSelection()]
3197 class MergeClusterFrame ( wx.Dialog ):
3199 def __init__( self, parent):
3200 #wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = wx.EmptyString, pos = wx.DefaultPosition, size = wx.Size( 500,438 ), style = wx.CLOSE_BOX|wx.DEFAULT_FRAME_STYLE|wx.FRAME_FLOAT_ON_PARENT|wx.STAY_ON_TOP|wx.TAB_TRAVERSAL )
3201 wx.Dialog.__init__( self, parent, id = wx.ID_ANY, title = _('Merge Clusters'), style = wx.DEFAULT_DIALOG_STYLE)
3202 self.ira = wx.GetApp().GetTopWindow()
3203 self.SetIcon(self.ira._icon)
3205 self.nameselection = {}
3207 self.SetSizeHints( wx.DefaultSize, wx.DefaultSize )
3208 bSizer1 = wx.BoxSizer( wx.VERTICAL )
3209 self.m_panel1 = wx.Panel( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
3210 self.m_panel1.SetBackgroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_WINDOW ) )
3211 fgSizer2 = wx.FlexGridSizer( 0, 2, 0, 0 )
3212 fgSizer2.SetFlexibleDirection( wx.BOTH )
3213 fgSizer2.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
3214 self.m_staticText5 = wx.StaticText( self.m_panel1, wx.ID_ANY, "Select clusters", wx.DefaultPosition, wx.DefaultSize, 0 )
3215 self.m_staticText5.Wrap( -1 )
3216 fgSizer2.Add( self.m_staticText5, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALL, 5 )
3217 self.m_staticText7 = wx.StaticText( self.m_panel1, wx.ID_ANY, "Already selected", wx.DefaultPosition, wx.DefaultSize, 0 )
3218 self.m_staticText7.Wrap( -1 )
3219 fgSizer2.Add( self.m_staticText7, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALL, 5 )
3220 self.m_treeCtrl2 = wx.TreeCtrl( self.m_panel1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TR_DEFAULT_STYLE|wx.TR_MULTIPLE )
3221 fgSizer2.Add( self.m_treeCtrl2, 5, wx.ALL|wx.EXPAND, 5 )
3222 self.m_treeCtrl2.SetMinSize( wx.Size( 350,400 ) )
3223 self.tree = self.m_treeCtrl2
3224 m_listBox4Choices = []
3225 self.m_listBox4 = wx.ListBox( self.m_panel1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, m_listBox4Choices, wx.LB_MULTIPLE )
3226 self.m_listBox4.SetMinSize( wx.Size( 350,400 ) )
3227 fgSizer2.Add( self.m_listBox4, 0, wx.ALL|wx.EXPAND, 5 )
3228 self.m_button2 = wx.Button( self.m_panel1, wx.ID_ANY, "Select", wx.DefaultPosition, wx.DefaultSize, 0 )
3229 fgSizer2.Add( self.m_button2, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
3230 self.m_button3 = wx.Button( self.m_panel1, wx.ID_ANY, "Unselect", wx.DefaultPosition, wx.DefaultSize, 0 )
3231 fgSizer2.Add( self.m_button3, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
3232 self.m_panel1.SetSizer( fgSizer2 )
3233 self.m_panel1.Layout()
3234 fgSizer2.Fit( self.m_panel1 )
3235 bSizer1.Add( self.m_panel1, 4, wx.EXPAND |wx.ALL, 5 )
3236 self.m_panel4 = wx.Panel( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
3237 bSizer5 = wx.BoxSizer( wx.HORIZONTAL )
3238 self.m_staticText13 = wx.StaticText( self.m_panel4, wx.ID_ANY, "MyLabel", wx.DefaultPosition, wx.DefaultSize, 0 )
3239 self.m_staticText13.Wrap( -1 )
3240 bSizer5.Add( self.m_staticText13, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
3241 self.m_textCtrl5 = wx.TextCtrl( self.m_panel4, wx.ID_ANY, "cl_", wx.DefaultPosition, wx.DefaultSize, 0 )
3242 self.m_textCtrl5.SetMinSize( wx.Size( 400,-1 ) )
3243 bSizer5.Add( self.m_textCtrl5, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
3244 self.m_staticText15 = wx.StaticText( self.m_panel4, wx.ID_ANY, "+cluster number", wx.DefaultPosition, wx.DefaultSize, 0 )
3245 self.m_staticText15.Wrap( -1 )
3246 bSizer5.Add( self.m_staticText15, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
3247 self.m_panel4.SetSizer( bSizer5 )
3248 self.m_panel4.Layout()
3249 bSizer5.Fit( self.m_panel4 )
3250 bSizer1.Add( self.m_panel4, 1, wx.EXPAND |wx.ALL, 5 )
3251 self.m_panel3 = wx.Panel( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
3252 bSizer4 = wx.BoxSizer( wx.HORIZONTAL )
3253 self.m_staticText12 = wx.StaticText( self.m_panel3, wx.ID_ANY, "Corpus name", wx.DefaultPosition, wx.DefaultSize, 0 )
3254 self.m_staticText12.Wrap( -1 )
3255 bSizer4.Add( self.m_staticText12, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
3256 self.m_textCtrl4 = wx.TextCtrl( self.m_panel3, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
3257 self.m_textCtrl4.SetMinSize( wx.Size( 400,-1 ) )
3258 bSizer4.Add( self.m_textCtrl4, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
3259 self.m_panel3.SetSizer( bSizer4 )
3260 self.m_panel3.Layout()
3261 bSizer4.Fit( self.m_panel3 )
3262 bSizer1.Add( self.m_panel3, 1, wx.EXPAND |wx.ALL, 5 )
3263 m_sdbSizer6 = wx.StdDialogButtonSizer()
3264 self.m_sdbSizer6OK = wx.Button( self, wx.ID_OK )
3265 m_sdbSizer6.AddButton( self.m_sdbSizer6OK )
3266 self.m_sdbSizer6Cancel = wx.Button( self, wx.ID_CANCEL )
3267 m_sdbSizer6.AddButton( self.m_sdbSizer6Cancel )
3268 m_sdbSizer6.Realize();
3269 bSizer1.Add( m_sdbSizer6, 1, wx.EXPAND, 5 )
3270 self.SetSizer( bSizer1 )
3274 self.Centre( wx.BOTH )
3276 self.m_treeCtrl2.Bind( wx.EVT_TREE_ITEM_ACTIVATED, self.OnItemSelect )
3277 self.m_treeCtrl2.Bind(wx.EVT_TREE_SEL_CHANGED, self.OnItemActivated )
3278 self.m_treeCtrl2.Bind( wx.EVT_TREE_ITEM_EXPANDED, self.OnItemActivated )
3279 self.m_listBox4.Bind( wx.EVT_LEFT_DCLICK, self.OnUnSelect )
3280 self.m_button3.Bind( wx.EVT_BUTTON, self.OnUnSelect )
3281 #self.Bind(wx.EVT_SIZE, self.OnSize)
3284 def __del__( self ):
3287 def feedtree( self ):
3289 il = wx.ImageList(isz[0], isz[1])
3293 #corpusidx = il.Add(wx.ArtProvider.GetBitmap(wx.ART_FOLDER, wx.ART_OTHER, isz))
3294 #fldropenidx = il.Add(wx.ArtProvider.GetBitmap(wx.ART_FOLDER_OPEN, wx.ART_OTHER, isz))
3295 #fileidx = il.Add(wx.ArtProvider.GetBitmap(wx.ART_NORMAL_FILE, wx.ART_OTHER, isz))
3296 #smileidx = il.Add(images.Smiles.GetBitmap())
3297 #self.selectidx = il.Add(wx.ArtProvider.GetBitmap(wx.ART_TICK_MARK, wx.ART_OTHER, isz))
3298 for img in self.ira.images_analyses :
3299 self.ild[img] = self.il.Add(self.ira.images_analyses[img])
3300 self.ild['selected'] = il.Add(wx.ArtProvider.GetBitmap(wx.ART_TICK_MARK, wx.ART_OTHER, isz))
3301 #self.SetImageList(self.il)
3302 self.tree.SetImageList(il)
3304 history = self.ira.tree.history
3305 self.tree.root = self.tree.AddRoot("Corpus")
3306 self.tree.SetItemImage(self.tree.root, self.ild['textroot'], wx.TreeItemIcon_Normal)
3307 self.tree.SetItemImage(self.tree.root, self.ild['textroot'], wx.TreeItemIcon_Expanded)
3308 self.tree.SetPyData(self.tree.root, {'root':"root"})
3309 for corpus in reversed(history.history) :
3310 if 'analyses' in corpus :
3311 for analyse in corpus['analyses'] :
3312 if analyse['type'] == 'alceste' :
3313 if corpus['uuid'] not in self.intree :
3314 child = self.tree.Append(self.tree.root, corpus['corpus_name'])
3315 self.tree.SetItemImage(child, self.ild['corpus'], wx.TreeItemIcon_Normal)
3316 self.tree.SetItemImage(child, self.ild['corpus'], wx.TreeItemIcon_Expanded)
3317 self.tree.SetPyData(child, corpus)
3318 self.intree[corpus['uuid']] = corpus
3319 last = self.tree.Append(child, analyse['name'])
3320 self.tree.SetItemImage(last, self.ild['reinert'], wx.TreeItemIcon_Normal)
3321 self.tree.SetItemImage(last, self.ild['reinert'], wx.TreeItemIcon_Expanded)
3323 self.tree.SetPyData(last, analyse)
3325 parametres = DoConf(analyse['ira']).getoptions()
3326 clnb = int(parametres['clnb'])
3327 for i in range(clnb) :
3328 cl = self.tree.Append(last, 'classe %i' % (i+1))
3329 self.tree.SetItemImage(cl, self.ild['wordcloud'], wx.TreeItemIcon_Normal)
3330 self.tree.SetItemImage(cl, self.ild['wordcloud'], wx.TreeItemIcon_Expanded)
3331 self.tree.SetPyData(cl, {'type' : 'cluster', 'analyse': analyse['uuid'], 'number': i+1, 'corpus': analyse['corpus'], 'ira':analyse['ira']})
3335 def OnItemSelect( self, event ):
3336 item = event.GetItem()
3338 pydata = self.tree.GetPyData(item)
3339 if pydata.get('type', '') == 'cluster' :
3340 if (pydata['analyse'], pydata['corpus'], pydata['number']) not in self.selected :
3341 text = self.m_textCtrl5.GetValue() + '%03d' % pydata['number']
3342 if text in self.nameselection :
3343 dlg = wx.MessageDialog(self, 'This name: %s - is already use' % text, 'Problem', wx.OK | wx.ICON_ERROR)
3347 self.m_listBox4.Append(text)
3348 self.selected[(pydata['analyse'], pydata['corpus'], pydata['number'])] = self.m_textCtrl5.GetValue() + '%03d' % pydata['number']
3349 self.items[(pydata['analyse'], pydata['corpus'], pydata['number'])] = item
3350 self.nameselection[self.m_textCtrl5.GetValue() + '%03d' % pydata['number']] = (pydata['analyse'], pydata['corpus'], pydata['number'])
3351 self.irapath[pydata['analyse']] = pydata['ira']
3352 self.tree.SetItemImage(item, self.ild['selected'])
3355 def OnItemActivated(self, event) :
3356 item = event.GetItem()
3358 pydata = self.tree.GetPyData(item)
3359 if pydata.get('type', '') == 'alceste' :
3360 self.m_textCtrl5.SetValue('cl_' + pydata['name'])
3362 # Virtual event handlers, overide them in your derived class
3363 def OnSelect( self, event ):
3364 item = self.m_listBox3.GetSelection()
3365 text = self.m_textCtrl5.GetValue() + '%03d' % item
3366 self.m_listBox4.Append(text)
3369 def OnUnSelect( self, event ):
3370 selections = self.m_listBox4.GetSelections()
3371 selections = list(selections)
3372 selections.reverse()
3373 for val in selections :
3374 ref = self.nameselection[self.m_listBox4.GetString(val)]
3375 #item = self.getItemFromUUID(itemParent=None, uuid=ref[0])
3376 item = self.items[ref]
3377 self.tree.SetItemImage(item, self.ild['wordcloud'])
3378 del self.selected[ref]
3379 del self.nameselection[self.m_listBox4.GetString(val)]
3381 self.m_listBox4.Delete(val)
3385 class FullText ( wx.Frame ):
3387 def __init__( self, parent ):
3388 wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = wx.EmptyString, pos = wx.DefaultPosition, size = wx.Size( 500,600 ), style = wx.DEFAULT_FRAME_STYLE|wx.TAB_TRAVERSAL )
3389 self.SetSizeHints( -1, -1 )
3390 bSizer1 = wx.BoxSizer( wx.VERTICAL )
3391 self.m_panel1 = wx.Panel( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
3392 bSizer2 = wx.BoxSizer( wx.VERTICAL )
3393 self.m_htmlWin1 = wx.html.HtmlWindow( self.m_panel1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.html.HW_SCROLLBAR_AUTO )
3394 bSizer2.Add( self.m_htmlWin1, 8, wx.ALL | wx.EXPAND, 5 )
3395 #self.m_richText1 = wx.richtext.RichTextCtrl( self.m_panel1, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0|wx.VSCROLL|wx.HSCROLL|wx.NO_BORDER|wx.WANTS_CHARS )
3396 #bSizer2.Add( self.m_richText1, 9, wx.EXPAND |wx.ALL, 5 )
3397 m_sdbSizer1 = wx.StdDialogButtonSizer()
3398 self.m_sdbSizer1OK = wx.Button( self.m_panel1, wx.ID_OK )
3399 m_sdbSizer1.AddButton( self.m_sdbSizer1OK )
3400 self.m_sdbSizer1Cancel = wx.Button( self.m_panel1, wx.ID_CANCEL )
3401 m_sdbSizer1.AddButton( self.m_sdbSizer1Cancel )
3402 m_sdbSizer1.Realize();
3403 bSizer2.Add( m_sdbSizer1, 0, wx.EXPAND, 5 )
3404 self.m_panel1.SetSizer( bSizer2 )
3405 self.m_panel1.Layout()
3406 bSizer2.Fit( self.m_panel1 )
3407 bSizer1.Add( self.m_panel1, 1, wx.EXPAND |wx.ALL, 5 )
3408 self.SetSizer( bSizer1 )
3410 self.Centre( wx.BOTH )
3412 def __del__( self ):