2 # -*- coding: utf-8 -*-
3 #Author: Pierre Ratinaud
4 #Copyright (c) 2008-2009 Pierre Ratinaud
8 import wx.lib.colourselect as csel
9 import wx.lib.sized_controls as sc
10 import wx.lib.filebrowsebutton as filebrowse
12 from functions import DoConf, exec_rcode, translation_languages
14 from shutil import copyfile
15 from PrintRScript import barplot, ChronoChi2Script, ChronoPropScript, ChronoggScript
18 from KeyFrame import AlcOptFrame
19 import wx.lib.hyperlink as hl
21 #---------------------------------------------------------------------------
22 provider = wx.SimpleHelpProvider()
23 wx.HelpProvider_Set(provider)
25 #---------------------------------------------------------------------------
28 encodages = [[u'cp1252',u'Western Europe'], [u'utf-8',u'all languages'], [u'MacRoman',u'Western Europe'], [u'ascii', u'English'], [u'big5', u'Traditional Chinese'], [u'big5hkscs', u'Traditional Chinese'], [u'cp037', u'English'], [u'cp424', u'Hebrew'], [u'cp437', u'English'], [u'cp500', u'Western Europe'], [u'cp737', u'Greek'], [u'cp775', u'Baltic languages'], [u'cp850', u'Western Europe'], [u'cp852', u'Central and Eastern Europe'], [u'cp855', u'Bulg, Byelorus, Mace, Rus, Serb'], [u'cp856', u'Hebrew'], [u'cp857', u'Turkish'], [u'cp860', u'Portuguese'], [u'cp861', u'Icelandic'], [u'cp862', u'Hebrew'], [u'cp863', u'Canadian'], [u'cp864', u'Arabic'], [u'cp865', u'Danish, Norwegian'], [u'cp866', u'Russian'], [u'cp869', u'Greek'], [u'cp874', u'Thai'], [u'cp875', u'Greek'], [u'cp932', u'Japanese'], [u'cp949', u'Korean'], [u'cp950', u'Traditional Chinese'], [u'cp1006', u'Urdu'], [u'cp1026', u'Turkish'], [u'cp1140', u'Western Europe'], [u'cp1250', u'Central and Eastern Europe'], [u'cp1251', u'Bulg, Byelorus, Mace, Rus, Serb'], [u'cp1253', u'Greek'], [u'cp1254', u'Turkish'], [u'cp1255', u'Hebrew'], [u'cp1256', u'Arabic'], [u'cp1257', u'Baltic languages'], [u'cp1258', u'Vietnamese'], [u'euc_jp', u'Japanese'], [u'euc_jis_2004', u'Japanese'], [u'euc_jisx0213', u'Japanese'], [u'euc_kr', u'Korean'], [u'gb2312', u'Simplified Chinese'], [u'gbk', u'Unified Chinese'], [u'gb18030', u'Unified Chinese'], [u'hz', u'Simplified Chinese'], [u'iso2022_jp', u'Japanese'], [u'iso2022_jp_1', u'Japanese'], [u'iso2022_jp_2', u'Jp, K, S C, WE, G'], [u'iso2022_jp_2004', u'Japanese'], [u'iso2022_jp_3', u'Japanese'], [u'iso2022_jp_ext', u'Japanese'], [u'iso2022_kr', u'Korean'], [u'latin_1', u'West Europe'], [u'iso8859_2', u'Central and Eastern Europe'], [u'iso8859_3', u'Esperanto, Maltese'], [u'iso8859_4', u'Baltic languages'], [u'iso8859_5', u'Bulg, Byelorus, Mace, Rus, Serb'], [u'iso8859_6', u'Arabic'], [u'iso8859_7', u'Greek'], [u'iso8859_8', u'Hebrew'], [u'iso8859_9', u'Turkish'], [u'iso8859_10', u'Nordic languages'], [u'iso8859_13', u'Baltic languages'], [u'iso8859_14', u'Celtic languages'], [u'iso8859_15', u'Western Europe'], [u'iso8859_16', u'South-Eastern Europe'], [u'johab', u'Korean'], [u'koi8_r', u'Russian'], [u'koi8_u', u'Ukrainian'], [u'mac_cyrillic', u'Bulg, Byelorus, Mace, Rus, Serb'], [u'mac_greek', u'Greek'], [u'mac_iceland', u'Icelandic'], [u'mac_latin2', u'Central and Eastern Europe'], [u'mac_turkish', u'Turkish'], [u'ptcp154', u'Kazakh'], [u'shift_jis', u'Japanese'], [u'shift_jis_2004', u'Japanese'], [u'shift_jisx0213', u'Japanese'], [u'utf_32', u'all languages'], [u'utf_32_be', u'all languages'], [u'utf_32_le', u'all languages'], [u'utf_16', u'all languages'], [u'utf_16_be', u'all languages (BMP only)'], [u'utf_16_le', u'all languages (BMP only)'], [u'utf_7', u'all languages'], [u'utf_8_sig', u'all languages']]
30 class FileOptionDialog(wx.Dialog):
32 self, parent, ID, title, sep=False, sheet = False, size=wx.DefaultSize, pos=wx.DefaultPosition,
33 style=wx.DEFAULT_DIALOG_STYLE
37 pre.SetExtraStyle(wx.DIALOG_EX_CONTEXTHELP)
38 pre.Create(parent, ID, title, pos, size, style)
42 sizer = wx.BoxSizer(wx.VERTICAL)
43 grid_sizer = wx.FlexGridSizer(0, 2, 2, 2)
44 ##############################
46 label = wx.StaticText(self, -1, _(u"First line is header").decode('utf8'))
47 label.SetHelpText(_(u"First line is header").decode('utf8'))
48 grid_sizer.Add(label, 0, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
49 on = [ _(u"yes").decode('utf8'), _(u"no").decode('utf8') ]
50 self.radio_box_1 = wx.RadioBox(self, -1, u"", choices=on, majorDimension=0, style=wx.RA_SPECIFY_ROWS)
51 self.radio_box_1.SetHelpText(_(u"First line is header").decode('utf8'))
52 grid_sizer.Add(self.radio_box_1, 1, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
54 ##############################
56 label = wx.StaticText(self, -1, _(u"First column is an id").decode('utf8'))
57 label.SetHelpText(_(u"First column is an id").decode('utf8'))
58 grid_sizer.Add(label, 0, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
59 on = [ _(u"yes").decode('utf8'), _(u"no").decode('utf8') ]
60 self.radio_box_2 = wx.RadioBox(self, -1, u"", choices=on, majorDimension=0, style=wx.RA_SPECIFY_ROWS)
61 self.radio_box_2.SetHelpText(_(u"First column is an id").decode('utf8'))
62 grid_sizer.Add(self.radio_box_2, 1, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
64 ##############################
66 label = wx.StaticText(self, -1, _(u"Column separator").decode('utf8'))
67 label.SetHelpText(_(u"Column separator").decode('utf8'))
68 grid_sizer.Add(label, 0, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
69 self.colsep = [";", "tabulation", ","]
70 self.choice3 = wx.Choice(self, -1, (100, 50), choices=self.colsep)
71 self.choice3.SetHelpText(_(u"Column separator").decode('utf8'))
72 grid_sizer.Add(self.choice3, 1, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
74 ##############################
76 label = wx.StaticText(self, -1, _(u"Text separator").decode('utf8'))
77 label.SetHelpText(_(u"Text separator").decode('utf8'))
78 grid_sizer.Add(label, 0, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
79 self.txtsep = ["\"", "'"]
80 self.choice4 = wx.Choice(self, -1, (100, 50), choices=self.txtsep)
81 self.choice4.SetHelpText(_(u"Text separator").decode('utf8'))
82 grid_sizer.Add(self.choice4, 1, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
83 self.choice3.SetSelection(0)
84 self.choice4.SetSelection(0)
85 self.text = wx.StaticText(self, -1, _(u"Characters set").decode('utf8'))
86 grid_sizer.Add(self.text, 1, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
87 self.le = [enc[0].lower() for enc in encodages]
88 self.list_encodages = wx.Choice(self, -1, (25, 30), choices=[' - '.join(encodage) for encodage in encodages])
89 if locale.getpreferredencoding().lower() == 'mac-roman' :
90 enc = self.le.index('macroman')
93 enc = self.le.index(sys.getdefaultencoding().lower())
95 enc = self.le.index('utf-8')
96 self.list_encodages.SetSelection(enc)
97 grid_sizer.Add(self.list_encodages, 1, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
99 label = wx.StaticText(self, -1, u"Feuille ")
100 grid_sizer.Add(label, 0, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
101 self.spin1 = wx.SpinCtrl(self, -1, '',size = wx.DefaultSize, min=1, max=500)
102 grid_sizer.Add(self.spin1, 1, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
104 sizer.Add(grid_sizer, 0, wx.GROW | wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5)
107 line = wx.StaticLine(self, -1, size=(20, -1), style=wx.LI_HORIZONTAL)
108 sizer.Add(line, 0, wx.GROW | wx.ALIGN_CENTER_VERTICAL | wx.RIGHT | wx.TOP, 5)
110 btnsizer = wx.StdDialogButtonSizer()
112 if wx.Platform != "__WXMSW__":
113 btn = wx.ContextHelpButton(self)
114 btnsizer.AddButton(btn)
116 btn = wx.Button(self, wx.ID_OK)
118 btnsizer.AddButton(btn)
120 btn = wx.Button(self, wx.ID_CANCEL)
121 btnsizer.AddButton(btn)
124 sizer.Add(btnsizer, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_CENTER_HORIZONTAL, 5)
130 class ClusterNbDialog(wx.Dialog):
132 self, LIST_CLASSE, parent, ID, title, size=wx.DefaultSize, pos=wx.DefaultPosition,
133 style=wx.DEFAULT_DIALOG_STYLE
137 pre.SetExtraStyle(wx.DIALOG_EX_CONTEXTHELP)
138 pre.Create(parent, ID, title, pos, size, style)
142 # Now continue with the normal construction of the dialog
144 sizer = wx.BoxSizer(wx.VERTICAL)
146 label = wx.StaticText(self, -1, u"Résultats de la classification")
147 label.SetHelpText("This is the help text for the label")
148 sizer.Add(label, 0, wx.ALIGN_CENTRE | wx.ALL, 5)
150 box = wx.BoxSizer(wx.HORIZONTAL)
152 label = wx.StaticText(self, -1, u"Choisissez le nombre de classes")
153 label.SetHelpText("This is the help text for the label")
154 box.Add(label, 0, wx.ALIGN_CENTRE | wx.ALL, 5)
156 if type(LIST_CLASSE) != float :
157 for i in LIST_CLASSE :
158 LIST_CLASSE_OK.append(str(i))
160 LIST_CLASSE_OK.append(str(LIST_CLASSE))
161 self.list_box_1 = wx.ListBox(self, -1, choices=LIST_CLASSE_OK, style=wx.LB_SINGLE | wx.LB_HSCROLL)
162 self.list_box_1.SetHelpText("Here's some help text for field #1")
163 box.Add(self.list_box_1, 1, wx.ALIGN_CENTRE | wx.ALL, 5)
165 sizer.Add(box, 0, wx.GROW | wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5)
168 ###############################
169 line = wx.StaticLine(self, -1, size=(20, -1), style=wx.LI_HORIZONTAL)
170 sizer.Add(line, 0, wx.GROW | wx.ALIGN_CENTER_VERTICAL | wx.RIGHT | wx.TOP, 5)
172 btnsizer = wx.StdDialogButtonSizer()
174 if wx.Platform != "__WXMSW__":
175 btn = wx.ContextHelpButton(self)
176 btnsizer.AddButton(btn)
178 btn = wx.Button(self, wx.ID_OK)
180 btnsizer.AddButton(btn)
182 btn = wx.Button(self, wx.ID_CANCEL)
183 btnsizer.AddButton(btn)
186 sizer.Add(btnsizer, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5)
191 class CHDDialog(wx.Dialog):
193 self, parent, ID, title, size=wx.DefaultSize, pos=wx.DefaultPosition,
194 style=wx.DEFAULT_DIALOG_STYLE | wx.CANCEL
197 pre.SetExtraStyle(wx.DIALOG_EX_CONTEXTHELP)
198 pre.Create(parent, ID, title, pos, size, style)
202 self.colsep = parent.colsep
204 self.content = parent.content[:]
205 self.header = parent.header[:]
207 for i in self.header:
209 LABELLIST.append(i[0:60])
212 self.LABELLISTTOT = LABELLIST
214 #----------------------------------------------------------------------------------------------------
215 self.text1 = wx.StaticText(self, -1, u"Variables Actives (au moins 3)")
216 self.text2 = wx.StaticText(self, -1, u"Variables Supplémentaires (au moins 1)")
217 self.list_box_1 = wx.ListBox(self, -1, choices=LABELLIST, style=wx.LB_EXTENDED | wx.LB_HSCROLL)
218 self.list_box_2 = wx.ListBox(self, -1, choices=LABELLIST, style=wx.LB_EXTENDED | wx.LB_HSCROLL)
219 self.button_cancel = wx.Button(self, wx.ID_CANCEL)
220 self.button_back = wx.Button(self, wx.ID_BACKWARD)
221 self.button_forw = wx.Button(self, wx.ID_FORWARD)
222 self.button_ok = wx.Button(self, wx.ID_OK)
223 self.button_pref = wx.Button(self, wx.ID_PROPERTIES)
224 self.button_selectall = wx.Button(self, wx.NewId(), u"Sélectionner tout")
225 self.__set_properties()
228 self.Bind(wx.EVT_BUTTON, self.OnPrec, self.button_back)
229 self.Bind(wx.EVT_BUTTON, self.OnSuivant, self.button_forw)
230 self.Bind(wx.EVT_BUTTON, self.OnValider, self.button_ok)
231 self.Bind(wx.EVT_BUTTON, self.OnSelectAll, self.button_selectall)
234 self.TEMPDIR = parent.TEMPDIR
237 def __set_properties(self):
238 # begin wxGlade: ConfChi2.__set_properties
239 self.SetTitle(u"Sélection des variables")
240 self.list_box_2.Enable(False)
241 self.button_ok.Enable(False)
242 self.button_back.Enable(False)
245 def __do_layout(self):
246 # begin wxGlade: ConfChi2.__do_layout
247 sizer_1 = wx.BoxSizer(wx.VERTICAL)
248 sizer_2 = wx.BoxSizer(wx.VERTICAL)
249 sizer_3 = wx.BoxSizer(wx.HORIZONTAL)
250 sizer_4 = wx.BoxSizer(wx.HORIZONTAL)
251 sizer_5 = wx.BoxSizer(wx.HORIZONTAL)
252 sizer_6 = wx.BoxSizer(wx.HORIZONTAL)
253 sizer_7 = wx.BoxSizer(wx.HORIZONTAL)
254 sizer_5.Add(self.text1, 1, wx.CENTER | wx.ALL, 0)
255 sizer_5.Add(self.text2, 1, wx.CENTER | wx.ALL, 0)
256 sizer_3.Add(self.list_box_1, 0, wx.EXPAND, 0)
257 sizer_3.Add(self.list_box_2, 0, wx.EXPAND, 0)
258 sizer_6.Add(self.button_selectall, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL, 0)
259 sizer_7.Add(self.button_cancel, 0, wx.ALL, 0)
260 sizer_7.Add(self.button_pref, 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
261 sizer_7.Add(self.button_ok, 0, wx.wx.ALIGN_CENTER_HORIZONTAL, 0)
262 sizer_4.Add(self.button_back, 0, wx.ALL, 0)
263 sizer_4.Add(self.button_forw, 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
264 sizer_2.Add(sizer_5, 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
265 sizer_2.Add(sizer_3, 1, wx.EXPAND, 0)
266 sizer_2.Add(sizer_6, 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
267 sizer_2.Add(sizer_4, 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
268 sizer_2.Add(sizer_7, 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
269 sizer_1.Add(sizer_2, 1, wx.EXPAND, 4)
270 self.SetSizer(sizer_1)
274 #--------------FIXME-----------------------
275 #NETTOYAGE des variables inutiles
276 def OnSuivant(self, event):
277 LISTACTIVE = self.list_box_1.GetSelections()
278 if len(LISTACTIVE) != len(self.LABELLISTTOT) and len(LISTACTIVE) >= 3:
279 self.button_ok.Enable(True)
281 self.LISTHEADERINDICE = []
282 self.LISTNUMACTIVE = []
284 header = self.header[:]
285 for i in range(0, len(header)):
286 self.LISTHEADERINDICE.append(i)
287 for i in LISTACTIVE :
288 self.LISTNUMACTIVE.append(i)
289 header.pop(i - COMPT)
290 self.LISTHEADERINDICE.pop(i - COMPT)
295 self.LABELLIST.append(i[0:60])
297 self.LABELLIST.append(i)
298 self.list_box_2.Clear()
299 for i in self.LABELLIST :
300 self.list_box_2.Append(i)
302 self.list_box_1.Enable(False)
303 self.list_box_2.Enable(True)
304 self.button_forw.Enable(False)
305 self.button_back.Enable(True)
307 def OnValider(self, event):
308 LISTVARSUPSEL = self.list_box_2.GetSelections()
309 for i in LISTVARSUPSEL :
310 self.LISTVARSUP.append(self.LISTHEADERINDICE[i])
313 def OnPrec(self, event):
314 self.list_box_1.Enable(True)
315 self.list_box_2.Enable(False)
316 self.button_forw.Enable(True)
317 self.button_back.Enable(False)
318 self.button_ok.Enable(False)
322 def OnSelectAll(self, event):
324 for i in range(len(self.LABELLISTTOT)):
325 self.list_box_1.Select(i)
327 for i in range(len(self.LABELLIST)):
328 self.list_box_2.Select(i)
330 class PrefDialog ( wx.Dialog ):
332 def __init__( self, parent ):
333 wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = _(u"Settings").decode('utf8'), pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.DEFAULT_DIALOG_STYLE )
336 self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
338 bSizer1 = wx.BoxSizer( wx.VERTICAL )
340 fgSizer1 = wx.FlexGridSizer( 0, 3, 0, 0 )
341 fgSizer1.SetFlexibleDirection( wx.BOTH )
342 fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
344 self.m_staticText1 = wx.StaticText( self, wx.ID_ANY, _(u"Play a sound at the end of analysis").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
345 self.m_staticText1.Wrap( -1 )
346 fgSizer1.Add( self.m_staticText1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
348 self.m_staticText2 = wx.StaticText( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
349 self.m_staticText2.Wrap( -1 )
350 fgSizer1.Add( self.m_staticText2, 0, wx.ALL, 5 )
352 m_radioBox1Choices = [ _(u"yes").decode('utf8'), _(u"no").decode('utf8') ]
353 self.m_radioBox1 = wx.RadioBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, m_radioBox1Choices, 1, wx.RA_SPECIFY_COLS )
354 self.m_radioBox1.SetSelection( 0 )
355 fgSizer1.Add( self.m_radioBox1, 0, wx.ALIGN_RIGHT|wx.ALL, 5 )
357 msg = _(u"""Check for new
358 releases at startup""").decode('utf8')
359 self.m_staticText3 = wx.StaticText( self, wx.ID_ANY, msg, wx.DefaultPosition, wx.DefaultSize, 0 )
360 self.m_staticText3.Wrap( -1 )
361 fgSizer1.Add( self.m_staticText3, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
363 self.m_staticText4 = wx.StaticText( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
364 self.m_staticText4.Wrap( -1 )
365 fgSizer1.Add( self.m_staticText4, 0, wx.ALL, 5 )
367 m_radioBox2Choices = [ _(u"yes").decode('utf8'), _(u"no").decode('utf8') ]
368 self.m_radioBox2 = wx.RadioBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, m_radioBox2Choices, 1, wx.RA_SPECIFY_COLS )
369 self.m_radioBox2.SetSelection( 0 )
370 fgSizer1.Add( self.m_radioBox2, 0, wx.ALIGN_RIGHT|wx.ALL, 5 )
372 msg = _(u"Interface language").decode('utf8')
373 self.m_staticText45 = wx.StaticText( self, wx.ID_ANY, msg, wx.DefaultPosition, wx.DefaultSize, 0 )
374 self.m_staticText45.Wrap( -1 )
375 fgSizer1.Add( self.m_staticText45, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
377 self.m_staticText46 = wx.StaticText( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
378 self.m_staticText46.Wrap( -1 )
379 fgSizer1.Add( self.m_staticText46, 0, wx.ALL, 5 )
381 self.listlangues = [ u"english",u"french", u"italian", u"portuguese", u"spanish"]
382 self.langues = wx.Choice( self, wx.ID_ANY, (200, -1), choices = self.listlangues)
383 #self.langues.SetSelection( 0 )
384 fgSizer1.Add( self.langues, 0, wx.ALIGN_RIGHT|wx.ALL, 5 )
386 msg = _(u"""Check installation
387 of R packages""").decode('utf8')
388 self.m_staticText5 = wx.StaticText( self, wx.ID_ANY, msg, wx.DefaultPosition, wx.DefaultSize, 0 )
389 self.m_staticText5.Wrap( -1 )
390 fgSizer1.Add( self.m_staticText5, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
392 self.m_staticText6 = wx.StaticText( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
393 self.m_staticText6.Wrap( -1 )
394 fgSizer1.Add( self.m_staticText6, 0, wx.ALL, 5 )
396 self.m_button1 = wx.Button( self, wx.ID_ANY, _(u"Check").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
397 fgSizer1.Add( self.m_button1, 0, wx.ALIGN_RIGHT|wx.ALL, 5 )
399 bSizer1.Add( fgSizer1, 1, wx.EXPAND, 5 )
400 if sys.platform == 'win32' :
401 bSizer2 = wx.BoxSizer( wx.HORIZONTAL )
404 memory for R""").decode('utf8')
405 self.m_staticText7 = wx.StaticText( self, wx.ID_ANY, msg, wx.DefaultPosition, wx.DefaultSize, 0 )
406 self.m_staticText7.Wrap( -1 )
407 bSizer2.Add( self.m_staticText7, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
409 self.m_checkBox1 = wx.CheckBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
410 bSizer2.Add( self.m_checkBox1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
412 self.m_spinCtrl1 = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 32, 16000, 1535 )
413 bSizer2.Add( self.m_spinCtrl1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
415 self.m_staticline7 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
416 bSizer2.Add( self.m_staticline7, 0, wx.EXPAND |wx.ALL, 5 )
418 bSizer1.Add( bSizer2, 0, wx.EXPAND, 5 )
419 self.m_checkBox1.Bind( wx.EVT_CHECKBOX, self.oncheckmem )
421 bSizer3 = wx.BoxSizer( wx.HORIZONTAL )
422 bSizer4 = wx.BoxSizer( wx.HORIZONTAL )
423 self.text8 = wx.StaticText( self, wx.ID_ANY, _(u"Use svdlibc").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
424 self.text8.Wrap( -1 )
425 fgSizer1.Add( self.text8, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
426 self.check_svdc = wx.CheckBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
427 bSizer4.Add( self.check_svdc, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
428 bSizer3.Add( bSizer4, 0, wx.EXPAND, 5 )
429 self.fbb = filebrowse.FileBrowseButton(self, -1, size=(250, -1), fileMode = 2, fileMask = '*')
430 bSizer3.Add( self.fbb, 0, wx.EXPAND, 5 )
431 self.fbb.SetLabel(_(u"Path : ").decode('utf8'))
432 fgSizer1.Add( wx.StaticText(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 ), wx.ID_ANY, wx.ALL, 5)
433 fgSizer1.Add( bSizer3, 0, wx.ALIGN_RIGHT|wx.ALL, 5 )
435 Rpath_text = wx.StaticText( self, wx.ID_ANY, _(u"R path").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
436 Rpath_text.Wrap( -1 )
437 fgSizer1.Add( Rpath_text, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
438 fgSizer1.Add( wx.StaticText(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 ), wx.ID_ANY, wx.ALL, 5)
439 self.Rpath_value = filebrowse.FileBrowseButton(self, -1, size=(350, -1), fileMode = 2, fileMask = '*')
440 self.Rpath_value.SetLabel(_(u"Path : ").decode('utf8'))
441 fgSizer1.Add( self.Rpath_value, 0, wx.ALIGN_RIGHT|wx.ALL, 5 )
443 mirror_text = wx.StaticText( self, wx.ID_ANY, _(u"Default R mirror").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
444 mirror_text.Wrap( -1 )
445 fgSizer1.Add( mirror_text, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
446 fgSizer1.Add( wx.StaticText(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 ), wx.ID_ANY, wx.ALL, 5)
447 self.mirror_value = wx.TextCtrl( self, wx.ID_ANY, u'http://cran.univ-lyon1.fr', wx.DefaultPosition, wx.Size( 300,30 ), 0 )
448 fgSizer1.Add( self.mirror_value, 0, wx.ALIGN_RIGHT|wx.ALL, 5 )
451 m_sdbSizer1 = wx.StdDialogButtonSizer()
452 self.m_sdbSizer1OK = wx.Button( self, wx.ID_OK )
453 m_sdbSizer1.AddButton( self.m_sdbSizer1OK )
454 self.m_sdbSizer1Cancel = wx.Button( self, wx.ID_CANCEL )
455 m_sdbSizer1.AddButton( self.m_sdbSizer1Cancel )
456 m_sdbSizer1.Realize()
457 bSizer1.Add( m_sdbSizer1, 0, wx.EXPAND, 5 )
459 self.SetSizer( bSizer1 )
463 self.Centre( wx.BOTH )
466 self.m_sdbSizer1OK.Bind( wx.EVT_BUTTON, self.OnValid )
467 self.m_button1.Bind( wx.EVT_BUTTON, parent.OnVerif )
468 self.check_svdc.Bind( wx.EVT_CHECKBOX, self.OnSVDC )
469 self.__set_properties()
471 def __set_properties(self):
472 self.SetTitle(_(u"Settings").decode('utf8'))
473 if self.parent.pref.getboolean('iramuteq', 'sound'): val1 = 0
475 self.m_radioBox1.SetSelection(val1)
476 if self.parent.pref.getboolean('iramuteq', 'checkupdate') : val2 = 0
478 self.m_radioBox2.SetSelection(val2)
479 self.langues.SetSelection(self.listlangues.index(self.parent.pref.get('iramuteq', 'guilanguage')))
480 if sys.platform == 'win32' :
481 if self.parent.pref.getboolean('iramuteq', 'R_mem') :
482 self.m_checkBox1.SetValue(True)
483 self.m_spinCtrl1.Enable(True)
484 self.m_spinCtrl1.SetValue(self.parent.pref.getint('iramuteq', 'R_max_mem'))
486 self.m_checkBox1.SetValue(False)
487 self.m_spinCtrl1.Enable(False)
488 if self.parent.pref.getboolean('iramuteq', 'libsvdc') :
489 self.check_svdc.SetValue(True)
490 self.fbb.SetValue(self.parent.pref.get('iramuteq', 'libsvdc_path'))
492 self.check_svdc.SetValue(False)
493 self.fbb.SetValue(self.parent.pref.get('iramuteq', 'libsvdc_path'))
494 self.fbb.Enable(False)
495 self.Rpath_value.SetValue(self.parent.PathPath.get('PATHS', 'rpath'))
496 self.mirror_value.SetValue(self.parent.pref.get('iramuteq', 'rmirror'))
498 def oncheckmem(self, evt):
499 if self.m_checkBox1.GetValue() :
500 self.m_spinCtrl1.Enable(True)
502 self.m_spinCtrl1.Enable(False)
504 def OnSVDC(self, evt):
505 if self.check_svdc.GetValue() :
506 self.fbb.Enable(True)
508 self.fbb.Enable(False)
510 def OnValid(self, event):
512 if self.m_radioBox1.GetSelection() == 0 : valsound = 'true'
513 else : valsound = 'false'
514 parent.pref.set('iramuteq', 'sound', valsound)
515 if self.m_radioBox2.GetSelection() == 0 : valcheck = 'true'
516 else : valcheck = 'false'
517 parent.pref.set('iramuteq', 'checkupdate', valcheck)
518 parent.pref.set('iramuteq', 'guilanguage', self.listlangues[self.langues.GetSelection()])
519 if sys.platform == 'win32' :
520 if self.m_checkBox1.GetValue() :
521 parent.pref.set('iramuteq', 'R_mem', 'true')
522 parent.pref.set('iramuteq', 'R_max_mem', str(self.m_spinCtrl1.GetValue()))
524 parent.pref.set('iramuteq', 'R_mem', 'false')
525 if self.check_svdc.GetValue() :
526 parent.pref.set('iramuteq', 'libsvdc', 'true')
528 parent.pref.set('iramuteq', 'libsvdc', 'false')
529 parent.pref.set('iramuteq', 'libsvdc_path', self.fbb.GetValue())
530 self.parent.pref.set('iramuteq', 'rmirror', self.mirror_value.GetValue())
531 file = open(parent.ConfigPath['preferences'], 'w')
532 parent.pref.write(file)
534 self.parent.PathPath.set('PATHS', 'rpath', self.Rpath_value.GetValue())
535 with open(self.parent.ConfigPath['path'], 'w') as f:
536 self.parent.PathPath.write(f)
539 class PrefGraph(wx.Dialog):
540 def __init__(self, parent, ID, paramgraph, title = '', size=wx.DefaultSize, pos=wx.DefaultPosition, style=wx.DEFAULT_DIALOG_STYLE):
542 pre.SetExtraStyle(wx.DIALOG_EX_CONTEXTHELP)
543 pre.Create(parent, ID, title, pos, size, style)
546 self.paramgraph=paramgraph
547 self.labeltype = wx.StaticText(self, -1, _(u"Graphic type").decode('utf8'))
548 if self.paramgraph['clnb'] <= 3 :
549 choix = [u'2D', 'web 2D']
551 choix=[u'2D' ,u'3D', 'web 2D', 'web 3D', 'Blender']
552 self.choicetype = wx.Choice(self, -1, (100,50), choices=choix)
553 self.label_format = wx.StaticText(self, -1, _(u"Picture format").decode('utf8'))
554 self.choix_format = wx.Choice(self, -1, (100,50), choices = ['png', 'svg'])
555 self.label_1 = wx.StaticText(self, -1, _(u"width").decode('utf8'))
556 self.spin1 = wx.SpinCtrl(self, -1, '',size = wx.DefaultSize, min=100, max=5000)
557 self.label_2 = wx.StaticText(self, -1, _(u"height").decode('utf8'))
558 self.spin2 = wx.SpinCtrl(self, -1, '', size = wx.DefaultSize, min=100, max=5000)
559 self.label_what = wx.StaticText(self, -1, _(u"Representation").decode('utf8'))
560 self.choice1 = wx.Choice(self, -1, (100,50), choices=[_(u"coordinates").decode('utf8'),_(u"correlations").decode('utf8')])
561 self.label_qui = wx.StaticText(self, -1, u'Variables')
562 self.choice2 = wx.Choice(self, -1, (100,50), choices=[_(u"actives").decode('utf8') ,_(u"supplementaries").decode('utf8'), _(u"stars").decode('utf8'), _(u"clusters").decode('utf8')])
563 self.label_3 = wx.StaticText(self, -1, _(u"Text size").decode('utf8'))
564 self.spin3 = wx.SpinCtrl(self, -1, '', size = wx.DefaultSize, min=1, max=20)
565 txt = _(u"Take the x first points").decode('utf8')
566 self.label_4 = wx.StaticText(self, -1, txt)
567 self.check1 = wx.CheckBox(self, -1)
568 self.spin_nb = wx.SpinCtrl(self, -1, '', size = wx.DefaultSize, min=2, max=1000)
569 txt = _(u"Take the x first points by cluster").decode('utf8')
570 self.label_chic = wx.StaticText(self, -1, txt)
571 self.check_chic = wx.CheckBox(self, -1)
572 self.spin_nbchic = wx.SpinCtrl(self, -1, '', size = wx.DefaultSize, min=2, max=1000)
573 txt = _(u"Limit points by cluster chi2").decode('utf8')
574 self.label_5 = wx.StaticText(self, -1, txt)
575 self.check2 = wx.CheckBox(self, -1)
576 self.spin_chi = wx.SpinCtrl(self, -1, '',size = wx.DefaultSize, min=2, max=1000)
577 self.label_6 = wx.StaticText(self, -1, _(u"Avoid overlay").decode('utf8'))
578 self.check3 = wx.CheckBox(self, -1)
579 txt = _(u"Text size proportional to frequency").decode('utf8')
580 self.label_7 = wx.StaticText(self, -1, txt)
581 self.check4 = wx.CheckBox(self, -1)
582 self.label_min = wx.StaticText(self, -1, 'min')
583 self.spin_min = wx.SpinCtrl(self, -1, '',size = wx.DefaultSize, min = 1, max = 100)
584 self.label_max = wx.StaticText(self, -1, 'max')
585 self.spin_max = wx.SpinCtrl(self, -1, '',size = wx.DefaultSize, min = 1, max = 100)
586 txt = _(u"Text size proportional to chi2").decode('utf8')
587 self.label_tchi = wx.StaticText(self, -1, txt)
588 self.check_tchi = wx.CheckBox(self, -1)
589 self.label_min_tchi = wx.StaticText(self, -1, 'min')
590 self.spin_min_tchi = wx.SpinCtrl(self, -1, '', size = wx.DefaultSize, min = 1, max = 100)
591 self.label_max_tchi = wx.StaticText(self, -1, 'max')
592 self.spin_max_tchi = wx.SpinCtrl(self, -1, '', size = wx.DefaultSize, min = 1, max = 100)
593 self.label_8 = wx.StaticText(self, -1, _(u"Factor x : ").decode('utf8'))
594 self.spin_f1 = wx.SpinCtrl(self, -1, '',size = wx.DefaultSize, min=1, max=self.paramgraph['clnb']-1)
595 self.label_9 = wx.StaticText(self, -1, _(u"Factor y : ").decode('utf8'))
596 self.spin_f2 = wx.SpinCtrl(self, -1, '',size = wx.DefaultSize, min=1, max=self.paramgraph['clnb']-1)
597 self.label_f3 = wx.StaticText(self, -1, _(u"Factor z : ").decode('utf8'))
598 self.spin_f3 = wx.SpinCtrl(self, -1, '',size = wx.DefaultSize, min=1, max=self.paramgraph['clnb']-1)
599 self.label_sphere = wx.StaticText(self, -1, _(u"Spheres transparency").decode('utf8'))
600 self.slider_sphere = wx.Slider(self, -1, 10, 1, 100, size = (255,-1), style = wx.SL_HORIZONTAL | wx.SL_AUTOTICKS | wx.SL_LABELS)
602 self.label_film = wx.StaticText(self, -1, _(u"Make a movie").decode('utf8'))
603 self.film = wx.CheckBox(self, -1)
605 self.btnsizer = wx.StdDialogButtonSizer()
606 if wx.Platform != "__WXMSW__":
607 btn = wx.ContextHelpButton(self)
608 self.btnsizer.AddButton(btn)
609 btn = wx.Button(self, wx.ID_OK)
611 self.btnsizer.AddButton(btn)
612 btn = wx.Button(self, wx.ID_CANCEL)
613 self.btnsizer.AddButton(btn)
614 self.btnsizer.Realize()
616 self.Bind(wx.EVT_CHECKBOX, self.OnCheck1, self.check1)
617 self.Bind(wx.EVT_CHECKBOX, self.OnCheck2, self.check2)
618 self.Bind(wx.EVT_CHECKBOX, self.OnNorm, self.check4)
619 self.Bind(wx.EVT_CHECKBOX, self.OnCheckTchi, self.check_tchi)
620 self.Bind(wx.EVT_CHOICE, self.On3D, self.choicetype)
621 self.Bind(wx.EVT_CHOICE, self.OnPass, self.choice2)
622 self.Bind(wx.EVT_CHECKBOX, self.OnCheckChic, self.check_chic)
623 self.__set_properties()
624 self.OnNorm(wx.EVT_CHECKBOX)
625 self.OnCheckTchi(wx.EVT_CHECKBOX)
628 def __set_properties(self):
629 self.choicetype.SetSelection(self.paramgraph['typegraph'])
630 if self.paramgraph['typegraph'] == 0 or self.paramgraph['typegraph'] == 2:
631 self.film.Enable(False)
632 self.spin_f3.Enable(False)
633 self.slider_sphere.Enable(False)
634 self.choix_format.SetSelection(self.paramgraph['svg'])
635 self.choice1.SetSelection(self.paramgraph['what'])
636 self.choice2.SetSelection(self.paramgraph['qui'])
637 self.spin_chi.SetValue(self.paramgraph['select_nb'])
638 self.spin_nb.SetValue(self.paramgraph['select_chi'])
639 self.spin1.SetValue(self.paramgraph['width'])
640 self.spin2.SetValue(self.paramgraph['height'])
641 self.spin3.SetValue(self.paramgraph['taillecar'])
642 self.spin_nb.SetValue(self.paramgraph['select_nb'])
643 self.spin_chi.SetValue(self.paramgraph['select_chi'])
644 self.spin_nbchic.SetValue(self.paramgraph['nbchic'])
645 self.check1.SetValue(self.paramgraph['do_select_nb'])
646 self.check2.SetValue(self.paramgraph['do_select_chi'])
647 self.check_chic.SetValue(self.paramgraph['do_select_chi_classe'])
648 self.check3.SetValue(self.paramgraph['over'])
649 if self.paramgraph['do_select_nb'] :
650 self.spin_nb.Enable(True)
651 self.spin_chi.Enable(False)
652 self.spin_nbchic.Enable(False)
653 elif self.paramgraph['do_select_chi_classe'] :
654 self.spin_nb.Enable(False)
655 self.spin_chi.Enable(False)
656 self.spin_nbchic.Enable(True)
657 elif self.paramgraph['do_select_chi'] :
658 self.spin_nb.Enable(False)
659 self.spin_chi.Enable(True)
660 self.spin_nbchic.Enable(False)
662 self.spin_nb.Enable(False)
663 self.spin_chi.Enable(False)
664 self.spin_nbchic.Enable(False)
667 self.check4.SetValue(self.paramgraph['cex_txt'])
668 self.spin_min.SetValue(self.paramgraph['txt_min'])
669 self.spin_max.SetValue(self.paramgraph['txt_max'])
670 self.check_tchi.SetValue(self.paramgraph['tchi'])
671 self.spin_min_tchi.SetValue(self.paramgraph['tchi_min'])
672 self.spin_max_tchi.SetValue(self.paramgraph['tchi_max'])
674 self.spin_f1.SetValue(self.paramgraph['facteur'][0])
675 self.spin_f2.SetValue(self.paramgraph['facteur'][1])
676 self.spin_f3.SetValue(self.paramgraph['facteur'][2])
677 self.slider_sphere.SetValue(self.paramgraph['alpha'])
679 def __do_layout(self):
680 sizer_2 = wx.BoxSizer(wx.VERTICAL)
681 fsizer = wx.FlexGridSizer(0,2,0,5)
682 grid_min = wx.FlexGridSizer(0, 2, 0, 0)
683 grid_max = wx.FlexGridSizer(0, 2, 0, 0)
684 grid_minmax = wx.FlexGridSizer(0, 2, 0, 0)
685 grid_min_tchi = wx.FlexGridSizer(0, 2, 0, 0)
686 grid_max_tchi = wx.FlexGridSizer(0, 2, 0, 0)
687 grid_minmax_tchi = wx.FlexGridSizer(0, 2, 0, 0)
689 sizer_3 = wx.BoxSizer(wx.VERTICAL)
691 fsizer.Add(self.labeltype, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
692 fsizer.Add(self.choicetype, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
693 fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
694 fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
696 fsizer.Add(self.label_format, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
697 fsizer.Add(self.choix_format, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
698 fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
699 fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
701 fsizer.Add(self.label_what, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
702 fsizer.Add(self.choice1, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
703 fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
704 fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
706 fsizer.Add(self.label_qui, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
707 fsizer.Add(self.choice2, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
708 fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
709 fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
711 sizer_h1 = wx.BoxSizer(wx.HORIZONTAL)
712 sizer_h1.Add(self.label_1, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
713 sizer_h1.Add(self.spin1, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
714 fsizer.Add(sizer_h1, 0, wx.ALL, 5)
715 sizer_h2 = wx.BoxSizer(wx.HORIZONTAL)
716 sizer_h2.Add(self.label_2, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
717 sizer_h2.Add(self.spin2, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
718 fsizer.Add(sizer_h2, 0, wx.ALL, 5)
719 fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
720 fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
722 fsizer.Add(self.label_3, 0, wx.ALL | wx.LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
723 fsizer.Add(self.spin3, 0, wx.ALL | wx.LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
724 fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
725 fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
727 fsizer.Add(self.label_4, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
728 sizer_nb = wx.BoxSizer(wx.HORIZONTAL)
729 sizer_nb.Add(self.check1, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
730 sizer_nb.Add(self.spin_nb, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
731 fsizer.Add(sizer_nb, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
732 fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
733 fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
735 fsizer.Add(self.label_chic, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
736 sizer_nbchic = wx.BoxSizer(wx.HORIZONTAL)
737 sizer_nbchic.Add(self.check_chic, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
738 sizer_nbchic.Add(self.spin_nbchic, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
739 fsizer.Add(sizer_nbchic, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
740 fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
741 fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
743 fsizer.Add(self.label_5, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
744 sizer_chi = wx.BoxSizer(wx.HORIZONTAL)
745 sizer_chi.Add(self.check2, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
746 sizer_chi.Add(self.spin_chi, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
747 fsizer.Add(sizer_chi, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
748 fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
749 fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
751 fsizer.Add(self.label_6, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL| wx.ADJUST_MINSIZE, 5)
752 fsizer.Add(self.check3, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 5)
753 fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
754 fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
756 sizer_2.Add(fsizer, 0, wx.EXPAND, 0)
758 bsizer_1 = wx.FlexGridSizer(0,3,0,0)
759 bsizer_1.Add(self.label_7, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
760 bsizer_1.Add(self.check4, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL|wx.EXPAND, 5)
761 grid_min.Add(self.label_min, 0,wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
762 grid_min.Add(self.spin_min, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
763 grid_max.Add(self.label_max, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
764 grid_max.Add(self.spin_max, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
765 grid_minmax.Add(grid_min, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
766 grid_minmax.Add(grid_max, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
768 bsizer_1.Add(grid_minmax, 0, wx.ALL, 5)
770 bsizer_1.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
771 bsizer_1.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
772 bsizer_1.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
774 bsizer_1.Add(self.label_tchi, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
775 bsizer_1.Add(self.check_tchi, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL|wx.EXPAND, 5)
776 grid_min_tchi.Add(self.label_min_tchi, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
777 grid_min_tchi.Add(self.spin_min_tchi, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
778 grid_max_tchi.Add(self.label_max_tchi, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
779 grid_max_tchi.Add(self.spin_max_tchi, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
780 grid_minmax_tchi.Add(grid_min_tchi, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
781 grid_minmax_tchi.Add(grid_max_tchi, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
783 bsizer_1.Add(grid_minmax_tchi, 0, wx.ALL, 5)
784 sizer_2.Add(bsizer_1, 0, wx.EXPAND, 5)
786 sizer_2.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
788 sizer_f = wx.BoxSizer(wx.HORIZONTAL)
789 sizer_f.Add(self.label_8, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
790 sizer_f.Add(self.spin_f1, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
792 sizer_f.Add(self.label_9, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
793 sizer_f.Add(self.spin_f2, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
795 sizer_f.Add(self.label_f3, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
796 sizer_f.Add(self.spin_f3, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
797 sizer_2.Add(sizer_f, 0, wx.EXPAND, 5)
799 sizer_2.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 5)
801 fsizer2 = wx.FlexGridSizer(0,2,0,0)
802 fsizer2.Add(self.label_sphere, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
803 fsizer2.Add(self.slider_sphere, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
804 fsizer2.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
805 fsizer2.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
807 fsizer2.Add(self.label_film, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
808 fsizer2.Add(self.film, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
809 sizer_2.Add(fsizer2, 0, wx.EXPAND, 5)
810 sizer_2.Add(self.btnsizer, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_CENTER_HORIZONTAL, 5)
811 self.SetSizer(sizer_2)
815 def OnCheck1(self, event):
816 if self.check1.GetValue() :
817 self.check2.SetValue(False)
818 self.check_chic.SetValue(False)
819 self.spin_chi.Enable(False)
820 self.spin_nb.Enable(True)
821 self.spin_nbchic.Enable(False)
823 self.spin_nb.Enable(False)
825 def OnCheck2(self, event):
826 if self.check2.GetValue() :
827 self.check1.SetValue(False)
828 self.check_chic.SetValue(False)
829 self.spin_chi.Enable(True)
830 self.spin_nb.Enable(False)
831 self.spin_nbchic.Enable(False)
833 self.spin_chi.Enable(False)
835 def OnCheckChic(self, event) :
836 if self.check_chic.GetValue() :
837 self.check1.SetValue(False)
838 self.check2.SetValue(False)
839 self.spin_chi.Enable(False)
840 self.spin_nb.Enable(False)
841 self.spin_nbchic.Enable(True)
843 self.spin_nbchic.Enable(False)
845 def OnNorm(self, event):
846 if not self.check4.GetValue() :
847 self.spin_min.Disable()
848 self.spin_max.Disable()
850 self.spin_min.Enable(True)
851 self.spin_max.Enable(True)
852 self.check_tchi.SetValue(False)
853 self.OnCheckTchi(wx.EVT_CHECKBOX)
855 def OnCheckTchi(self, evt) :
856 if not self.check_tchi.GetValue() :
857 self.spin_min_tchi.Disable()
858 self.spin_max_tchi.Disable()
860 self.spin_min_tchi.Enable(True)
861 self.spin_max_tchi.Enable(True)
862 self.check4.SetValue(False)
863 self.OnNorm(wx.EVT_CHECKBOX)
865 def On3D(self, event) :
866 if event.GetString() == u'3D' :
867 self.film.Enable(True)
868 self.spin_f3.Enable(True)
869 self.slider_sphere.Enable(True)
871 self.film.Enable(False)
872 self.spin_f3.Enable(False)
873 self.slider_sphere.Enable(False)
875 def OnPass(self,evt) :
876 if evt.GetString() == _(u"clusters").decode('utf8') :
877 self.check4.SetValue(False)
878 self.check4.Enable(False)
879 self.OnNorm(wx.EVT_CHECKBOX)
884 class SelectColDial ( wx.Dialog ):
886 def __init__( self, parent ):
887 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.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
891 self.bSizer2 = wx.BoxSizer( wx.VERTICAL )
893 #self.m_checkList2 = wx.CheckListBox( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, ['r','t','y'], 0 )
894 #bSizer2.Add( self.m_checkList2, 2, wx.ALL|wx.EXPAND, 5 )
896 self.m_sdbSizer2 = wx.StdDialogButtonSizer()
897 self.m_sdbSizer2OK = wx.Button( self, wx.ID_CANCEL)
898 self.butok = wx.Button( self, wx.ID_OK)
899 #m_sdbSizer2.AddButton( self.m_sdbSizer2OK )
900 #self.m_sdbSizer2Cancel = wx.Button( self, wx.ID_CANCEL )
901 #m_sdbSizer2.AddButton( self.m_sdbSizer2Cancel )
902 #m_sdbSizer2.Realize();
903 #self.bSizer2.Add( m_sdbSizer2, 0, wx.EXPAND, 5 )
905 self.SetSizer( self.bSizer2 )
908 self.Centre( wx.BOTH )
913 class PrefExport(wx.Dialog):
914 def __init__(self, parent, *args, **kwds):
915 kwds['style'] = wx.OK|wx.DEFAULT_DIALOG_STYLE
916 wx.Dialog.__init__(self, *args, **kwds)
919 sizer = wx.BoxSizer(wx.VERTICAL)
920 box = wx.BoxSizer(wx.HORIZONTAL)
921 box3 = wx.BoxSizer(wx.HORIZONTAL)
922 self.label_lem = wx.StaticText(self, -1, _(u"Lemmatised corpus").decode('utf8'))
923 box3.Add(self.label_lem, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
924 self.radio_lem = wx.RadioBox(self, -1, u"", choices= [ _(u"yes").decode('utf8'), _(u"no").decode('utf8') ], majorDimension=0, style=wx.RA_SPECIFY_ROWS)
925 box3.Add(self.radio_lem, 0, wx.ALIGN_RIGHT, 5)
926 sizer.Add(box3, 0, wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5)
927 self.label_txt = wx.StaticText(self, -1, _(u"Export for ...").decode('utf8'))
928 box.Add(self.label_txt, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
929 self.radio_type = wx.RadioBox(self, -1, u"", choices=['IRaMuTeQ/ALCESTE', 'Lexico'], majorDimension=0, style=wx.RA_SPECIFY_ROWS)
930 box.Add(self.radio_type, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
931 sizer.Add(box, 0, wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5)
932 box2 = wx.BoxSizer(wx.HORIZONTAL)
933 self.txt2 = wx.StaticText(self, -1, _(u"Output file").decode('utf8'))
934 box2.Add(self.txt2, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
935 self.fbb = filebrowse.FileBrowseButton(self, -1, size=(450, -1), fileMode = 2)
936 box2.Add(self.fbb, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
937 self.fbb.SetLabel("")
938 sizer.Add(box2, 0, wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5)
940 btnsizer = wx.StdDialogButtonSizer()
941 btn = wx.Button(self, wx.ID_CANCEL)
942 btnsizer.AddButton(btn)
943 btn_ok = wx.Button(self, wx.ID_OK)
945 btnsizer.AddButton(btn_ok)
947 sizer.Add(btnsizer, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL|wx.ALIGN_RIGHT, 5)
948 self.Bind(wx.EVT_BUTTON, self.check_file, btn_ok)
952 def check_file(self, evt) :
953 if evt.GetId() == wx.ID_OK :
954 if os.path.exists(self.fbb.GetValue()):
955 dlg = wx.MessageDialog(self, '\n'.join([u"%s" % self.fbb.GetValue(), _(u"This file already exists. Continue anyway ?").decode('utf8')]), _(u"Attention").decode('utf8'), wx.NO | wx.YES | wx.ICON_WARNING)
957 if dlg.ShowModal() not in [wx.ID_NO, wx.ID_CANCEL]:
958 self.EndModal(wx.ID_OK)
960 self.EndModal(wx.ID_OK)
962 self.EndModal(wx.ID_CANCEL)
964 class PrefProfTypes(wx.Dialog):
965 def __init__(self, parent, *args, **kwds):
966 kwds['style'] = wx.OK|wx.DEFAULT_DIALOG_STYLE
967 wx.Dialog.__init__(self, parent, *args, **kwds)
970 sizer = wx.BoxSizer(wx.VERTICAL)
971 box = wx.BoxSizer(wx.HORIZONTAL)
972 box3 = wx.BoxSizer(wx.HORIZONTAL)
973 self.label_txt = wx.StaticText(self, -1, _(u"Settings").decode('utf8'))
974 box.Add(self.label_txt, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
975 self.radio_type = wx.RadioBox(self, -1, u"", choices=[_(u"Like ALCESTE").decode('utf8'), _(u"Like Lexico").decode('utf8')], majorDimension=0, style=wx.RA_SPECIFY_ROWS)
976 box.Add(self.radio_type, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
977 sizer.Add(box, 0, wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5)
978 box2 = wx.BoxSizer(wx.HORIZONTAL)
979 self.txt2 = wx.StaticText(self, -1, _(u"Output file").decode('utf8'))
980 box2.Add(self.txt2, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
981 self.fbb = filebrowse.FileBrowseButton(self, -1, size=(450, -1), fileMode = 2)
982 box2.Add(self.fbb, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
983 self.fbb.SetLabel("")
984 sizer.Add(box2, 0, wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5)
986 btnsizer = wx.StdDialogButtonSizer()
987 btn = wx.Button(self, wx.ID_CANCEL)
988 btnsizer.AddButton(btn)
989 btn_ok = wx.Button(self, wx.ID_OK)
991 btnsizer.AddButton(btn_ok)
993 sizer.Add(btnsizer, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL|wx.ALIGN_RIGHT, 5)
994 #self.Bind(wx.EVT_BUTTON, self.check_file, btn_ok)
998 class PrefSimpleFile(wx.Dialog):
999 def __init__(self, parent, *args, **kwds):
1000 kwds['style'] = wx.OK|wx.DEFAULT_DIALOG_STYLE
1002 self.mask = kwds['mask']
1004 else : self.mask = '*.*'
1005 wx.Dialog.__init__(self, *args, **kwds)
1007 self.parent = parent
1008 sizer = wx.BoxSizer(wx.VERTICAL)
1009 box2 = wx.BoxSizer(wx.HORIZONTAL)
1010 self.txt2 = wx.StaticText(self, -1, _(u"Output file").decode('utf8'))
1011 box2.Add(self.txt2, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
1012 self.fbb = filebrowse.FileBrowseButton(self, -1, size=(450, -1), fileMode = 2, fileMask = self.mask)
1013 box2.Add(self.fbb, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
1014 self.fbb.SetLabel("")
1015 sizer.Add(box2, 0, wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5)
1017 btnsizer = wx.StdDialogButtonSizer()
1018 btn = wx.Button(self, wx.ID_CANCEL)
1019 btnsizer.AddButton(btn)
1020 btn_ok = wx.Button(self, wx.ID_OK)
1022 btnsizer.AddButton(btn_ok)
1024 sizer.Add(btnsizer, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL|wx.ALIGN_RIGHT, 5)
1025 self.Bind(wx.EVT_BUTTON, self.check_file, btn_ok)
1026 self.SetSizer(sizer)
1029 def check_file(self, evt) :
1030 if evt.GetId() == wx.ID_OK :
1031 if os.path.exists(self.fbb.GetValue()):
1032 dlg = wx.MessageDialog(self, '\n'.join([u"%s" % self.fbb.GetValue(), _(u"This file already exists. Continue anyway ?").decode('utf8')]), _(u"Attention").decode('utf8'), wx.NO | wx.YES | wx.ICON_WARNING)
1033 dlg.CenterOnParent()
1034 if dlg.ShowModal() not in [wx.ID_NO, wx.ID_CANCEL]:
1035 self.EndModal(wx.ID_OK)
1037 self.EndModal(wx.ID_OK)
1039 self.EndModal(wx.ID_CANCEL)
1041 class StatDialog ( wx.Dialog ):
1043 def __init__( self, parent, keys ):
1044 wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = _(u"Settings").decode('utf8'), pos = wx.DefaultPosition, size = wx.Size( -1,-1 ), style = wx.DEFAULT_DIALOG_STYLE )
1047 self.parent = parent
1049 self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
1051 bSizer1 = wx.BoxSizer( wx.VERTICAL )
1053 gSizer1 = wx.GridSizer( 0, 2, 0, 0 )
1055 self.m_staticText1 = wx.StaticText( self, wx.ID_ANY, _(u"Lemmatization").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
1056 self.m_staticText1.Wrap( -1 )
1057 gSizer1.Add( self.m_staticText1, 0, wx.ALIGN_CENTER_VERTICAL, 1 )
1059 radio_lemChoices = [ _(u"yes").decode('utf8'), _(u"no").decode('utf8') ]
1060 self.radio_lem = wx.RadioBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, radio_lemChoices, 1, wx.RA_SPECIFY_COLS )
1061 self.radio_lem.SetSelection( 0 )
1062 gSizer1.Add( self.radio_lem, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 1 )
1064 self.m_staticText2 = wx.StaticText( self, wx.ID_ANY, _(u"Keys properties").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
1065 self.m_staticText2.Wrap( -1 )
1066 gSizer1.Add( self.m_staticText2, 0, wx.ALIGN_CENTER_VERTICAL, 1 )
1068 self.button_5 = wx.Button( self, wx.ID_PREFERENCES, _(u"properties").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
1069 gSizer1.Add( self.button_5, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 1 )
1071 self.m_staticText3 = wx.StaticText( self, wx.ID_ANY, _(u"Dictionary").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
1072 self.m_staticText3.Wrap( -1 )
1073 gSizer1.Add( self.m_staticText3, 0, wx.ALIGN_CENTER_VERTICAL, 1 )
1075 radio_dictchoiceChoices = [ _(u"indexation").decode('utf8'), _(u"other").decode('utf8') ]
1076 self.radio_dictchoice = wx.RadioBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, radio_dictchoiceChoices, 1, wx.RA_SPECIFY_COLS )
1077 self.radio_dictchoice.SetSelection( 0 )
1078 gSizer1.Add( self.radio_dictchoice, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 1 )
1081 bSizer1.Add( gSizer1, 1, wx.EXPAND, 1 )
1083 self.dictpath = filebrowse.FileBrowseButton(self, -1, size=(350, -1), labelText = _(u"Path").decode('utf8'), fileMode = 2, fileMask = '*')
1084 bSizer1.Add( self.dictpath, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL, 1 )
1085 self.dictpath.Enable(False)
1087 m_sdbSizer1 = wx.StdDialogButtonSizer()
1088 self.m_sdbSizer1OK = wx.Button( self, wx.ID_OK )
1089 m_sdbSizer1.AddButton( self.m_sdbSizer1OK )
1090 self.m_sdbSizer1Cancel = wx.Button( self, wx.ID_CANCEL )
1091 m_sdbSizer1.AddButton( self.m_sdbSizer1Cancel )
1092 m_sdbSizer1.Realize();
1094 bSizer1.Add( m_sdbSizer1, 0, wx.EXPAND, 0 )
1097 self.SetSizer( bSizer1 )
1101 self.Centre( wx.BOTH )
1104 self.button_5.Bind( wx.EVT_BUTTON, self.OnKeys )
1105 self.radio_dictchoice.Bind( wx.EVT_RADIOBOX, self.OnOther )
1107 def __del__( self ):
1111 # Virtual event handlers, overide them in your derived class
1112 def OnKeys( self, event ):
1113 dial = AlcOptFrame(self, self.parent)
1114 dial.corpus = self.corpus
1115 dial.CenterOnParent()
1117 for i in range(0,len(dial.listlabel)):
1118 dial.keys[dial.listcle[i]] = dial.listspin[i].GetValue()
1119 DoConf().makeoptions(['KEY'], [dial.keys], outfile = self.parent.ConfigPath['key'])
1122 def OnOther( self, event ):
1123 if self.radio_dictchoice.GetSelection() :
1124 self.dictpath.Enable(True)
1126 self.dictpath.Enable(False)
1128 # class StatDialog(wx.Dialog):
1129 # def __init__(self, parent, *args, **kwds):
1130 # kwds['style'] = wx.DEFAULT_DIALOG_STYLE
1131 # wx.Dialog.__init__(self, *args, **kwds)
1133 # self.parent = parent
1134 # self.label_lem = wx.StaticText(self, -1, _(u"Lemmatization").decode('utf8'))
1135 # self.radio_lem = wx.RadioBox(self, -1, u"", choices=[_(u'oui').decode('utf8'), _(u'non').decode('utf8')], majorDimension=0, style=wx.RA_SPECIFY_ROWS)
1136 # #txt = u"""Fréquence minimum d'une forme
1137 # #analysée (0 = non utilisé)"""
1138 # #self.label_8 = wx.StaticText(self, -1, txt)
1139 # #self.spin_ctrl_5 = wx.SpinCtrl(self, -1, "",size = (100,30), min=0, max=1000, initial=0)
1140 # #self.label_max_actives = wx.StaticText(self, -1, u"Nombre maximum de formes analysées")
1141 # #self.spin_max_actives = wx.SpinCtrl(self, -1, "",size = (100,30), min=20, max=10000, initial=1500)
1142 # self.label_4 = wx.StaticText(self, -1, _(u"Keys settings").decode('utf8'))
1143 # self.button_5 = wx.Button(self, wx.ID_PREFERENCES, "")
1144 # self.labeldictchoice = wx.StaticText(self, -1, _(u"Dictionary").decode('utf8'))
1145 # self.radio_dictchoice = wx.RadioBox(self, -1, u"", choices=[_(u'indexation').decode('utf8'), _(u'other').decode('utf8')], majorDimension=0, style=wx.RA_SPECIFY_ROWS)
1146 # #self.labeldictpath = wx.StaticText(self, -1, _(u"Path").decode('utf8'))
1147 # self.dictpath = filebrowse.FileBrowseButton(self, -1, size=(350, -1), labelText = _(u"Path").decode('utf8'), fileMode = 2, fileMask = '*')
1148 # self.dictpath.Enable(False)
1149 # #self.Bind(wx.EVT_CHECKBOX, self.OnCheckUce, self.check_uce)
1150 # #self.Bind(wx.EVT_SPINCTRL, self.OnSpin, self.spin_ctrl_5)
1151 # self.Bind(wx.EVT_BUTTON, self.OnKeys, self.button_5)
1152 # self.Bind(wx.EVT_RADIOBOX, self.OnOther, self.radio_dictchoice)
1153 # self.__do_layout()
1154 # self.__set_properties()
1156 # def __do_layout(self) :
1157 # first = wx.BoxSizer(wx.VERTICAL)
1158 # sizer = wx.FlexGridSizer(0,2,0,0)
1159 # sizer.Add(self.label_lem, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
1160 # sizer.Add(self.radio_lem, 0, 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(self.txt_exp, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
1164 # #sizer.Add(self.exp, 0, wx.ALIGN_RIGHT, 5)
1165 # #sizer.Add(self.label_uce, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
1166 # #sizer.Add(self.check_uce, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
1167 # #sizer.Add(self.label_occuce, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
1168 # #sizer.Add(self.spin_ctrl_4, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
1169 # #sizer.Add(self.label_8, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
1170 # #sizer.Add(self.spin_ctrl_5, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
1171 # #sizer.Add(self.label_max_actives, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
1172 # #sizer.Add(self.spin_max_actives, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
1173 # sizer.Add(self.label_4, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
1174 # sizer.Add(self.button_5, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
1175 # sizer.Add(wx.StaticLine(self),0, wx.ALIGN_LEFT, 5)
1176 # sizer.Add(wx.StaticLine(self),0, wx.ALIGN_LEFT, 5)
1177 # sizer.Add(self.labeldictchoice, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
1178 # sizer.Add(self.radio_dictchoice, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
1179 # sizer.Add(wx.StaticLine(self),0, wx.ALIGN_LEFT, 5)
1180 # sizer.Add(wx.StaticLine(self),0, wx.ALIGN_LEFT, 5)
1181 # #sizer.Add(self.labeldictpath, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
1182 # sizer.Add(self.dictpath, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
1183 # sizer.Add(wx.StaticLine(self),0, wx.ALIGN_LEFT, 5)
1184 # sizer.Add(wx.StaticLine(self),0, wx.ALIGN_LEFT, 5)
1185 # #sizer.Add(box2, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT, 5)
1186 # first.Add(sizer, 0, wx.ALL, 5)
1187 # btnsizer = wx.StdDialogButtonSizer()
1188 # btn = wx.Button(self, wx.ID_CANCEL)
1189 # btnsizer.AddButton(btn)
1190 # btn_ok = wx.Button(self, wx.ID_OK)
1191 # btn_ok.SetDefault()
1192 # btnsizer.AddButton(btn_ok)
1193 # btnsizer.Realize()
1194 # first.Add(btnsizer, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT, 5)
1195 # self.SetSizer(first)
1198 # def __set_properties(self) :
1199 # self.SetTitle(_(u"Settings").decode('utf8'))
1201 # def OnKeys(self, evt):
1202 # dial = AlcOptFrame(self, self.parent.parent)
1203 # dial.CenterOnParent()
1205 # for i in range(0,len(dial.listlabel)):
1206 # dial.keys[dial.listcle[i]] = dial.listspin[i].GetValue()
1207 # DoConf().makeoptions(['KEY'], [dial.keys], outfile = self.parent.parent.ConfigPath['key'])
1210 # def OnOther(self, evt):
1211 # if self.radio_dictchoice.GetSelection() :
1212 # self.dictpath.Enable(True)
1214 # self.dictpath.Enable(False)
1216 class PrefUCECarac(wx.Dialog):
1217 def __init__(self, parent, *args, **kwds):
1218 kwds['style'] = wx.DEFAULT_DIALOG_STYLE
1219 kwds['title'] = _(u"Characteristic text segments").decode('utf8')
1220 wx.Dialog.__init__(self, *args, **kwds)
1221 self.parent = parent
1222 first = wx.BoxSizer(wx.VERTICAL)
1223 sizer = wx.FlexGridSizer(0,2,0,0)
1224 self.label_type = wx.StaticText(self, -1, _(u"Ranking score").decode('utf8'))
1225 sizer.Add(self.label_type, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
1226 self.radio_type = wx.RadioBox(self, -1, u"", choices=[_(u"absolute (sum of chi2 of marked forms in segment)").decode('utf8'), _(u"relative (mean of chi2 of marked forms in segment)").decode('utf8')], majorDimension=0, style=wx.RA_SPECIFY_ROWS)
1227 sizer.Add(self.radio_type, 0, wx.ALIGN_RIGHT, 5)
1228 self.txt_eff = wx.StaticText(self, -1, _(u"Maximum number of text segments").decode('utf8'))
1229 sizer.Add(self.txt_eff, 0, wx.ALIGN_CENTRE, 5)
1230 self.spin_eff = wx.SpinCtrl(self, -1, '', size = (100, 30), min = 1, max = 100000, initial = 50)
1231 self.spin_eff.SetValue(50)
1232 sizer.Add(self.spin_eff, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
1233 first.Add(sizer, 0, wx.ALL, 5)
1234 btnsizer = wx.StdDialogButtonSizer()
1235 btn = wx.Button(self, wx.ID_CANCEL)
1236 btnsizer.AddButton(btn)
1237 btn_ok = wx.Button(self, wx.ID_OK)
1239 btnsizer.AddButton(btn_ok)
1241 first.Add(btnsizer, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT, 5)
1242 self.SetSizer(first)
1245 class PrefSegProf(wx.Dialog) :
1246 def __init__( self, parent ):
1247 wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = _(u"Repeated segments profiles").decode('utf8'), pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.DEFAULT_DIALOG_STYLE )
1249 self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
1250 bSizer1 = wx.BoxSizer( wx.VERTICAL )
1251 txt = _(u"Be carefull : computation of repeated segments profiles can be very long on large corpus").decode('utf8')
1252 self.label = wx.StaticText( self, wx.ID_ANY, txt, wx.DefaultPosition, wx.DefaultSize, 0 )
1253 bSizer1.Add( self.label, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5 )
1255 fgSizer1 = wx.FlexGridSizer( 0, 2, 0, 0 )
1256 fgSizer1.SetFlexibleDirection( wx.BOTH )
1257 fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
1259 self.m_staticText1 = wx.StaticText( self, wx.ID_ANY, _(u"Lemmatised corpus").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
1260 self.m_staticText1.Wrap( -1 )
1261 fgSizer1.Add( self.m_staticText1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1263 box_lemChoices = [ _(u"yes").decode('utf8'), _(u"no").decode('utf8') ]
1264 self.box_lem = wx.RadioBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, box_lemChoices, 1, wx.RA_SPECIFY_COLS )
1265 self.box_lem.SetSelection( 1 )
1266 fgSizer1.Add( self.box_lem, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1267 #self.box_lem.Enable(False)
1269 self.m_staticText3 = wx.StaticText( self, wx.ID_ANY, _(u"Minimum size of segments").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
1270 self.m_staticText3.Wrap( -1 )
1271 fgSizer1.Add( self.m_staticText3, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1273 self.spin_min = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 2, 30, 2 )
1274 self.spin_min.SetValue(2)
1275 fgSizer1.Add( self.spin_min, 0, wx.ALL, 5 )
1277 self.m_staticText4 = wx.StaticText( self, wx.ID_ANY, _(u"Maxmum size of segments").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
1278 self.m_staticText4.Wrap( -1 )
1279 fgSizer1.Add( self.m_staticText4, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1281 self.spin_max = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 2, 30, 10 )
1282 self.spin_max.SetValue(10)
1283 fgSizer1.Add( self.spin_max, 0, wx.ALL, 5 )
1285 self.m_staticText5 = wx.StaticText( self, wx.ID_ANY, _(u"Minimum frequency of segments").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
1286 self.m_staticText5.Wrap( -1 )
1287 fgSizer1.Add( self.m_staticText5, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1289 self.spin_eff = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 4, 1000, 4 )
1290 self.spin_eff.SetValue(4)
1291 fgSizer1.Add( self.spin_eff, 0, wx.ALL, 5 )
1293 bSizer1.Add( fgSizer1, 1, wx.EXPAND, 5 )
1294 btnsizer = wx.StdDialogButtonSizer()
1295 btn = wx.Button(self, wx.ID_CANCEL)
1296 btnsizer.AddButton(btn)
1297 btn_ok = wx.Button(self, wx.ID_OK)
1299 btnsizer.AddButton(btn_ok)
1301 bSizer1.Add(btnsizer, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT, 5)
1303 self.SetSizer( bSizer1 )
1307 self.Centre( wx.BOTH )
1309 class PrefQuestAlc ( wx.Dialog ):
1311 def __init__( self, parent, tableau, sim = False):
1312 wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = _(u"Clustering").decode('utf8'), pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.DEFAULT_DIALOG_STYLE )
1314 self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
1316 #---------------------------------------------------------------
1317 #self.content = parent.content[:]
1318 self.header = tableau.get_colnames()
1319 labels = [val for val in self.header]
1320 self.labels_tot = labels
1323 #---------------------------------------------------------------
1324 bSizer2 = wx.BoxSizer( wx.VERTICAL )
1326 fgSizer1 = wx.FlexGridSizer( 0, 2, 0, 0 )
1327 fgSizer1.SetFlexibleDirection( wx.BOTH )
1328 fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
1331 self.lab_format = wx.StaticText( self, wx.ID_ANY, _(u"Supplementary variables are marked with a *").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
1332 self.lab_format.Wrap( -1 )
1333 fgSizer1.Add( self.lab_format, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1335 m_radioBox1Choices = [ _(u"yes").decode('utf8'), _(u"no").decode('utf8') ]
1336 self.m_radioBox1 = wx.RadioBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, m_radioBox1Choices, 1, wx.RA_SPECIFY_COLS )
1337 self.m_radioBox1.SetSelection( 0 )
1338 fgSizer1.Add( self.m_radioBox1, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1340 self.m_staticText3 = wx.StaticText( self, wx.ID_ANY, _(u"Actives variables (almost 3)").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
1341 self.m_staticText3.Wrap( -1 )
1342 fgSizer1.Add( self.m_staticText3, 0, wx.ALL, 5 )
1344 self.m_staticText2 = wx.StaticText( self, wx.ID_ANY, _(u"Supplementaries variables (almost 1)").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
1345 self.m_staticText2.Wrap( -1 )
1346 fgSizer1.Add( self.m_staticText2, 0, wx.ALL, 5 )
1348 self.ListActive = wx.ListBox( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, labels, wx.LB_EXTENDED )
1349 self.ListActive.SetMinSize( wx.Size( 300,250 ) )
1351 fgSizer1.Add( self.ListActive, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL|wx.EXPAND, 5 )
1353 self.ListSup = wx.ListBox( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, labels, wx.LB_EXTENDED )
1354 self.ListSup.SetMinSize( wx.Size( 300,250 ) )
1356 fgSizer1.Add( self.ListSup, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL|wx.EXPAND, 5 )
1358 self.but_suiv = wx.Button( self, wx.ID_ANY, _(u"Next").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
1359 fgSizer1.Add( self.but_suiv, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1361 self.but_prec = wx.Button( self, wx.ID_ANY, _(u"Previous").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
1362 fgSizer1.Add( self.but_prec, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1365 self.lab_nbcl = wx.StaticText( self, wx.ID_ANY, _(u"Number of terminal clusters on phase 1").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
1366 self.lab_nbcl.Wrap( -1 )
1367 fgSizer1.Add( self.lab_nbcl, 0, wx.ALL, 5 )
1369 self.spin_nbcl = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 2, 100, 10 )
1370 self.spin_nbcl.SetValue(10)
1371 self.spin_nbcl.SetMinSize( wx.Size( 100,30 ) )
1373 fgSizer1.Add( self.spin_nbcl, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1375 self.lab_mincl = wx.StaticText( self, wx.ID_ANY, _(u"Minimum text segments frenquency in clusters (2= automatic)").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
1376 self.lab_mincl.Wrap( -1 )
1377 fgSizer1.Add( self.lab_mincl, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
1379 self.spin_mincl = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 2, 1000, 0 )
1380 self.spin_mincl.SetValue(2)
1381 self.spin_mincl.SetMinSize( wx.Size( 100,30 ) )
1383 fgSizer1.Add( self.spin_mincl, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1385 bSizer2.Add( fgSizer1, 1, wx.EXPAND, 5 )
1387 m_sdbSizer2 = wx.StdDialogButtonSizer()
1388 self.m_sdbSizer2OK = wx.Button( self, wx.ID_OK )
1389 m_sdbSizer2.AddButton( self.m_sdbSizer2OK )
1390 self.m_sdbSizer2Cancel = wx.Button( self, wx.ID_CANCEL )
1391 m_sdbSizer2.AddButton( self.m_sdbSizer2Cancel )
1392 m_sdbSizer2.Realize();
1393 bSizer2.Add( m_sdbSizer2, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT|wx.ALL, 5 )
1395 self.SetSizer( bSizer2 )
1399 self.Centre( wx.BOTH )
1402 self.ListActive.Enable(False)
1403 self.ListSup.Enable(False)
1404 self.but_suiv.Enable(False)
1405 self.but_prec.Enable(False)
1407 self.ListSup.Enable(False)
1408 self.but_prec.Enable(False)
1412 self.m_radioBox1.Bind( wx.EVT_RADIOBOX, self.onformat )
1413 self.but_suiv.Bind(wx.EVT_BUTTON, self.onsuivant)
1414 self.but_prec.Bind(wx.EVT_BUTTON, self.onprec)
1415 self.m_sdbSizer2OK.Bind(wx.EVT_BUTTON, self.onvalid)
1417 def __del__( self ):
1420 # Virtual event handlers, overide them in your derived class
1421 def onformat( self, event ):
1422 if self.m_radioBox1.GetSelection() == 0 :
1423 self.ListActive.Enable(False)
1424 self.ListSup.Enable(False)
1425 self.but_suiv.Enable(False)
1426 self.m_sdbSizer2OK.Enable(True)
1428 self.ListActive.Enable(True)
1429 self.but_suiv.Enable(True)
1430 self.m_sdbSizer2OK.Enable(False)
1432 def onsuivant(self, evt) :
1433 actives = list(self.ListActive.GetSelections())
1435 if len(actives)>=3 and len(actives) != len(self.header) :
1439 header = self.header[:]
1440 for i in range(0, len(header)):
1441 self.hindices.append(i)
1443 self.nactives.append(i)
1444 header.pop(i - compt)
1445 self.hindices.pop(i - compt)
1447 self.labels = [val for val in header]
1448 self.ListSup.Clear()
1450 self.ListSup.Append(i)
1452 self.ListActive.Enable(False)
1453 self.ListSup.Enable(True)
1454 self.but_suiv.Enable(False)
1455 self.but_prec.Enable(True)
1457 self.m_sdbSizer2OK.Enable(True)
1459 def onprec(self, evt) :
1460 self.ListActive.Enable(True)
1461 self.ListSup.Enable(False)
1462 self.but_suiv.Enable(True)
1463 self.but_prec.Enable(False)
1465 self.m_sdbSizer2OK.Enable(False)
1467 def onvalid(self, evt) :
1468 for i in self.ListSup.GetSelections() :
1469 self.varsup.append(self.hindices[i])
1471 if len(self.varsup) >= 1 or self.m_radioBox1.GetSelection() == 0 :
1474 if len(self.varsup) >= 1 :
1477 class FindInCluster(wx.Frame):
1478 def __init__(self, parent, id, result, style = wx.DEFAULT_FRAME_STYLE):
1479 # begin wxGlade: MyFrame.__init__
1480 wx.Frame.__init__(self, parent, id)
1481 self.spanel = wx.ScrolledWindow(self, -1, style=wx.TAB_TRAVERSAL)
1482 self.sizer1 = wx.FlexGridSizer(0,4,0,0)
1483 self.parent = parent
1485 txt = [_(u"form").decode('utf8'),_(u"cluster").decode('utf8'),_(u"Chi2").decode('utf8'), _(u"see").decode('utf8')]
1487 self.sizer1.Add( wx.StaticText(self.spanel, -1, val), 0, wx.ALL, 5)
1489 self.sizer1.Add(wx.StaticLine(self.spanel, -1), 0, wx.ALL, 5)
1490 for i,val in enumerate(result) :
1494 pan = wx.Panel(self.spanel, -1, style=wx.SIMPLE_BORDER)
1495 siz = wx.BoxSizer(wx.VERTICAL)
1496 txt = wx.StaticText(pan, -1, forme)
1497 siz.Add(txt, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5)
1499 self.sizer1.Add(pan, 0, wx.ALL|wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 5)
1500 pan = wx.Panel(self.spanel, -1, style=wx.SIMPLE_BORDER)
1501 siz = wx.BoxSizer(wx.VERTICAL)
1502 txt = wx.StaticText(pan, -1, str(cl))
1503 siz.Add(txt, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5)
1505 self.sizer1.Add(pan, 0, wx.ALL|wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 5)
1506 pan = wx.Panel(self.spanel, -1, style=wx.SIMPLE_BORDER)
1507 siz = wx.BoxSizer(wx.VERTICAL)
1508 txt = wx.StaticText(pan, -1, str(chi))
1509 siz.Add(txt, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5)
1511 self.sizer1.Add(pan, 0, wx.ALL|wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 5)
1513 self.formes[idbut] = [forme, cl]
1514 but = wx.Button(self.spanel, idbut, u"voir")
1515 self.sizer1.Add(but, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5)
1516 self.Bind(wx.EVT_BUTTON, self.showitem, but)
1517 self.button_1 = wx.Button(self, -1, "Fermer")
1518 self.Bind(wx.EVT_BUTTON, self.OnCloseMe, self.button_1)
1519 self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)
1520 self.__set_properties()
1524 def __set_properties(self):
1525 self.SetTitle(_(u"Results").decode('utf8'))
1526 self.spanel.EnableScrolling(True,True)
1527 #self.panel_1.SetSize((1000,1000))
1528 self.spanel.SetScrollRate(20, 20)
1529 h = 60 * len(self.formes)
1534 self.SetSize(wx.Size(400,h))
1536 def __do_layout(self):
1537 # begin wxGlade: MyFrame.__do_layout
1538 sizer_1 = wx.BoxSizer(wx.VERTICAL)
1539 sizer_2 = wx.BoxSizer(wx.VERTICAL)
1540 self.spanel.SetSizer(self.sizer1)
1541 sizer_1.Add(self.spanel, 4, wx.EXPAND, 0)
1542 sizer_1.Add(self.button_1, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ADJUST_MINSIZE, 0)
1543 #sizer_1.Add(sizer_2, 1, wx.EXPAND, 0)
1544 self.SetAutoLayout(True)
1545 self.SetSizer(sizer_1)
1549 def showitem(self, evt) :
1550 idb = evt.GetEventObject().GetId()
1552 profile = nb.GetPage(nb.GetSelection())
1553 cl = self.formes[idb][1] - 1
1554 forme = self.formes[idb][0]
1555 profile.ProfNB.SetSelection(cl)
1556 UnSelectList(profile.ProfNB.GetPage(cl))
1557 datas = dict([[profile.ProfNB.GetPage(cl).getColumnText(i,6),i] for i in range(profile.ProfNB.GetPage(cl).GetItemCount())])
1558 profile.ProfNB.GetPage(cl).SetItemState(datas[self.formes[idb][0]], wx.LIST_STATE_SELECTED, wx.LIST_STATE_SELECTED)
1559 profile.ProfNB.GetPage(cl).Focus(datas[forme])
1560 profile.ProfNB.GetPage(cl).SetFocus()
1562 def OnCloseMe(self, evt) :
1565 def OnCloseWindow(self, evt):
1568 class SearchDial ( wx.Frame ):
1570 def __init__( self, parent, listctrl, col, shown):
1571 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 )
1572 self.parent = parent
1573 self.listctrl = listctrl
1576 self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
1578 bSizer1 = wx.BoxSizer( wx.VERTICAL )
1580 self.search = wx.SearchCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.TE_PROCESS_ENTER )
1581 self.search.ShowSearchButton( True )
1582 self.search.ShowCancelButton( True )
1583 bSizer1.Add( self.search, 0, wx.ALL|wx.EXPAND, 5 )
1584 sizer2 = wx.BoxSizer(wx.HORIZONTAL)
1585 self.backward = wx.Button(self, wx.ID_BACKWARD, _(u"Previous").decode('utf8'))
1586 self.forward = wx.Button(self, wx.ID_FORWARD, _(u"Next").decode('utf8'))
1587 sizer2.Add(self.backward, 0, wx.ALL, 5)
1588 sizer2.Add(self.forward, 0, wx.ALL, 5)
1589 bSizer1.Add( sizer2, 0, wx.ALL, 5 )
1591 self.SetSizer( bSizer1 )
1594 self.Bind(wx.EVT_SEARCHCTRL_SEARCH_BTN, self.OnSearch, self.search)
1595 self.Bind(wx.EVT_SEARCHCTRL_CANCEL_BTN, self.OnCancel, self.search)
1596 self.Bind(wx.EVT_TEXT_ENTER, self.OnSearch, self.search)
1597 self.Bind(wx.EVT_BUTTON, self.onforward, self.forward)
1598 self.Bind(wx.EVT_BUTTON, self.onbackward, self.backward)
1599 self.search.SetFocus()
1600 self.forward.Enable(False)
1601 self.backward.Enable(False)
1603 self.Centre( wx.BOTH )
1605 def __del__( self ):
1608 def OnSearch(self, evt):
1609 UnSelectList(self.listctrl)
1610 search_word = self.search.GetValue()
1611 if search_word.strip() != '' :
1612 formes = [self.listctrl.getColumnText(i, self.col) for i in range(self.listctrl.GetItemCount())]
1613 if search_word.endswith(u'*') :
1614 search_word = search_word[0:-1]
1615 result = [j for j, forme in enumerate(formes) if forme.startswith(search_word)]
1617 result = [j for j, forme in enumerate(formes) if forme == search_word]
1620 elif self.shown == True :
1621 self.showitems(result)
1623 self.showresult(result)
1628 def showitems(self, items) :
1629 if len(items) == 1 :
1630 self.listctrl.SetItemState(items[0], wx.LIST_STATE_SELECTED, wx.LIST_STATE_SELECTED)
1631 self.listctrl.Focus(items[0])
1632 self.listctrl.SetFocus()
1636 self.listctrl.SetItemState(i, wx.LIST_STATE_SELECTED, wx.LIST_STATE_SELECTED)
1637 self.listctrl.Focus(items[0])
1638 self.listctrl.SetFocus()
1639 self.forward.Enable(True)
1640 self.backward.Enable(False)
1645 def showresult(self, result) :
1646 toshow = [self.listctrl.itemDataMap[int(self.listctrl.getColumnText(i,0))] for i in result]
1647 proflist = [[[line[1], i+1, val] for i, val in enumerate(line[2:]) if val>=2] for line in toshow]
1648 #FIXME: intervenir en aval en virant les forme avec chi<2
1649 if proflist != [[]] :
1650 proflist = [val for line in proflist for val in line if line !=[]]
1651 nb = self.parent.parent.nb
1652 profile = nb.GetPage(nb.GetSelection())
1653 first_forme = proflist[0]
1654 cl = first_forme[1] - 1
1655 profile.ProfNB.SetSelection(cl)
1656 profile.ProfNB.GetPage(cl).SetFocus()
1657 UnSelectList(profile.ProfNB.GetPage(cl))
1658 datas = dict([[profile.ProfNB.GetPage(cl).getColumnText(i,6),i] for i in range(profile.ProfNB.GetPage(cl).GetItemCount())])
1659 profile.ProfNB.GetPage(cl).SetItemState(datas[first_forme[0]], wx.LIST_STATE_SELECTED, wx.LIST_STATE_SELECTED)
1660 profile.ProfNB.GetPage(cl).Focus(datas[first_forme[0]])
1661 profile.ProfNB.GetPage(cl).SetFocus()
1662 if len(proflist) == 1 :
1665 SearchResult = FindInCluster(self.parent.parent, -1, proflist)
1671 def onforward(self, evt) :
1672 self.listctrl.Focus(self.items[self.forwitem])
1673 self.listctrl.SetFocus()
1675 if self.forwitem == len(self.items) :
1676 self.forward.Enable(False)
1677 self.backward.Enable(True)
1681 self.backward.Enable(True)
1683 def onbackward(self, evt) :
1684 self.listctrl.Focus(self.items[self.backitem])
1685 self.listctrl.SetFocus()
1687 if self.backitem == -1 :
1689 self.forward.Enable(True)
1690 self.backward.Enable(False)
1693 self.forward.Enable(True)
1695 def noresult(self) :
1696 msg = _(u"Absent form").decode('utf8')
1697 dial = wx.MessageDialog(self, _(u"Absent form").decode('utf8'),_(u"Absent form").decode('utf8'), wx.OK | wx.ICON_INFORMATION)
1698 dial.CenterOnParent()
1702 def OnCancel(self, evt) :
1705 def UnSelectList(liste) :
1706 if liste.GetFirstSelected() != -1 :
1707 last = liste.GetFirstSelected()
1708 liste.Select(liste.GetFirstSelected(), False)
1709 while liste.GetNextSelected(last) != -1 :
1710 last = liste.GetNextSelected(last)
1711 liste.Select(liste.GetFirstSelected(),False)
1713 class SearchCorpus(SearchDial):
1714 def OnSearch(self, evt):
1715 search_word = self.search.GetValue()
1716 if search_word.strip() != '' :
1717 self.corpus_ok = self.listctrl.GetCorpusByName(search_word)
1718 if self.corpus_ok != [] :
1719 if len(self.corpus_ok) == 1 :
1720 self.listctrl.GiveFocus(None, self.corpus_ok[0]['uuid'])
1723 self.listctrl.GiveFocus(None, self.corpus_ok[-1]['uuid'])
1724 self.forward.Enable(True)
1725 self.backward.Enable(False)
1728 #for corpus in corpus_ok :
1729 # self.listctrl.SetContentBackground(uuid = corpus['uuid'])
1735 def onforward(self, evt) :
1737 self.listctrl.GiveFocus(uuid=self.corpus_ok[-self.forwitem]['uuid'])
1738 if self.forwitem == len(self.corpus_ok) :
1739 self.forward.Enable(False)
1740 self.backward.Enable(True)
1741 self.backitem = self.forwitem - 1
1743 self.backitem = self.forwitem - 1
1744 self.backward.Enable(True)
1746 def onbackward(self, evt) :
1747 self.listctrl.GiveFocus(uuid=self.corpus_ok[-self.backitem]['uuid'])
1749 if self.backitem == 0 :
1751 self.forward.Enable(True)
1752 self.backward.Enable(False)
1755 self.forward.Enable(True)
1757 class OptLexi(wx.Dialog):
1758 def __init__(self, parent, force_chi = False):
1759 # begin wxGlade: MyDialog.__init__
1760 #kwds["style"] = wx.DEFAULT_DIALOG_STYLE
1761 wx.Dialog.__init__(self, parent, style = wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER)
1763 self.variables = None
1764 self.force_chi = force_chi
1765 #self.labellem = wx.StaticText(self, -1, u"Lemmatisation : ")
1766 #self.checklem = wx.CheckBox(self, -1)
1767 if not self.force_chi :
1768 self.label_typeformes = wx.StaticText(self, -1, _(u"Used forms").decode('utf8'))
1769 typeformeschoiceChoices = [ _(u"actives and supplementaries").decode('utf8'), _(u"actives").decode('utf8'), _(u"supplementaries").decode('utf8')]
1770 self.typeformes = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, typeformeschoiceChoices, 0 )
1771 self.typeformes.SetSelection( 0 )
1773 self.label_var = wx.StaticText(self, -1, _(u"Select by").decode('utf8'))
1774 self.choice = wx.Choice(self, -1, (100,50), choices = [_(u"variables").decode('utf8'), _(u"modalities").decode('utf8')])
1775 self.label1 = wx.StaticText(self, -1, _(u"Choice").decode('utf8'))
1776 self.list_box_1 = wx.ListBox(self, -1, choices=[], size = wx.Size( 300,200 ), style=wx.LB_EXTENDED | wx.LB_HSCROLL)
1777 self.button_2 = wx.Button(self, wx.ID_CANCEL, "")
1778 self.button_1 = wx.Button(self, wx.ID_OK, "")
1779 if not self.force_chi :
1780 indices = [_(u"hypergeometrical law").decode('utf8'), _(u"chi2").decode('utf8')]
1782 indices = [_(u"chi2").decode('utf8')]
1783 self.label_indice = wx.StaticText(self, -1, _(u"Score").decode('utf8'))
1784 self.choice_indice = wx.Choice(self, -1, (100,50), choices = indices)
1785 if not self.force_chi :
1786 self.label = wx.StaticText(self, -1, _(u"Minimum frequency").decode('utf8'))
1787 self.spin = wx.SpinCtrl(self, -1, min = 1, max = 10000, initial = 10, size=wx.DefaultSize)
1788 self.Bind(wx.EVT_CHOICE, self.onselect, self.choice)
1789 self.Bind(wx.EVT_LISTBOX, self.onchoose, self.list_box_1)
1790 self.__set_properties()
1794 def __set_properties(self):
1795 # begin wxGlade: MyDialog.__set_properties
1796 self.SetTitle(_(u"Variables choice").decode('utf8'))
1797 if not self.force_chi :
1798 self.spin.SetValue(10)
1799 self.choice.SetSelection(0)
1800 self.choice_indice.SetSelection(0)
1801 self.button_1.Enable(False)
1802 #self.SetMinSize(wx.Size(300, 400))
1805 def __do_layout(self):
1806 # begin wxGlade: MyDialog.__do_layout
1807 sizer_1 = wx.BoxSizer(wx.VERTICAL)
1808 sizer_2 = wx.FlexGridSizer(0,2,0,0)
1809 sizer_3 = wx.BoxSizer(wx.HORIZONTAL)
1810 #sizer_2.Add(self.labellem, 0, wx.ALIGN_CENTER_VERTICAL, 3)
1811 #sizer_2.Add(self.checklem, 0, wx.ALIGN_CENTER_VERTICAL, 3)
1812 if not self.force_chi :
1813 sizer_2.Add(self.label_typeformes, 0, wx.ALIGN_CENTER_VERTICAL, 3)
1814 sizer_2.Add(self.typeformes, 0, wx.ALIGN_CENTER_VERTICAL, 3)
1815 sizer_2.Add(self.label_var, 0, wx.ALIGN_CENTER_VERTICAL, 3)
1816 sizer_2.Add(self.choice, 0, wx.ALIGN_CENTER_VERTICAL, 3)
1817 sizer_2.Add(self.label1, 0, wx.ALIGN_CENTER_VERTICAL, 3)
1818 sizer_2.Add(self.list_box_1, 0, wx.ALIGN_RIGHT|wx.EXPAND, 3)
1819 sizer_3.Add(self.button_2, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 3)
1820 sizer_3.Add(self.button_1, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 3)
1821 sizer_2.Add(self.label_indice, 0, wx.ALIGN_CENTER_VERTICAL, 3)
1822 sizer_2.Add(self.choice_indice, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 3)
1823 if not self.force_chi :
1824 sizer_2.Add(self.label, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 3)
1825 sizer_2.Add(self.spin, 0, wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 3)
1826 sizer_1.Add(sizer_2, 0, wx.ALIGN_CENTER_HORIZONTAL, 3)
1827 sizer_1.Add(sizer_3, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_RIGHT, 3)
1828 self.SetSizer(sizer_1)
1833 def onselect(self, evt):
1834 self.list_box_1.Clear()
1835 if self.choice.GetSelection() == 0 :
1836 for var in self.variables :
1837 self.list_box_1.Append(var)
1839 for et in self.listet :
1840 self.list_box_1.Append(et)
1842 def onchoose(self, evt):
1843 if self.choice.GetSelection()== 0 :
1844 if len(self.list_box_1.GetSelections()) > 0 :
1845 self.button_1.Enable(True)
1847 self.button_1.Enable(False)
1848 elif self.choice.GetSelection() == 1 :
1849 if len(self.list_box_1.GetSelections()) > 1 :
1850 self.button_1.Enable(True)
1852 self.button_1.Enable(False)
1854 class PrefDendro ( wx.Dialog ):
1856 def __init__( self, parent, parametres ):
1857 wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = _(u"Dendrogram").decode('utf8'), pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.DEFAULT_DIALOG_STYLE )
1858 self.parametres = parametres
1859 self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
1861 fgSizer1 = wx.FlexGridSizer( 0, 2, 0, 0 )
1862 fgSizer1.SetFlexibleDirection( wx.BOTH )
1863 fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
1865 self.m_staticText1 = wx.StaticText( self, wx.ID_ANY, _(u"Picture size").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
1866 self.m_staticText1.Wrap( -1 )
1867 fgSizer1.Add( self.m_staticText1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1869 bSizer2 = wx.BoxSizer( wx.VERTICAL )
1871 bSizer3 = wx.BoxSizer( wx.HORIZONTAL )
1873 self.m_staticText2 = wx.StaticText( self, wx.ID_ANY, _(u"height").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
1874 self.m_staticText2.Wrap( -1 )
1875 bSizer3.Add( self.m_staticText2, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1877 self.m_spinCtrl1 = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 50, 10000, 600 )
1878 bSizer3.Add( self.m_spinCtrl1, 0, wx.ALL, 5 )
1880 bSizer2.Add( bSizer3, 1, wx.EXPAND, 5 )
1882 bSizer31 = wx.BoxSizer( wx.HORIZONTAL )
1884 self.m_staticText3 = wx.StaticText( self, wx.ID_ANY, _(u"width").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
1885 self.m_staticText3.Wrap( -1 )
1886 bSizer31.Add( self.m_staticText3, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1888 self.m_spinCtrl2 = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 50, 10000, 600 )
1889 bSizer31.Add( self.m_spinCtrl2, 0, wx.ALL, 5 )
1891 bSizer2.Add( bSizer31, 1, wx.EXPAND, 5 )
1893 fgSizer1.Add( bSizer2, 1, wx.EXPAND, 5 )
1895 self.m_staticline1 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1896 fgSizer1.Add( self.m_staticline1, 0, wx.EXPAND |wx.ALL, 5 )
1898 self.m_staticline2 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1899 fgSizer1.Add( self.m_staticline2, 0, wx.EXPAND |wx.ALL, 5 )
1901 self.m_staticText4 = wx.StaticText( self, wx.ID_ANY, _(u"Dendrogram type").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
1902 self.m_staticText4.Wrap( -1 )
1903 fgSizer1.Add( self.m_staticText4, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1905 m_choice1Choices = [ u"phylogram", u"cladogram", u"fan", u"unrooted", u"radial" ]
1906 self.m_choice1 = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, m_choice1Choices, 0 )
1907 self.m_choice1.SetSelection( 0 )
1908 fgSizer1.Add( self.m_choice1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT|wx.ALL, 5 )
1910 self.m_staticline3 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1911 fgSizer1.Add( self.m_staticline3, 0, wx.EXPAND |wx.ALL, 5 )
1913 self.m_staticline4 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1914 fgSizer1.Add( self.m_staticline4, 0, wx.EXPAND |wx.ALL, 5 )
1916 self.text_format_image = wx.StaticText( self, wx.ID_ANY, _(u"Image format").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
1917 self.text_format_image.Wrap( -1 )
1918 fgSizer1.Add( self.text_format_image, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1920 self.choice_format = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, ['png', 'svg'], 0 )
1921 self.choice_format.SetSelection( 0 )
1922 fgSizer1.Add( self.choice_format, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT|wx.ALL, 5 )
1924 self.m_staticline31 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1925 fgSizer1.Add( self.m_staticline31, 0, wx.EXPAND |wx.ALL, 5 )
1927 self.m_staticline41 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1928 fgSizer1.Add( self.m_staticline41, 0, wx.EXPAND |wx.ALL, 5 )
1930 if self.parametres['typedendro'] == 'classique' :
1931 self.m_staticText5 = wx.StaticText( self, wx.ID_ANY, _(u"Color or black and white").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
1932 self.m_staticText5.Wrap( -1 )
1933 fgSizer1.Add( self.m_staticText5, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1935 m_radioBox1Choices = [ _(u"color").decode('utf8'), _(u"black and white").decode('utf8') ]
1936 self.m_radioBox1 = wx.RadioBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, m_radioBox1Choices, 1, wx.RA_SPECIFY_COLS )
1937 self.m_radioBox1.SetSelection( 0 )
1938 fgSizer1.Add( self.m_radioBox1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT|wx.ALL, 5 )
1940 self.m_staticline5 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1941 fgSizer1.Add( self.m_staticline5, 0, wx.EXPAND |wx.ALL, 5 )
1943 self.m_staticline6 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1944 fgSizer1.Add( self.m_staticline6, 0, wx.EXPAND |wx.ALL, 5 )
1946 bSizer4 = wx.BoxSizer( wx.HORIZONTAL )
1948 self.m_staticText6 = wx.StaticText( self, wx.ID_ANY, _(u"Add cluster size").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
1949 self.m_staticText6.Wrap( -1 )
1950 bSizer4.Add( self.m_staticText6, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1952 self.m_checkBox1 = wx.CheckBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
1953 self.m_checkBox1.SetValue(True)
1954 bSizer4.Add( self.m_checkBox1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1956 fgSizer1.Add( bSizer4, 1, wx.EXPAND, 5 )
1958 m_radioBox2Choices = [ _(u"circular diagram").decode('utf8'), _(u"bar").decode('utf8') ]
1959 self.m_radioBox2 = wx.RadioBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, m_radioBox2Choices, 1, wx.RA_SPECIFY_COLS )
1960 self.m_radioBox2.SetSelection( 0 )
1961 fgSizer1.Add( self.m_radioBox2, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT|wx.ALL, 5 )
1963 self.m_staticline7 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1964 fgSizer1.Add( self.m_staticline7, 0, wx.EXPAND |wx.ALL, 5 )
1966 self.m_staticline8 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1967 fgSizer1.Add( self.m_staticline8, 0, wx.EXPAND |wx.ALL, 5 )
1969 if self.parametres.get('translation', False) :
1970 self.m_staticText66 = wx.StaticText( self, wx.ID_ANY, _(u"Translation").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
1971 self.m_staticText66.Wrap( -1 )
1972 fgSizer1.Add( self.m_staticText66, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1974 m_choice1Choices = [ u"phylogram", u"cladogram", u"fan", u"unrooted", u"radial" ]
1975 self.trans = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, ['None'] + [val[0] for val in self.parametres['translation']], 0 )
1976 self.trans.SetSelection( 0 )
1977 fgSizer1.Add( self.trans, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT|wx.ALL, 5 )
1979 fgSizer1.AddSpacer( ( 0, 0), 1, wx.EXPAND, 5 )
1981 m_sdbSizer2 = wx.StdDialogButtonSizer()
1982 self.m_sdbSizer2OK = wx.Button( self, wx.ID_OK )
1983 m_sdbSizer2.AddButton( self.m_sdbSizer2OK )
1984 self.m_sdbSizer2Cancel = wx.Button( self, wx.ID_CANCEL )
1985 m_sdbSizer2.AddButton( self.m_sdbSizer2Cancel )
1986 m_sdbSizer2.Realize();
1987 fgSizer1.Add( m_sdbSizer2, 1, wx.EXPAND, 5 )
1989 self.__set_properties()
1990 self.SetSizer( fgSizer1 )
1992 fgSizer1.Fit( self )
1994 self.Centre( wx.BOTH )
1996 def __set_properties(self):
1997 self.m_spinCtrl2.SetValue(self.parametres['width'])
1998 self.m_spinCtrl1.SetValue(self.parametres['height'])
1999 self.m_choice1.SetSelection(self.parametres['type_dendro'])
2000 self.choice_format.SetSelection(self.parametres['svg'])
2001 if self.parametres['typedendro'] == 'classique' :
2002 self.m_radioBox1.SetSelection(self.parametres['color_nb'])
2003 self.m_checkBox1.SetValue(self.parametres['taille_classe'])
2004 self.m_radioBox2.SetSelection(self.parametres['type_tclasse'])
2006 def __del__( self ):
2010 class PrefWordCloud ( wx.Dialog ):
2012 def __init__( self, parent, fromcluster = False ):
2013 wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = _(u"Wordcloud settings").decode('utf8'), pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.DEFAULT_DIALOG_STYLE )
2015 self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
2017 fgSizer1 = wx.FlexGridSizer( 0, 2, 0, 0 )
2018 fgSizer1.SetFlexibleDirection( wx.BOTH )
2019 fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
2021 #self.m_staticText1 = wx.StaticText( self, wx.ID_ANY, u"Sélectionner les formes", wx.DefaultPosition, wx.DefaultSize, 0 )
2022 #self.m_staticText1.Wrap( -1 )
2023 #fgSizer1.Add( self.m_staticText1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2025 #self.but_selectcol = wx.Button( self, wx.ID_ANY, u"Sélectionner", wx.DefaultPosition, wx.DefaultSize, 0 )
2026 #fgSizer1.Add( self.but_selectcol, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2028 #self.m_staticline1 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
2029 #fgSizer1.Add( self.m_staticline1, 0, wx.EXPAND |wx.ALL, 5 )
2031 #self.m_staticline2 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
2032 #fgSizer1.Add( self.m_staticline2, 0, wx.EXPAND |wx.ALL, 5 )
2034 bSizer1 = wx.BoxSizer( wx.HORIZONTAL )
2036 self.m_staticText3 = wx.StaticText( self, wx.ID_ANY, _(u"height").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2037 self.m_staticText3.Wrap( -1 )
2038 bSizer1.Add( self.m_staticText3, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2040 self.spin_H = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 0, 10000, 600 )
2041 self.spin_H.SetValue( 800 )
2042 bSizer1.Add( self.spin_H, 0, wx.ALL, 5 )
2044 fgSizer1.Add( bSizer1, 1, wx.EXPAND, 5 )
2046 bSizer3 = wx.BoxSizer( wx.HORIZONTAL )
2048 self.m_staticText4 = wx.StaticText( self, wx.ID_ANY, _(u"width").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2049 self.m_staticText4.Wrap( -1 )
2050 bSizer3.Add( self.m_staticText4, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2052 self.spin_L = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 0, 10000, 600 )
2053 self.spin_L.SetValue( 800 )
2054 bSizer3.Add( self.spin_L, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2056 fgSizer1.Add( bSizer3, 1, wx.EXPAND, 5 )
2058 self.m_staticline3 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
2059 fgSizer1.Add( self.m_staticline3, 0, wx.EXPAND |wx.ALL, 5 )
2061 self.m_staticline4 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
2062 fgSizer1.Add( self.m_staticline4, 0, wx.EXPAND |wx.ALL, 5 )
2064 self.m_staticText11 = wx.StaticText( self, wx.ID_ANY, _(u"Picture format").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2065 self.m_staticText11.Wrap( -1 )
2066 fgSizer1.Add( self.m_staticText11, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2068 formatChoices = [ u"png", u"svg" ]
2069 self.format = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, formatChoices, 0 )
2070 self.format.SetSelection( 0 )
2071 fgSizer1.Add( self.format, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2074 self.m_staticText111 = wx.StaticText( self, wx.ID_ANY, _(u"Word size proportional to ...").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2075 self.m_staticText11.Wrap( -1 )
2076 fgSizer1.Add( self.m_staticText111, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2078 IndiceChoices = [ _(u"chi2").decode('utf8'), _(u"frequency").decode('utf8') ]
2079 self.indice = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, IndiceChoices, 0 )
2080 self.indice.SetSelection( 0 )
2081 fgSizer1.Add( self.indice, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2083 self.m_staticline13 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
2084 fgSizer1.Add( self.m_staticline13, 0, wx.EXPAND |wx.ALL, 5 )
2086 self.m_staticline14 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
2087 fgSizer1.Add( self.m_staticline14, 0, wx.EXPAND |wx.ALL, 5 )
2089 self.m_staticText5 = wx.StaticText( self, wx.ID_ANY, _(u"Maximum number of forms").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2090 self.m_staticText5.Wrap( -1 )
2091 fgSizer1.Add( self.m_staticText5, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2093 self.spin_maxword = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 0, 10000, 600 )
2094 self.spin_maxword.SetValue( 600 )
2095 fgSizer1.Add( self.spin_maxword, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2097 self.m_staticline5 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
2098 fgSizer1.Add( self.m_staticline5, 0, wx.EXPAND |wx.ALL, 5 )
2100 self.m_staticline6 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
2101 fgSizer1.Add( self.m_staticline6, 0, wx.EXPAND |wx.ALL, 5 )
2103 self.typeformes = wx.StaticText( self, wx.ID_ANY, _(u"Used forms").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2104 self.typeformes.Wrap( -1 )
2105 fgSizer1.Add( self.typeformes, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2107 typeformeschoiceChoices = [ _(u"actives").decode('utf8'), _(u"supplementaries").decode('utf8'), _(u"actives and supplementaries").decode('utf8') ]
2108 self.typeformeschoice = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, typeformeschoiceChoices, 0 )
2109 self.typeformeschoice.SetSelection( 0 )
2110 fgSizer1.Add( self.typeformeschoice, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2112 self.m_staticline11 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
2113 fgSizer1.Add( self.m_staticline11, 0, wx.EXPAND |wx.ALL, 5 )
2115 self.m_staticline12 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
2116 fgSizer1.Add( self.m_staticline12, 0, wx.EXPAND |wx.ALL, 5 )
2118 self.m_staticText6 = wx.StaticText( self, wx.ID_ANY, _(u"Text size").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2119 self.m_staticText6.Wrap( -1 )
2120 fgSizer1.Add( self.m_staticText6, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2122 bSizer4 = wx.BoxSizer( wx.VERTICAL )
2124 bSizer5 = wx.BoxSizer( wx.HORIZONTAL )
2126 self.m_staticText7 = wx.StaticText( self, wx.ID_ANY, u"Min", wx.DefaultPosition, wx.DefaultSize, 0 )
2127 self.m_staticText7.Wrap( -1 )
2128 bSizer5.Add( self.m_staticText7, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2130 self.spin_mincex = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 0, 1000, 5 )
2131 self.spin_mincex.SetValue( 5 )
2132 bSizer5.Add( self.spin_mincex, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT|wx.ALL, 5 )
2134 bSizer4.Add( bSizer5, 1, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.EXPAND, 5 )
2136 bSizer6 = wx.BoxSizer( wx.HORIZONTAL )
2138 self.m_staticText8 = wx.StaticText( self, wx.ID_ANY, u"Max", wx.DefaultPosition, wx.DefaultSize, 0 )
2139 self.m_staticText8.Wrap( -1 )
2140 bSizer6.Add( self.m_staticText8, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2142 self.spin_maxcex = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 0, 1000, 50 )
2143 self.spin_maxcex.SetValue( 50 )
2144 bSizer6.Add( self.spin_maxcex, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2146 bSizer4.Add( bSizer6, 1, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.EXPAND, 5 )
2148 fgSizer1.Add( bSizer4, 1, wx.EXPAND, 5 )
2150 self.m_staticline7 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
2151 fgSizer1.Add( self.m_staticline7, 0, wx.EXPAND |wx.ALL, 5 )
2153 self.m_staticline8 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
2154 fgSizer1.Add( self.m_staticline8, 0, wx.EXPAND |wx.ALL, 5 )
2156 bSizer61 = wx.BoxSizer( wx.HORIZONTAL )
2158 self.m_staticText81 = wx.StaticText( self, wx.ID_ANY, _(u"Text color").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2159 self.m_staticText81.Wrap( -1 )
2160 bSizer61.Add( self.m_staticText81, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2162 self.color_text = wx.ColourPickerCtrl( self, wx.ID_ANY, wx.BLACK, wx.DefaultPosition, wx.DefaultSize, wx.CLRP_DEFAULT_STYLE )
2163 bSizer61.Add( self.color_text, 0, wx.ALL, 5 )
2165 fgSizer1.Add( bSizer61, 1, wx.EXPAND, 5 )
2167 bSizer7 = wx.BoxSizer( wx.HORIZONTAL )
2169 self.m_staticText9 = wx.StaticText( self, wx.ID_ANY, _(u"Background color").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2170 self.m_staticText9.Wrap( -1 )
2171 bSizer7.Add( self.m_staticText9, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2173 self.color_bg = wx.ColourPickerCtrl( self, wx.ID_ANY, (255,255,255), wx.DefaultPosition, wx.DefaultSize, wx.CLRP_DEFAULT_STYLE )
2174 bSizer7.Add( self.color_bg, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2176 fgSizer1.Add( bSizer7, 1, wx.EXPAND, 5 )
2178 self.m_staticline9 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
2179 fgSizer1.Add( self.m_staticline9, 0, wx.EXPAND |wx.ALL, 5 )
2181 self.m_staticline10 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
2182 fgSizer1.Add( self.m_staticline10, 0, wx.EXPAND |wx.ALL, 5 )
2184 fgSizer1.AddSpacer( ( 0, 0), 1, wx.EXPAND, 5 )
2186 m_sdbSizer1 = wx.StdDialogButtonSizer()
2187 self.m_sdbSizer1OK = wx.Button( self, wx.ID_OK )
2188 m_sdbSizer1.AddButton( self.m_sdbSizer1OK )
2189 self.m_sdbSizer1Cancel = wx.Button( self, wx.ID_CANCEL )
2190 m_sdbSizer1.AddButton( self.m_sdbSizer1Cancel )
2191 m_sdbSizer1.Realize();
2192 fgSizer1.Add( m_sdbSizer1, 1, wx.EXPAND, 5 )
2194 self.SetSizer( fgSizer1 )
2196 fgSizer1.Fit( self )
2198 self.Centre( wx.BOTH )
2200 def __del__( self ):
2203 class PrefChi(sc.SizedDialog):
2204 def __init__(self, parent, ID, optionchi, title):
2206 sc.SizedDialog.__init__(self, None, -1, _(u"Settings").decode('utf8'),
2207 style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER)
2208 pane = self.GetContentsPane()
2209 pane.SetSizerType("form")
2210 pane.SetSizerProps(border=("all",5))
2211 self.parent = parent
2212 self.optionchi = optionchi
2215 self.label_obs = wx.StaticText(pane, -1, _(u"observed values").decode('utf8'))
2216 self.check1 = wx.CheckBox(pane, -1)
2218 self.label_theo = wx.StaticText(pane, -1, _(u"expected values").decode('utf8'))
2219 self.check2 = wx.CheckBox(pane, -1)
2221 self.label_resi = wx.StaticText(pane, -1, _(u"residuals").decode('utf8'))
2222 self.check3 = wx.CheckBox(pane, -1)
2224 self.label_contrib = wx.StaticText(pane, -1, _(u"standardized residuals").decode('utf8'))
2225 self.check4 = wx.CheckBox(pane, -1)
2226 # self.label_graph = wx.StaticText(pane, -1, u'graphique')
2227 # self.check8 = wx.CheckBox(pane, -1)
2228 self.label_pourcent = wx.StaticText(pane, -1, _(u"total percentage").decode('utf8'))
2229 self.check5 = wx.CheckBox(pane, -1)
2231 self.label_prl = wx.StaticText(pane, -1, _(u"row percentage").decode('utf8'))
2232 self.check6 = wx.CheckBox(pane, -1)
2234 self.label_prc = wx.StaticText(pane, -1, _(u"column percentage").decode('utf8'))
2235 self.check7 = wx.CheckBox(pane, -1)
2237 self.label_graph = wx.StaticText(pane, -1, _(u"graphical").decode('utf8'))
2238 self.check8 = wx.CheckBox(pane, -1)
2240 self.label_graphbw = wx.StaticText(pane, -1, _(u"black and white graphical").decode('utf8'))
2241 self.checkbw = wx.CheckBox(pane, -1)
2243 self.SetButtonSizer(self.CreateStdDialogButtonSizer(wx.OK | wx.CANCEL))
2245 self.__set_properties()
2247 self.SetMinSize(self.GetSize())
2249 def __set_properties(self):
2250 self.check1.SetValue(self.optionchi['valobs'])
2251 self.check2.SetValue(self.optionchi['valtheo'])
2252 self.check3.SetValue(self.optionchi['resi'])
2253 self.check4.SetValue(self.optionchi['contrib'])
2254 self.check5.SetValue(self.optionchi['pourcent'])
2255 self.check6.SetValue(self.optionchi['pourcentl'])
2256 self.check7.SetValue(self.optionchi['pourcentc'])
2257 self.check8.SetValue(self.optionchi['graph'])
2258 self.checkbw.SetValue(self.optionchi['bw'])
2260 class ChiDialog(wx.Dialog):
2262 self, parent, ID, title, optionchi, tableau, size=wx.DefaultSize, pos=wx.DefaultPosition,
2263 style=wx.DEFAULT_DIALOG_STYLE
2266 pre = wx.PreDialog()
2267 pre.SetExtraStyle(wx.DIALOG_EX_CONTEXTHELP)
2268 pre.Create(parent, ID, title, pos, size, style)
2270 self.PostCreate(pre)
2271 self.parent = parent
2272 self.optionchi = optionchi
2274 self.tableau = tableau
2275 #self.Filename=parent.filename
2276 #self.content=parent.content[:]
2277 self.headers=self.tableau.get_colnames()
2280 for i in self.headers:
2282 LABELLIST.append(i[0:60])
2287 self.LabelListOK=LABELLIST
2289 self.list_box_1 = wx.ListBox(self, -1, choices=self.LabelListOK, style=wx.LB_EXTENDED|wx.LB_HSCROLL)
2290 self.list_box_2 = wx.ListBox(self, -1, choices=self.LabelListOK, style=wx.LB_EXTENDED|wx.LB_HSCROLL)
2291 self.button_1 = wx.Button(self, wx.ID_OK)
2292 self.button_cancel = wx.Button(self, wx.ID_CANCEL)
2293 self.button_pref = wx.Button(self, wx.ID_PREFERENCES)
2294 self.__set_properties()
2297 self.Bind(wx.EVT_LISTBOX, self.selchange, self.list_box_1)
2298 self.Bind(wx.EVT_LISTBOX, self.selchange, self.list_box_2)
2299 self.Bind(wx.EVT_BUTTON, self.onparam, self.button_pref)
2300 self.button_1.Enable(False)
2302 #-------------------------------
2303 def __set_properties(self):
2304 # begin wxGlade: ConfChi2.__set_properties
2305 self.SetTitle(_(u"Variables selection").decode('utf8'))
2307 def __do_layout(self):
2308 # begin wxGlade: ConfChi2.__do_layout
2309 sizer_1 = wx.BoxSizer(wx.VERTICAL)
2310 sizer_2 = wx.BoxSizer(wx.VERTICAL)
2311 sizer_3 = wx.BoxSizer(wx.HORIZONTAL)
2312 sizer_4 = wx.BoxSizer(wx.HORIZONTAL)
2313 sizer_3.Add(self.list_box_1, 0, wx.EXPAND, 0)
2314 sizer_3.Add(self.list_box_2, 0, wx.EXPAND|wx.ALIGN_CENTER_HORIZONTAL, 0)
2315 sizer_2.Add(sizer_3, 1, wx.EXPAND, 0)
2316 sizer_4.Add(self.button_cancel, 0, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL, 0)
2317 sizer_4.Add(self.button_pref, 0, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL, 0)
2318 sizer_4.Add(self.button_1, 0, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL, 0)
2319 sizer_2.Add(sizer_4, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL, 0)
2320 sizer_1.Add(sizer_2, 1, wx.EXPAND, 0)
2321 self.SetSizer(sizer_1)
2326 def selchange(self, event): # wxGlade: ConfChi2.<event_handler>
2327 if (len(self.list_box_1.GetSelections()) == 0) or (len(self.list_box_2.GetSelections()) == 0) :
2328 self.button_1.Enable(False)
2330 self.button_1.Enable(True)
2333 def onparam(self,event):
2334 self.dial = PrefChi(self.parent, -1, self.optionchi, '')
2335 self.dial.CenterOnParent()
2336 self.chiopt = self.dial.ShowModal()
2338 class CorpusPref ( wx.Dialog ):
2340 def __init__( self, parent, parametres ):
2341 wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = _(u"Settings").decode('utf8'), pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.DEFAULT_DIALOG_STYLE | wx.STAY_ON_TOP )
2342 self.parent = parent
2343 langues_n = [u'français', u'english', u'german (expérimentale)', u'italian', u'swedish (expérimentale)', u'portuguese', u'spanish', u'greek (expériementale)', u'galician (expérimentale)', u'autre...']
2344 self.langues = [u'french', u'english', u'german', u'italian', u'swedish', u'portuguese', u'spanish', u'greek', u'galician', u'other']
2345 self.encodages = [enc[0].lower() for enc in encodages]
2347 ucimark = [u'****', u'0000']
2348 ucemethod = [_(u"characters").decode('utf8'), _(u"occurrences").decode('utf8'), _(u"paragraphs").decode('utf8')]
2350 self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
2352 bSizer1 = wx.BoxSizer( wx.VERTICAL )
2354 self.m_notebook1 = wx.Notebook( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, 0 )
2355 self.m_panel1 = wx.Panel( self.m_notebook1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
2356 fgSizer1 = wx.FlexGridSizer( 0, 2, 0, 0 )
2357 fgSizer1.SetFlexibleDirection( wx.BOTH )
2358 fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
2360 self.m_staticText7 = wx.StaticText( self.m_panel1, wx.ID_ANY, _(u"corpus").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2361 self.m_staticText7.Wrap( -1 )
2362 fgSizer1.Add( self.m_staticText7, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2364 self.txtpath = wx.StaticText( self.m_panel1, wx.ID_ANY, _(u"Path").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2365 self.txtpath.Wrap( -1 )
2366 fgSizer1.Add( self.txtpath, 0, wx.ALL, 5 )
2368 self.m_staticText18 = wx.StaticText( self.m_panel1, wx.ID_ANY, _(u"Corpus' name").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2369 self.m_staticText18.Wrap( -1 )
2370 fgSizer1.Add( self.m_staticText18, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2372 self.corpusname = wx.TextCtrl( self.m_panel1, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size( 200,-1 ), 0 )
2373 fgSizer1.Add( self.corpusname, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2375 self.m_staticText1 = wx.StaticText( self.m_panel1, wx.ID_ANY, _(u"Characters set").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2376 self.m_staticText1.Wrap( -1 )
2377 fgSizer1.Add( self.m_staticText1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2379 encodage_choicesChoices = [' - '.join(encodage) for encodage in encodages]
2380 self.encodage_choices = wx.Choice( self.m_panel1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, encodage_choicesChoices, 0 )
2381 self.encodage_choices.SetSelection( 0 )
2382 fgSizer1.Add( self.encodage_choices, 0, wx.ALL, 5 )
2384 self.m_staticText2 = wx.StaticText( self.m_panel1, wx.ID_ANY, _(u"Language").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2385 self.m_staticText2.Wrap( -1 )
2386 fgSizer1.Add( self.m_staticText2, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2388 lang_choicesChoices = langues_n
2389 self.lang_choices = wx.Choice( self.m_panel1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, lang_choicesChoices, 0 )
2390 self.lang_choices.SetSelection( 0 )
2391 fgSizer1.Add( self.lang_choices, 0, wx.ALL, 5 )
2393 self.m_staticText19 = wx.StaticText( self.m_panel1, wx.ID_ANY, _(u"Dictionary").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2394 self.m_staticText19.Wrap( -1 )
2395 fgSizer1.Add( self.m_staticText19, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2397 bSizer2 = wx.BoxSizer( wx.HORIZONTAL )
2399 fgSizer5 = wx.FlexGridSizer( 2, 2, 0, 0 )
2400 fgSizer5.SetFlexibleDirection( wx.BOTH )
2401 fgSizer5.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
2403 self.radio_default_dict = wx.RadioButton( self.m_panel1, wx.ID_ANY, _(u"Default").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2404 fgSizer5.Add( self.radio_default_dict, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2406 self.defaultdictpath = wx.TextCtrl( self.m_panel1, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size( 300,-1 ), wx.TE_READONLY )
2407 self.defaultdictpath.Enable( False )
2409 fgSizer5.Add( self.defaultdictpath, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2411 self.radio_other_dict = wx.RadioButton( self.m_panel1, wx.ID_ANY, _(u"Other").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2412 fgSizer5.Add( self.radio_other_dict, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2414 self.otherdictpath = wx.FilePickerCtrl( self.m_panel1, wx.ID_ANY, wx.EmptyString, _(u"Select a file").decode('utf8'), u"*.*", wx.DefaultPosition, wx.Size( 300,-1 ), wx.FLP_DEFAULT_STYLE )
2415 self.otherdictpath.SetMinSize(wx.Size(300, -1))
2416 fgSizer5.Add( self.otherdictpath, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2417 self.otherdictpath.Enable( False )
2420 bSizer2.Add( fgSizer5, 1, wx.EXPAND, 5 )
2423 fgSizer1.Add( bSizer2, 1, wx.EXPAND, 5 )
2425 self.m_staticText3 = wx.StaticText( self.m_panel1, wx.ID_ANY, _(u"Output folder").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2426 self.m_staticText3.Wrap( -1 )
2427 fgSizer1.Add( self.m_staticText3, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2430 fgSizer41 = wx.FlexGridSizer( 0, 2, 0, 0 )
2431 fgSizer41.SetFlexibleDirection( wx.BOTH )
2432 fgSizer41.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
2434 self.repout_choices = wx.TextCtrl( self.m_panel1, wx.ID_ANY, u"MyLabel", wx.DefaultPosition, wx.DefaultSize, 0 )
2435 self.repout_choices.SetMinSize( wx.Size( 400,-1 ) )
2436 fgSizer41.Add( self.repout_choices, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2438 self.m_button1 = wx.Button( self.m_panel1, wx.ID_ANY, _(u"Change ...").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2439 fgSizer41.Add( self.m_button1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2441 fgSizer1.Add( fgSizer41, 1, wx.EXPAND, 5 )
2443 self.m_staticText12 = wx.StaticText( self.m_panel1, wx.ID_ANY, _(u"Text mark").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2444 self.m_staticText12.Wrap( -1 )
2445 fgSizer1.Add( self.m_staticText12, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2447 ucimark_choicesChoices = ucimark
2448 self.ucimark_choices = wx.Choice( self.m_panel1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, ucimark_choicesChoices, 0 )
2449 self.ucimark_choices.SetSelection( 0 )
2450 fgSizer1.Add( self.ucimark_choices, 0, wx.ALL, 5 )
2452 self.m_staticText6 = wx.StaticText( self.m_panel1, wx.ID_ANY, _(u"Use the expression dictionary").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2453 self.m_staticText6.Wrap( -1 )
2454 fgSizer1.Add( self.m_staticText6, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2456 self.check_expressions = wx.CheckBox( self.m_panel1, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
2457 self.check_expressions.SetValue(True)
2458 fgSizer1.Add( self.check_expressions, 0, wx.ALL, 5 )
2460 self.m_staticText9 = wx.StaticText( self.m_panel1, wx.ID_ANY, _(u"Make text segments").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2461 self.m_staticText9.Wrap( -1 )
2462 fgSizer1.Add( self.m_staticText9, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2464 self.check_makeuce = wx.CheckBox( self.m_panel1, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
2465 self.check_makeuce.SetValue(True)
2466 fgSizer1.Add( self.check_makeuce, 0, wx.ALL, 5 )
2468 self.m_staticText10 = wx.StaticText( self.m_panel1, wx.ID_ANY, _(u"Text segments build process").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2469 self.m_staticText10.Wrap( -1 )
2470 fgSizer1.Add( self.m_staticText10, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2472 uce_modeChoices = ucemethod
2473 self.uce_mode = wx.Choice( self.m_panel1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, uce_modeChoices, 0 )
2474 self.uce_mode.SetSelection( 0 )
2475 fgSizer1.Add( self.uce_mode, 0, wx.ALL, 5 )
2477 self.m_staticText13 = wx.StaticText( self.m_panel1, wx.ID_ANY, _(u"Text segments size").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2478 self.m_staticText13.Wrap( -1 )
2479 fgSizer1.Add( self.m_staticText13, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2481 self.uce_size = wx.SpinCtrl( self.m_panel1, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 1, 1000000, 40 )
2482 fgSizer1.Add( self.uce_size, 0, wx.ALL, 5 )
2485 self.m_panel1.SetSizer( fgSizer1 )
2486 self.m_panel1.Layout()
2487 fgSizer1.Fit( self.m_panel1 )
2488 self.m_notebook1.AddPage( self.m_panel1, _(u"General").decode('utf8'), True )
2489 self.m_panel2 = wx.Panel( self.m_notebook1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
2490 fgSizer3 = wx.FlexGridSizer( 0, 2, 0, 0 )
2491 fgSizer3.SetFlexibleDirection( wx.BOTH )
2492 fgSizer3.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
2494 self.m_staticText4 = wx.StaticText( self.m_panel2, wx.ID_ANY, _(u"Put text in lowercase").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2495 self.m_staticText4.Wrap( -1 )
2496 fgSizer3.Add( self.m_staticText4, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2498 self.check_lower = wx.CheckBox( self.m_panel2, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
2499 self.check_lower.SetValue(True)
2500 fgSizer3.Add( self.check_lower, 0, wx.ALL, 5 )
2502 self.m_staticText5 = wx.StaticText( self.m_panel2, wx.ID_ANY, _(u"Delete characters not in this list").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2503 self.m_staticText5.Wrap( -1 )
2504 fgSizer3.Add( self.m_staticText5, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2506 fgSizer4 = wx.FlexGridSizer( 0, 2, 0, 0 )
2507 fgSizer4.SetFlexibleDirection( wx.BOTH )
2508 fgSizer4.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
2510 self.check_charact = wx.CheckBox( self.m_panel2, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
2511 self.check_charact.SetValue(True)
2512 fgSizer4.Add( self.check_charact, 0, wx.ALL, 5 )
2514 self.txt_charact = wx.TextCtrl( self.m_panel2, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
2515 self.txt_charact.SetMinSize( wx.Size( 400,-1 ) )
2517 fgSizer4.Add( self.txt_charact, 0, wx.ALL|wx.EXPAND, 5 )
2520 fgSizer3.Add( fgSizer4, 1, wx.ALIGN_CENTER_VERTICAL|wx.EXPAND, 5 )
2522 self.m_staticText14 = wx.StaticText( self.m_panel2, wx.ID_ANY, _(u"Replace apostrophe by space").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2523 self.m_staticText14.Wrap( -1 )
2524 fgSizer3.Add( self.m_staticText14, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2526 self.check_apos = wx.CheckBox( self.m_panel2, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
2527 self.check_apos.SetValue(True)
2528 fgSizer3.Add( self.check_apos, 0, wx.ALL, 5 )
2530 self.m_staticText15 = wx.StaticText( self.m_panel2, wx.ID_ANY, _(u"Replace dash by space").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2531 self.m_staticText15.Wrap( -1 )
2532 fgSizer3.Add( self.m_staticText15, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2534 self.check_tirets = wx.CheckBox( self.m_panel2, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
2535 self.check_tirets.SetValue(True)
2536 fgSizer3.Add( self.check_tirets, 0, wx.ALL, 5 )
2538 self.m_staticText17 = wx.StaticText( self.m_panel2, wx.ID_ANY, _(u"Keep punctuation").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2539 self.m_staticText17.Wrap( -1 )
2540 fgSizer3.Add( self.m_staticText17, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2542 self.check_ponct = wx.CheckBox( self.m_panel2, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
2543 fgSizer3.Add( self.check_ponct, 0, wx.ALL, 5 )
2545 self.m_staticText16 = wx.StaticText( self.m_panel2, wx.ID_ANY, _(u"No space between two forms").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2546 self.m_staticText16.Wrap( -1 )
2547 fgSizer3.Add( self.m_staticText16, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2549 self.check_tolist = wx.CheckBox( self.m_panel2, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
2550 fgSizer3.Add( self.check_tolist, 0, wx.ALL, 5 )
2553 self.m_panel2.SetSizer( fgSizer3 )
2554 self.m_panel2.Layout()
2555 fgSizer3.Fit( self.m_panel2 )
2556 self.m_notebook1.AddPage( self.m_panel2, _(u"Cleaning").decode('utf8'), False )
2558 bSizer1.Add( self.m_notebook1, 1, wx.EXPAND |wx.ALL, 5 )
2560 m_sdbSizer1 = wx.StdDialogButtonSizer()
2561 self.m_sdbSizer1OK = wx.Button( self, wx.ID_OK )
2562 m_sdbSizer1.AddButton( self.m_sdbSizer1OK )
2563 self.m_sdbSizer1Cancel = wx.Button( self, wx.ID_CANCEL )
2564 m_sdbSizer1.AddButton( self.m_sdbSizer1Cancel )
2565 m_sdbSizer1.Realize();
2567 bSizer1.Add( m_sdbSizer1, 0, wx.EXPAND, 5 )
2571 self.Bind(wx.EVT_BUTTON, self.OnChangeDir, self.m_button1)
2572 self.lang_choices.Bind( wx.EVT_CHOICE, self.OnChangeLangage )
2573 self.radio_other_dict.Bind( wx.EVT_RADIOBUTTON, self.changedictchoice )
2574 self.radio_default_dict.Bind( wx.EVT_RADIOBUTTON, self.changedictchoice )
2575 self.otherdictpath.Bind( wx.EVT_FILEPICKER_CHANGED, self.selectdict)
2577 self.setparametres(parametres)
2578 self.SetSizer( bSizer1 )
2582 self.Centre( wx.BOTH )
2584 def OnChangeDir(self, evt) :
2585 sdlg = wx.DirDialog(self.parent, _(u"Choose a folder").decode('utf8'), style = wx.DD_DEFAULT_STYLE)
2586 if sdlg.ShowModal() == wx.ID_OK :
2587 self.repout_choices.SetValue(dlg.GetPath())
2590 def __del__( self ):
2593 def setparametres(self, parametres) :
2594 if locale.getpreferredencoding().lower() == 'mac-roman' :
2595 enc = self.encodages.index('macroman')
2598 enc = self.encodages.index(locale.getpreferredencoding().lower())
2600 enc = self.encodages.index('utf-8')
2601 self.encodage_choices.SetSelection(enc)
2602 self.lang_choices.SetSelection(0)
2603 self.repout_choices.SetValue(parametres['pathout'])
2604 self.corpusname.SetValue(parametres['corpus_name'])
2605 self.ucimark_choices.SetSelection(parametres['ucimark'])
2606 self.check_expressions.SetValue(parametres['expressions'])
2607 self.check_makeuce.SetValue(parametres['douce'])
2608 self.uce_mode.SetSelection(parametres['ucemethod'])
2609 self.uce_size.SetValue(parametres['ucesize'])
2610 self.check_lower.SetValue(parametres['lower'])
2611 #self.check_charact.SetValue(parametres['charact'])
2612 self.txt_charact.SetValue(parametres['keep_caract'])
2613 self.check_apos.SetValue(parametres['apos'])
2614 self.check_tirets.SetValue(parametres['tiret'])
2615 self.check_tolist.SetValue(parametres['tolist'])
2616 self.check_ponct.SetValue(parametres['keep_ponct'])
2617 self.defaultdictpath.SetValue(self.langues[0])
2619 def doparametres(self) :
2621 parametres['encoding'] = encodages[self.encodage_choices.GetSelection()][0]
2622 parametres['lang'] = self.langues[self.lang_choices.GetSelection()]
2623 parametres['pathout'] = self.repout_choices.GetValue()
2624 parametres['corpus_name'] = self.corpusname.GetValue()
2625 parametres['ucimark'] = self.ucimark_choices.GetSelection()
2626 parametres['expressions'] = self.check_expressions.GetValue()
2627 parametres['douce'] = self.check_makeuce.GetValue()
2628 parametres['ucemethod'] = self.uce_mode.GetSelection()
2629 parametres['ucesize'] = self.uce_size.GetValue()
2630 parametres['lower'] = self.check_lower.GetValue()
2631 parametres['charact'] = self.check_charact.GetValue()
2632 parametres['keep_caract'] = self.txt_charact.GetValue()
2633 parametres['apos'] = self.check_apos.GetValue()
2634 parametres['tiret'] = self.check_tirets.GetValue()
2635 parametres['tolist'] = self.check_tolist.GetValue()
2636 parametres['keep_ponct'] = self.check_ponct.GetValue()
2637 if self.radio_other_dict.GetValue() :
2638 parametres['dictionary'] = self.otherdictpath.GetPath()
2639 for val in parametres :
2640 if isinstance(parametres[val], bool) :
2641 if parametres[val] :
2647 def OnChangeLangage(self, evt):
2648 self.defaultdictpath.SetValue(self.langues[self.lang_choices.GetSelection()])
2650 def changedictchoice(self, evt):
2651 if self.radio_default_dict.GetValue() :
2652 self.otherdictpath.Enable( False )
2653 self.m_sdbSizer1OK.Enable( True )
2655 self.otherdictpath.Enable( True )
2656 if self.otherdictpath.GetPath() == '' :
2657 self.m_sdbSizer1OK.Enable( False )
2659 def selectdict(self, evt):
2660 if self.otherdictpath.GetPath() != '' :
2661 self.m_sdbSizer1OK.Enable( True )
2665 class ConcordList(wx.HtmlListBox):
2666 def __init__(self, parent, concord):
2667 self.concord = concord
2668 #self.script_status = dict()
2669 wx.HtmlListBox.__init__(self, parent, -1, size = (900, 600))
2670 self.SetItemCount(len(concord))
2671 #self.Bind(wx.EVT_LISTBOX, self.RefreshMe)
2672 #self.Bind(wx.EVT_LISTBOX_DCLICK, self.Download)
2674 def OnGetItem(self, index):
2675 return self.concord[index] #+ '<br>'
2677 class message(wx.Frame):
2678 def __init__(self, parent, items, title, size, save = True, uceids = None):
2679 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 )
2680 self.parent = parent
2682 self.uceids = uceids
2683 self.ira = wx.GetApp().GetTopWindow()
2684 self.SetIcon(self.ira._icon)
2685 #self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
2688 #self.HtmlPage=wx.html.HtmlWindow(self, -1)
2689 self.panel = wx.Panel(self, wx.ID_ANY)
2690 self.HtmlPage = ConcordList(self.panel, items)
2691 #self.HtmlPage.SetMinSize( size )
2692 #if "gtk2" in wx.PlatformInfo:
2693 # self.HtmlPage.SetStandardFonts()
2694 #self.HtmlPage.SetFonts('Courier','Courier')
2696 self.button_1 = wx.Button(self.panel, wx.ID_CANCEL)
2698 self.Bind(wx.EVT_BUTTON, self.OnCloseMe, self.button_1)
2699 #self.HtmlPage.Bind(wx.wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, self.Download)
2700 self.HtmlPage.Bind(wx.html.EVT_HTML_LINK_CLICKED, self.OnLink)
2702 self.button_2 = wx.Button(self.panel, wx.ID_SAVE)
2703 self.Bind(wx.EVT_BUTTON, self.OnSavePage, self.button_2)
2704 if self.uceids is not None :
2705 self.butsub = wx.Button(self.panel, -1, _(u"Build sub corpus").decode('utf8'))
2706 self.Bind(wx.EVT_BUTTON, self.OnSub, self.butsub)
2707 self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)
2710 def __do_layout(self):
2711 sizer_2 = wx.BoxSizer(wx.VERTICAL)
2712 sizer_2.Add(self.HtmlPage, 1, wx.EXPAND|wx.ADJUST_MINSIZE, 0)
2713 #m_sdbSizer1 = wx.StdDialogButtonSizer()
2714 m_sdbSizer1 = wx.BoxSizer(wx.HORIZONTAL)
2715 m_sdbSizer1.Add( self.button_1 , 0, wx.ALIGN_RIGHT | wx.EXPAND)
2717 m_sdbSizer1.Add( self.button_2 , 0, wx.ALIGN_RIGHT | wx.EXPAND)
2718 if self.uceids is not None :
2719 m_sdbSizer1.Add( self.butsub , 0, wx.ALIGN_RIGHT | wx.EXPAND)
2720 #m_sdbSizer1.Realize()
2721 #self.panel.SetSizer( m_sdbSizer1 )
2722 sizer_2.Add( m_sdbSizer1, 0, wx.ALIGN_RIGHT, 5)
2723 self.panel.SetSizer(sizer_2)
2727 def OnSavePage(self, evt) :
2728 dlg = wx.FileDialog(
2729 self, message=_(u"Save as ...").decode('utf8'), defaultDir=os.getcwd(),
2730 defaultFile="concordancier.html", wildcard="html|*.html", style=wx.SAVE | wx.OVERWRITE_PROMPT
2732 #dlg.SetFilterIndex(2)
2733 dlg.CenterOnParent()
2734 self.html = '<br>'.join([self.items[i] for i in range(0,len(self.items))])
2735 if dlg.ShowModal() == wx.ID_OK:
2736 path = dlg.GetPath()
2737 with open(path, 'w') as f :
2740 def OnLink(self, evt):
2741 corpus = self.ira.tree.page.corpus
2742 link = evt.GetLinkInfo().GetHref().split('_')
2743 uciid = int(link[0])
2744 uceid = int(link[1])
2745 et = '<b>' + ' '.join(corpus.ucis[uciid].etoiles) + '</b><br>\n'
2746 txt = corpus.getuciconcorde_uces(uciid, uceid)
2747 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])
2748 txt = '<html>\n<body>\n' + et + txt + '\n</body>\n</html>'
2749 fullframe = FullText(self.ira)
2750 fullframe.m_htmlWin1.SetPage(txt)
2753 def OnCloseMe(self, event):
2756 def OnCloseWindow(self, event):
2759 def OnSub(self ,evt):
2760 parametres = {'fromuceids' : True, 'uceids' : self.uceids, 'isempty' : True}
2761 self.ira.OnSubText(wx.MenuEvent(), None, parametres)
2764 class ExtractDialog ( wx.Dialog ):
2766 def __init__( self, parent, option ):
2767 wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = wx.EmptyString, pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.DEFAULT_DIALOG_STYLE )
2769 self.option = option
2771 self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
2773 fgSizer1 = wx.FlexGridSizer( 0, 2, 0, 0 )
2774 fgSizer1.SetFlexibleDirection( wx.BOTH )
2775 fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
2777 self.m_staticText1 = wx.StaticText( self, wx.ID_ANY, _(u"corpus").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2778 self.m_staticText1.Wrap( -1 )
2779 fgSizer1.Add( self.m_staticText1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2781 self.corpusfile = wx.FilePickerCtrl( self, wx.ID_ANY, wx.EmptyString, _(u"Select a file").decode('utf8'), u"*.txt", wx.DefaultPosition, wx.Size( -1,-1 ), wx.FLP_DEFAULT_STYLE|wx.FLP_FILE_MUST_EXIST|wx.FLP_OPEN )
2782 self.corpusfile.SetMinSize( wx.Size( 500,-1 ) )
2784 fgSizer1.Add( self.corpusfile, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL|wx.EXPAND, 5 )
2786 self.m_staticText2 = wx.StaticText( self, wx.ID_ANY, _(u"Characters set").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2787 self.m_staticText2.Wrap( -1 )
2788 fgSizer1.Add( self.m_staticText2, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2790 encodageChoices = [' - '.join(encodage) for encodage in encodages]
2791 self.encodage = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, encodageChoices, 0 )
2792 self.encodage.SetSelection( 0 )
2793 self.encodage.SetMinSize( wx.Size( 200,-1 ) )
2795 fgSizer1.Add( self.encodage, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL|wx.EXPAND, 5 )
2797 if option == 'splitvar' :
2798 self.m_staticText3 = wx.StaticText( self, wx.ID_ANY, _(u"Variables (with the * but without the _)").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2799 self.m_staticText3.Wrap( -1 )
2800 fgSizer1.Add( self.m_staticText3, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2802 self.txtvar = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
2803 self.txtvar.SetMinSize( wx.Size( 200,-1 ) )
2805 fgSizer1.Add( self.txtvar, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL|wx.EXPAND, 5 )
2807 if option == 'mods' :
2808 self.m_staticText4 = wx.StaticText( self, wx.ID_ANY, _(u"Modalities (one by line, with the *)").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2809 self.m_staticText4.Wrap( -1 )
2810 fgSizer1.Add( self.m_staticText4, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2812 self.txtmods = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.TE_MULTILINE )
2813 self.txtmods.SetMinSize( wx.Size( 200,150 ) )
2815 fgSizer1.Add( self.txtmods, 0, wx.ALL|wx.EXPAND, 5 )
2817 self.m_staticText5 = wx.StaticText( self, wx.ID_ANY, _(u"Extraction type").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2818 self.m_staticText5.Wrap( -1 )
2819 fgSizer1.Add( self.m_staticText5, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2821 extractformatChoices = [ _(u"Only one file").decode('utf8'), _(u"One file by modality").decode('utf8') ]
2822 self.extractformat = wx.RadioBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, extractformatChoices, 1, wx.RA_SPECIFY_COLS )
2823 self.extractformat.SetSelection( 0 )
2824 fgSizer1.Add( self.extractformat, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2826 if option == 'them' :
2827 self.m_staticText4 = wx.StaticText( self, wx.ID_ANY, _(u"thematics (one by line, with the -*)").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2828 self.m_staticText4.Wrap( -1 )
2829 fgSizer1.Add( self.m_staticText4, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2831 self.txtmods = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.TE_MULTILINE )
2832 self.txtmods.SetMinSize( wx.Size( 200,150 ) )
2834 fgSizer1.Add( self.txtmods, 0, wx.ALL|wx.EXPAND, 5 )
2836 #self.m_staticText5 = wx.StaticText( self, wx.ID_ANY, _(u"Extraction type").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2837 #self.m_staticText5.Wrap( -1 )
2838 #fgSizer1.Add( self.m_staticText5, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2840 #extractformatChoices = [ _(u"Only one file").decode('utf8'), _(u"One file by thematic").decode('utf8') ]
2841 #self.extractformat = wx.RadioBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, extractformatChoices, 1, wx.RA_SPECIFY_COLS )
2842 #self.extractformat.SetSelection( 0 )
2843 #fgSizer1.Add( self.extractformat, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2846 fgSizer1.AddSpacer( ( 0, 0), 1, wx.EXPAND, 5 )
2848 m_sdbSizer1 = wx.StdDialogButtonSizer()
2849 self.m_sdbSizer1OK = wx.Button( self, wx.ID_OK )
2850 m_sdbSizer1.AddButton( self.m_sdbSizer1OK )
2851 self.m_sdbSizer1Cancel = wx.Button( self, wx.ID_CANCEL )
2852 m_sdbSizer1.AddButton( self.m_sdbSizer1Cancel )
2853 m_sdbSizer1.Realize()
2855 fgSizer1.Add( m_sdbSizer1, 1, wx.EXPAND, 5 )
2858 self.SetSizer( fgSizer1 )
2860 fgSizer1.Fit( self )
2862 self.Centre( wx.BOTH )
2864 def make_param(self) :
2866 le = [enc[0].lower() for enc in encodages]
2867 parametres['filein'] = self.corpusfile.GetPath()
2868 encodage = le[self.encodage.GetSelection()]
2869 parametres['encodein'] = encodage
2870 if self.option == 'splitvar' :
2871 parametres['var'] = self.txtvar.GetValue()
2872 if self.option == 'mods' :
2873 parametres['mods'] = self.txtmods.GetValue().splitlines()
2874 if self.extractformat.GetSelection() == 0 :
2875 parametres['onefile'] = True
2877 parametres['onefile'] = False
2878 if self.option == 'them' :
2879 parametres['them'] = self.txtmods.GetValue().splitlines()
2880 # if self.extractformat.GetSelection() == 0 :
2881 # parametres['onefile'] = True
2883 # parametres['onefile'] = False
2884 parametres['encodeout'] = le[self.encodage.GetSelection()]
2887 def __del__( self ):
2890 class FreqDialog ( wx.Dialog ):
2892 def __init__( self, parent, listcol, title, size = wx.Size( -1,-1 ), showNA = True):
2893 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 )
2895 self.header = listcol
2897 self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
2899 bSizer1 = wx.BoxSizer( wx.VERTICAL )
2901 m_listBox1Choices = self.header
2902 self.m_listBox1 = wx.ListBox( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, m_listBox1Choices, wx.LB_EXTENDED|wx.LB_HSCROLL )
2903 self.m_listBox1.SetMinSize( wx.Size( 500,-1 ) )
2904 bSizer1.Add( self.m_listBox1, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2907 fgSizer1 = wx.FlexGridSizer( 0, 2, 0, 0 )
2908 fgSizer1.SetFlexibleDirection( wx.BOTH )
2909 fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
2911 self.m_staticText1 = wx.StaticText( self, wx.ID_ANY, _(u"Include empty cells (NA)").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2912 self.m_staticText1.Wrap( -1 )
2913 fgSizer1.Add( self.m_staticText1, 0, wx.ALL, 5 )
2915 self.includeNA = wx.CheckBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
2916 fgSizer1.Add( self.includeNA, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2918 bSizer1.Add( fgSizer1, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL, 5 )
2920 m_sdbSizer1 = wx.StdDialogButtonSizer()
2921 self.m_sdbSizer1OK = wx.Button( self, wx.ID_OK )
2922 m_sdbSizer1.AddButton( self.m_sdbSizer1OK )
2923 self.m_sdbSizer1Cancel = wx.Button( self, wx.ID_CANCEL )
2924 m_sdbSizer1.AddButton( self.m_sdbSizer1Cancel )
2925 m_sdbSizer1.Realize();
2927 bSizer1.Add( m_sdbSizer1, 0, wx.EXPAND, 5 )
2930 self.SetSizer( bSizer1 )
2934 self.Centre( wx.BOTH )
2935 self.Bind(wx.EVT_LISTBOX, self.selchange, self.m_listBox1)
2936 self.m_sdbSizer1OK.Enable(False)
2938 def __del__( self ):
2941 def selchange(self, evt):
2942 if len(self.m_listBox1.GetSelections()) == 0 :
2943 self.m_sdbSizer1OK.Enable(False)
2945 self.m_sdbSizer1OK.Enable(True)
2947 class ProtoDial ( wx.Dialog ):
2949 def __init__( self, parent, headers ):
2950 wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = _(u"Settings").decode('utf8'), pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.DEFAULT_DIALOG_STYLE )
2952 self.SetSizeHintsSz( wx.Size( -1,-1 ), wx.DefaultSize )
2954 bSizer1 = wx.BoxSizer( wx.VERTICAL )
2956 fgSizer1 = wx.FlexGridSizer( 0, 2, 0, 0 )
2957 fgSizer1.SetFlexibleDirection( wx.BOTH )
2958 fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
2960 self.m_staticText1 = wx.StaticText( self, wx.ID_ANY, _(u"Variables").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2961 self.m_staticText1.Wrap( -1 )
2962 fgSizer1.Add( self.m_staticText1, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALL, 5 )
2964 self.m_staticText2 = wx.StaticText( self, wx.ID_ANY, _(u"Ranks").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2965 self.m_staticText2.Wrap( -1 )
2966 fgSizer1.Add( self.m_staticText2, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALL, 5 )
2968 variablesChoices = headers
2969 self.variables = wx.ListBox( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, variablesChoices, wx.LB_HSCROLL|wx.LB_MULTIPLE )
2970 self.variables.SetMinSize( wx.Size( 350,-1 ) )
2972 fgSizer1.Add( self.variables, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL|wx.EXPAND, 5 )
2974 rangsChoices = headers
2975 self.rangs = wx.ListBox( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, rangsChoices, wx.LB_HSCROLL|wx.LB_MULTIPLE )
2976 self.rangs.SetMinSize( wx.Size( 350,-1 ) )
2978 fgSizer1.Add( self.rangs, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL|wx.EXPAND, 5 )
2981 bSizer1.Add( fgSizer1, 1, wx.ALIGN_CENTER_HORIZONTAL, 5 )
2983 fgSizer3 = wx.FlexGridSizer( 0, 2, 0, 0 )
2984 fgSizer3.SetFlexibleDirection( wx.BOTH )
2985 fgSizer3.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
2987 self.m_staticText3 = wx.StaticText( self, wx.ID_ANY, _(u"Limit frequency").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2988 self.m_staticText3.Wrap( -1 )
2989 fgSizer3.Add( self.m_staticText3, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2991 bSizer2 = wx.BoxSizer( wx.HORIZONTAL )
2993 choix_freqChoices = [ _(u"automatic (mean)").decode('utf8'), _(u"manual").decode('utf8') ]
2994 self.choix_freq = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, choix_freqChoices, 0 )
2995 self.choix_freq.SetSelection( 0 )
2996 bSizer2.Add( self.choix_freq, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2998 self.freqlim = wx.TextCtrl( self, wx.ID_ANY, u"0", wx.DefaultPosition, wx.DefaultSize, wx.TE_CENTRE )
2999 self.freqlim.Enable( False )
3000 self.freqlim.SetMinSize( wx.Size( 100,-1 ) )
3002 bSizer2.Add( self.freqlim, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
3005 fgSizer3.Add( bSizer2, 1, wx.EXPAND, 5 )
3007 self.m_staticText4 = wx.StaticText( self, wx.ID_ANY, _(u"Limit rank").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
3008 self.m_staticText4.Wrap( -1 )
3009 fgSizer3.Add( self.m_staticText4, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
3011 bSizer21 = wx.BoxSizer( wx.HORIZONTAL )
3013 choix_rangChoices = [ _(u"automatic (mean)").decode('utf8'), _(u"manual").decode('utf8')]
3014 self.choix_rang = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, choix_rangChoices, 0 )
3015 self.choix_rang.SetSelection( 0 )
3016 bSizer21.Add( self.choix_rang, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
3018 self.ranglim = wx.TextCtrl( self, wx.ID_ANY, u"0", wx.DefaultPosition, wx.DefaultSize, wx.TE_CENTRE )
3019 self.ranglim.Enable( False )
3020 self.ranglim.SetMinSize( wx.Size( 100,-1 ) )
3022 bSizer21.Add( self.ranglim, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
3025 fgSizer3.Add( bSizer21, 1, wx.EXPAND, 5 )
3027 self.m_staticText5 = wx.StaticText( self, wx.ID_ANY, _(u"Minimum frequency").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
3028 self.m_staticText5.Wrap( -1 )
3029 fgSizer3.Add( self.m_staticText5, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
3031 self.m_textCtrl4 = wx.TextCtrl( self, wx.ID_ANY, u"2", wx.DefaultPosition, wx.DefaultSize, wx.TE_CENTRE )
3032 fgSizer3.Add( self.m_textCtrl4, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALL, 5 )
3034 self.m_staticText6 = wx.StaticText( self, wx.ID_ANY, u"Type de représentation", wx.DefaultPosition, wx.DefaultSize, 0 )
3035 self.m_staticText6.Wrap( -1 )
3036 fgSizer3.Add( self.m_staticText6, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
3038 m_choice3Choices = [ u"Classical - List", u"Classical - Cloud", u"Plan" ]
3039 self.typegraph = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, m_choice3Choices, 0 )
3040 self.typegraph.SetSelection( 0 )
3041 fgSizer3.Add( self.typegraph, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALL, 5 )
3043 bSizer1.Add( fgSizer3, 0, wx.ALIGN_CENTER_HORIZONTAL, 5 )
3045 m_sdbSizer1 = wx.StdDialogButtonSizer()
3046 self.m_sdbSizer1OK = wx.Button( self, wx.ID_OK )
3047 m_sdbSizer1.AddButton( self.m_sdbSizer1OK )
3048 self.m_sdbSizer1Cancel = wx.Button( self, wx.ID_CANCEL )
3049 m_sdbSizer1.AddButton( self.m_sdbSizer1Cancel )
3050 m_sdbSizer1.Realize();
3052 bSizer1.Add( m_sdbSizer1, 0, wx.EXPAND, 5 )
3054 self.SetSizer( bSizer1 )
3058 self.Centre( wx.BOTH )
3061 self.choix_freq.Bind( wx.EVT_CHOICE, self.UpdateText )
3062 self.choix_rang.Bind( wx.EVT_CHOICE, self.UpdateText )
3063 self.Bind(wx.EVT_LISTBOX, self.selchange, self.variables)
3064 self.Bind(wx.EVT_LISTBOX, self.selchange, self.rangs)
3066 self.m_sdbSizer1OK.Enable(False)
3068 def __del__( self ):
3071 def selchange(self, evt):
3072 if (len(self.variables.GetSelections()) == 0) or (len(self.rangs.GetSelections()) == 0) or (len(self.variables.GetSelections()) != len(self.rangs.GetSelections())) :
3073 self.m_sdbSizer1OK.Enable(False)
3075 self.m_sdbSizer1OK.Enable(True)
3078 # Virtual event handlers, overide them in your derived class
3079 def UpdateText( self, event ):
3082 class SimpleDialog ( wx.Dialog ):
3084 def __init__( self, parent ):
3085 wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = wx.EmptyString, pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.DEFAULT_DIALOG_STYLE )
3087 self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
3089 bSizer1 = wx.BoxSizer( wx.VERTICAL )
3091 self.m_panel1 = wx.Panel( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
3092 bSizer2 = wx.BoxSizer( wx.VERTICAL )
3094 self.m_staticText1 = wx.StaticText( self.m_panel1, wx.ID_ANY, _(u"Export finished. Open in a web browser :").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
3095 self.m_staticText1.Wrap( -1 )
3096 bSizer2.Add( self.m_staticText1, 0, wx.ALL, 5 )
3098 self.link = wx.HyperlinkCtrl( self.m_panel1, wx.ID_ANY, u"wxFB Website", u"http://www.wxformbuilder.org", wx.DefaultPosition, wx.DefaultSize, wx.HL_DEFAULT_STYLE )
3099 bSizer2.Add( self.link, 0, wx.ALL, 5 )
3102 self.m_panel1.SetSizer( bSizer2 )
3103 self.m_panel1.Layout()
3104 bSizer2.Fit( self.m_panel1 )
3105 bSizer1.Add( self.m_panel1, 1, wx.EXPAND |wx.ALL, 5 )
3107 m_sdbSizer1 = wx.StdDialogButtonSizer()
3108 self.m_sdbSizer1OK = wx.Button( self, wx.ID_OK )
3109 m_sdbSizer1.AddButton( self.m_sdbSizer1OK )
3110 m_sdbSizer1.Realize();
3112 bSizer1.Add( m_sdbSizer1, 0, wx.EXPAND, 5 )
3115 self.SetSizer( bSizer1 )
3119 self.Centre( wx.BOTH )
3121 def __del__( self ):
3125 class SubTextFromMetaDial ( wx.Dialog ):
3127 def __init__( self, parent, parametres ):
3128 wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = _(u"Subcorpus").decode('utf8'), pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.DEFAULT_DIALOG_STYLE )
3130 self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
3132 bSizer1 = wx.BoxSizer( wx.VERTICAL )
3134 fgSizer1 = wx.FlexGridSizer( 0, 2, 0, 0 )
3135 fgSizer1.SetFlexibleDirection( wx.BOTH )
3136 fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
3138 self.m_staticText1 = wx.StaticText( self, wx.ID_ANY, _(u"Name").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
3139 self.m_staticText1.Wrap( -1 )
3140 fgSizer1.Add( self.m_staticText1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
3142 self.subcorpusname = wx.TextCtrl( self, wx.ID_ANY, parametres['corpus_name'], wx.DefaultPosition, wx.Size( 300,-1 ), 0 )
3143 fgSizer1.Add( self.subcorpusname, 0, wx.ALL, 5 )
3145 self.m_staticText2 = wx.StaticText( self, wx.ID_ANY, _(u"Select one or more metadata").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
3146 self.m_staticText2.Wrap( -1 )
3147 fgSizer1.Add( self.m_staticText2, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
3149 m_listBox1Choices = parametres['meta']
3150 self.m_listBox1 = wx.ListBox( self, wx.ID_ANY, wx.DefaultPosition, wx.Size( -1,-1 ), m_listBox1Choices, wx.LB_HSCROLL|wx.LB_MULTIPLE )
3151 self.m_listBox1.SetMinSize( wx.Size( -1,200 ) )
3152 self.m_listBox1.SetMaxSize( wx.Size( -1,500 ) )
3154 fgSizer1.Add( self.m_listBox1, 0, wx.ALL|wx.EXPAND, 5 )
3157 bSizer1.Add( fgSizer1, 1, wx.EXPAND, 5 )
3159 m_sdbSizer1 = wx.StdDialogButtonSizer()
3160 self.m_sdbSizer1OK = wx.Button( self, wx.ID_OK )
3161 m_sdbSizer1.AddButton( self.m_sdbSizer1OK )
3162 self.m_sdbSizer1Cancel = wx.Button( self, wx.ID_CANCEL )
3163 m_sdbSizer1.AddButton( self.m_sdbSizer1Cancel )
3164 m_sdbSizer1.Realize();
3166 bSizer1.Add( m_sdbSizer1, 0, wx.EXPAND, 5 )
3169 self.SetSizer( bSizer1 )
3173 self.Centre( wx.BOTH )
3174 self.Bind(wx.EVT_LISTBOX, self.onchoose, self.m_listBox1)
3175 if not parametres.get('isempty', False) :
3176 self.m_sdbSizer1OK.Enable(False)
3178 def __del__( self ):
3181 def onchoose(self, evt):
3182 if len(self.m_listBox1.GetSelections()) > 0 :
3183 self.m_sdbSizer1OK.Enable(True)
3185 self.m_sdbSizer1OK.Enable(False)
3187 class BarGraphDialog ( wx.Dialog ):
3189 def __init__( self, parent, width, height ):
3190 wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = _(u"Preferences").decode('utf8'), pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.DEFAULT_DIALOG_STYLE )
3192 self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
3194 bSizer1 = wx.BoxSizer( wx.VERTICAL )
3196 bSizer2 = wx.BoxSizer( wx.HORIZONTAL )
3198 self.m_staticText1 = wx.StaticText( self, wx.ID_ANY, _(u"Size").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
3199 self.m_staticText1.Wrap( -1 )
3200 bSizer2.Add( self.m_staticText1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
3202 sizeradioChoices = [ _(u"automatic").decode('utf8'), _(u"manual").decode('utf8') ]
3203 self.sizeradio = wx.RadioBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, sizeradioChoices, 1, wx.RA_SPECIFY_COLS )
3204 self.sizeradio.SetSelection( 0 )
3205 bSizer2.Add( self.sizeradio, 0, wx.ALIGN_TOP|wx.ALL, 5 )
3207 fgSizer1 = wx.FlexGridSizer( 0, 2, 0, 0 )
3208 fgSizer1.SetFlexibleDirection( wx.BOTH )
3209 fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
3211 self.m_staticText2 = wx.StaticText( self, wx.ID_ANY, _(u"width").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
3212 self.m_staticText2.Wrap( -1 )
3213 fgSizer1.Add( self.m_staticText2, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
3215 self.widthsp = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 0, 1000000, 600 )
3216 fgSizer1.Add( self.widthsp, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
3218 self.m_staticText3 = wx.StaticText( self, wx.ID_ANY, _(u"height").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
3219 self.m_staticText3.Wrap( -1 )
3220 fgSizer1.Add( self.m_staticText3, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
3222 self.heightsp = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 1, 10000000, 400 )
3223 fgSizer1.Add( self.heightsp, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
3226 bSizer2.Add( fgSizer1, 1, wx.EXPAND, 5 )
3229 bSizer1.Add( bSizer2, 1, wx.EXPAND, 5 )
3231 bSizer3 = wx.BoxSizer( wx.HORIZONTAL )
3233 self.m_staticText4 = wx.StaticText( self, wx.ID_ANY, _(u"Image format").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
3234 self.m_staticText4.Wrap( -1 )
3235 bSizer3.Add( self.m_staticText4, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
3237 formatChoices = [ u"png", u"svg" ]
3238 self.format = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, formatChoices, 0 )
3239 self.format.SetSelection( 0 )
3240 bSizer3.Add( self.format, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
3243 bSizer1.Add( bSizer3, 1, wx.EXPAND, 5 )
3245 m_sdbSizer1 = wx.StdDialogButtonSizer()
3246 self.m_sdbSizer1OK = wx.Button( self, wx.ID_OK )
3247 m_sdbSizer1.AddButton( self.m_sdbSizer1OK )
3248 self.m_sdbSizer1Cancel = wx.Button( self, wx.ID_CANCEL )
3249 m_sdbSizer1.AddButton( self.m_sdbSizer1Cancel )
3250 m_sdbSizer1.Realize();
3252 bSizer1.Add( m_sdbSizer1, 0, wx.EXPAND, 5 )
3255 self.SetSizer( bSizer1 )
3259 self.Centre( wx.BOTH )
3262 self.sizeradio.Bind( wx.EVT_RADIOBOX, self.OnSizeRadio )
3264 self.widthsp.SetValue(width)
3265 self.heightsp.SetValue(height)
3266 self.widthsp.Enable(False)
3267 self.heightsp.Enable(False)
3268 self.m_sdbSizer1OK.SetFocus()
3270 def __del__( self ):
3274 # Virtual event handlers, overide them in your derived class
3275 def OnSizeRadio( self, event ):
3276 if self.sizeradio.GetSelection() == 0 :
3277 self.widthsp.Enable(False)
3278 self.heightsp.Enable(False)
3280 self.widthsp.Enable(True)
3281 self.heightsp.Enable(True)
3284 class ImageViewer ( wx.Frame ):
3286 def __init__( self, parent, parametres, title, size ):
3287 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 )
3289 self.ira = wx.GetApp().GetTopWindow()
3290 self.SetIcon(self.ira._icon)
3291 self.parametres = parametres
3292 self.imageFile = self.parametres['tmpgraph']
3293 if parametres['svg'] == 'TRUE' :
3294 self.imagename = u"image.svg"
3296 self.imagename = u"image.png"
3298 self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
3300 bSizer1 = wx.BoxSizer( wx.VERTICAL )
3302 self.m_panel1 = wx.ScrolledWindow(self, -1)# wx.Panel( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.HSCROLL|wx.TAB_TRAVERSAL|wx.VSCROLL )
3303 self.m_panel1.SetScrollbars(1, 1, 200, 300)
3304 bSizer2 = wx.BoxSizer( wx.VERTICAL )
3306 if parametres['svg'] == 'FALSE' :
3307 image = wx.Image(self.imageFile, wx.BITMAP_TYPE_PNG)
3308 W = image.GetWidth()
3309 H = image.GetHeight()
3314 image = image.ConvertToBitmap()
3315 self.m_bitmap1 = wx.StaticBitmap( self.m_panel1, wx.ID_ANY, image, wx.DefaultPosition, wx.DefaultSize, 0 )
3316 bSizer2.Add( self.m_bitmap1, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
3318 link = hl.HyperLinkCtrl(self.m_panel1, wx.ID_ANY, u"Click on this link", URL=self.imageFile )
3319 bSizer2.Add( link, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
3321 self.m_panel1.SetSizer( bSizer2 )
3322 self.m_panel1.Layout()
3323 bSizer2.Fit( self.m_panel1 )
3324 bSizer1.Add( self.m_panel1, 1, wx.EXPAND |wx.ALL, 5 )
3326 panel = wx.Panel(self, -1)
3327 m_sdbSizer1 = wx.StdDialogButtonSizer()
3328 self.m_sdbSizer1Save = wx.Button( panel, wx.ID_SAVE )
3329 m_sdbSizer1.AddButton( self.m_sdbSizer1Save )
3330 self.m_sdbSizer1Cancel = wx.Button( panel, wx.ID_CANCEL )
3331 m_sdbSizer1.AddButton( self.m_sdbSizer1Cancel )
3332 m_sdbSizer1.Realize();
3334 panel.SetSizer( m_sdbSizer1 )
3336 bSizer1.Add( panel, 0, wx.EXPAND, 5 )
3339 self.SetSizer( bSizer1 )
3342 self.Centre( wx.BOTH )
3344 if parametres['svg'] == 'FALSE' :
3345 self.SetSize((W + 30,H + 30))
3347 self.Bind(wx.EVT_BUTTON, self.OnCloseMe, self.m_sdbSizer1Cancel)
3348 self.Bind(wx.EVT_BUTTON, self.OnSaveImage, self.m_sdbSizer1Save)
3350 def __del__( self ):
3353 def OnCloseMe(self, event):
3356 def OnSaveImage(self, event) :
3357 dlg = wx.FileDialog(
3358 self, message=_(u"Save as...").decode('utf8'), defaultDir=self.parametres.get('pathout',os.getcwd()),
3359 defaultFile= self.imagename, wildcard=self.parametres['wildcard'], style=wx.SAVE | wx.OVERWRITE_PROMPT
3361 dlg.SetFilterIndex(0)
3362 dlg.CenterOnParent()
3363 if dlg.ShowModal() == wx.ID_OK:
3364 path = dlg.GetPath()
3365 copyfile(self.imageFile, path)
3368 def __init__(self, ira, table, colnames, rownames, tree = False):
3370 width = 100 + (10*len(rownames)) + (100 * len(colnames))
3371 height = len(rownames) * 15
3376 height = (35 * len(colnames)) + (15 * len(rownames))
3377 dial = BarGraphDialog(ira, width, height)
3378 val = dial.ShowModal()
3379 if val == wx.ID_OK :
3380 tmpgraph = tempfile.mktemp(dir=ira.TEMPDIR)
3381 if dial.format.GetSelection() == 0 :
3383 wildcard = "png|*.png"
3387 wildcard = "svg|*.svg"
3389 pathout = ira.tree.page.pathout[fout]
3390 parametres = {'width' : dial.widthsp.GetValue(),
3391 'height': dial.heightsp.GetValue(),
3392 'colnames' : colnames,
3393 'rownames' : rownames,
3394 'tmpgraph' : tmpgraph,
3395 'rgraph' : ira.RscriptsPath['Rgraph'],
3397 'wildcard' : wildcard,
3401 parametres['tree'] = tree
3402 txt = barplot(table, parametres)
3403 tmpscript = tempfile.mktemp(dir=ira.TEMPDIR)
3404 with open(tmpscript,'w') as f :
3406 exec_rcode(ira.RPath, tmpscript, wait = True)
3407 win = ImageViewer(ira, parametres, _(u"Graphic").decode('utf8'), size=(700, 500))
3412 def __init__(self, ira, parametres, pathout, which = 'chi2'):
3415 self.parametres = parametres
3416 self.pathout = pathout
3418 dial = BarGraphDialog(ira, width, height)
3419 val = dial.ShowModal()
3420 if val == wx.ID_OK :
3421 tmpgraph = tempfile.mktemp(dir=ira.TEMPDIR)
3422 if dial.format.GetSelection() == 0 :
3424 wildcard = "png|*.png"
3427 wildcard = "svg|*.svg"
3428 parametres = {'width' : dial.widthsp.GetValue(),
3429 'height': dial.heightsp.GetValue(),
3430 'tmpgraph' : tmpgraph,
3432 'wildcard' : wildcard}
3433 self.parametres.update(parametres)
3434 if which == 'chi2' :
3435 script = ChronoChi2Script(self)
3436 elif which == 'prop' :
3437 script = ChronoPropScript(self)
3438 elif which == 'gg' :
3439 script = ChronoggScript(self)
3440 script.make_script()
3441 exec_rcode(ira.RPath, script.scriptout, wait = True)
3442 win = ImageViewer(ira, self.parametres, _(u"Graphic").decode('utf8'), size=(700, 500))
3448 class MergeDialog ( wx.Dialog ):
3450 def __init__( self, parent ):
3451 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 )
3453 self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
3455 bSizer1 = wx.BoxSizer( wx.VERTICAL )
3457 self.m_scrolledWindow1 = wx.ScrolledWindow( self, wx.ID_ANY, wx.DefaultPosition, wx.Size( 600,200 ), wx.HSCROLL|wx.VSCROLL )
3458 self.m_scrolledWindow1.SetScrollRate( 5, 5 )
3459 #self.m_scrolledWindow1.SetMinSize( wx.Size( 500,200 ) )
3461 fgSizer2 = wx.FlexGridSizer( 0, 2, 0, 0 )
3462 fgSizer2.AddGrowableCol( 1 )
3463 fgSizer2.SetFlexibleDirection( wx.BOTH )
3464 fgSizer2.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_ALL )
3466 self.m_staticText3 = wx.StaticText( self.m_scrolledWindow1, wx.ID_ANY, u"graphe 1", wx.DefaultPosition, wx.DefaultSize, 0 )
3467 self.m_staticText3.Wrap( -1 )
3468 fgSizer2.Add( self.m_staticText3, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
3470 self.m_filePicker3 = wx.FilePickerCtrl( self.m_scrolledWindow1, wx.ID_ANY, wx.EmptyString, u"Select a file", u"*.*", wx.DefaultPosition, wx.DefaultSize, wx.FLP_DEFAULT_STYLE|wx.FLP_FILE_MUST_EXIST|wx.FLP_USE_TEXTCTRL )
3471 self.m_filePicker3.SetMinSize( wx.Size( 400,-1 ) )
3473 fgSizer2.Add( self.m_filePicker3, 1, wx.ALIGN_CENTER_VERTICAL|wx.ALL|wx.EXPAND, 5 )
3475 self.m_staticText4 = wx.StaticText( self.m_scrolledWindow1, wx.ID_ANY, u"graphe 2", wx.DefaultPosition, wx.DefaultSize, 0 )
3476 self.m_staticText4.Wrap( -1 )
3477 fgSizer2.Add( self.m_staticText4, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
3479 self.m_filePicker4 = wx.FilePickerCtrl( self.m_scrolledWindow1, wx.ID_ANY, wx.EmptyString, u"Select a file", u"*.*", wx.DefaultPosition, wx.DefaultSize, wx.FLP_DEFAULT_STYLE|wx.FLP_FILE_MUST_EXIST|wx.FLP_USE_TEXTCTRL )
3480 self.m_filePicker4.SetMinSize( wx.Size( 400,-1 ) )
3482 fgSizer2.Add( self.m_filePicker4, 1, wx.ALL|wx.EXPAND, 5 )
3485 self.m_scrolledWindow1.SetSizer( fgSizer2 )
3486 self.m_scrolledWindow1.Layout()
3487 bSizer1.Add( self.m_scrolledWindow1, 0, wx.ALL, 5 )
3489 self.button_add = wx.Button( self, wx.ID_ANY, u"Add graphe", wx.DefaultPosition, wx.DefaultSize, 0 )
3490 bSizer1.Add( self.button_add, 1, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
3492 m_sdbSizer1 = wx.StdDialogButtonSizer()
3493 self.m_sdbSizer1OK = wx.Button( self, wx.ID_OK )
3494 m_sdbSizer1.AddButton( self.m_sdbSizer1OK )
3495 self.m_sdbSizer1Cancel = wx.Button( self, wx.ID_CANCEL )
3496 m_sdbSizer1.AddButton( self.m_sdbSizer1Cancel )
3497 m_sdbSizer1.Realize();
3499 bSizer1.Add( m_sdbSizer1, 1, wx.EXPAND, 5 )
3502 self.SetSizer( bSizer1 )
3506 self.Centre( wx.BOTH )
3509 self.button_add.Bind( wx.EVT_BUTTON, self.OnAddGraphe )
3510 self.m_filePicker3.Bind(wx.EVT_FILEPICKER_CHANGED, self.OnFileChange)
3511 self.m_filePicker4.Bind(wx.EVT_FILEPICKER_CHANGED, self.OnFileChange)
3512 self.finish(fgSizer2, bSizer1)
3514 def __del__( self ):
3517 def finish(self, fgSizer2, bSizer1):
3518 self.graphs = [self.m_filePicker3, self.m_filePicker4]
3519 self.fgSizer2 = fgSizer2
3520 self.bSizer1 = bSizer1
3522 def OnFileChange(self, evt):
3523 obj = evt.GetEventObject()
3524 if obj.GetPath() != '' :
3525 for graph in self.graphs :
3526 graph.SetInitialDirectory(os.path.dirname(obj.GetPath()))
3528 # Virtual event handlers, overide them in your derived class
3529 def OnAddGraphe( self, event ):
3530 lab = wx.StaticText( self.m_scrolledWindow1, wx.ID_ANY, ' '.join(['graphe', `len(self.graphs) + 1`]), wx.DefaultPosition, wx.DefaultSize, 0 )
3532 self.graphs.append( wx.FilePickerCtrl( self.m_scrolledWindow1, wx.ID_ANY, wx.EmptyString, u"Select a file", u"*.*", wx.DefaultPosition, wx.DefaultSize, wx.FLP_DEFAULT_STYLE|wx.FLP_FILE_MUST_EXIST|wx.FLP_USE_TEXTCTRL ) )
3533 self.graphs[-1].SetMinSize( wx.Size( 400, -1))
3534 if self.graphs[-2].GetPath() != '' :
3535 self.graphs[-1].SetInitialDirectory(os.path.dirname(self.graphs[-2].GetPath()))
3536 self.graphs[-1].Bind(wx.EVT_FILEPICKER_CHANGED, self.OnFileChange)
3537 self.fgSizer2.Add( lab, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
3538 self.fgSizer2.Add( self.graphs[-1], 1, wx.ALIGN_CENTER_VERTICAL|wx.ALL|wx.EXPAND, 5 )
3539 self.m_scrolledWindow1.Layout()
3540 self.m_scrolledWindow1.SetSizer( self.fgSizer2 )
3541 #self.fgSizer2.Fit( self.m_scrolledWindow1 )
3543 #self.bSizer1.Fit(self)
3546 def RemoveGraphe(self, evt ):
3550 class translate_dialog ( wx.Dialog ):
3552 def __init__( self, parent ):
3553 wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = _(u'Translate Profile').decode('utf8'), pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.DEFAULT_DIALOG_STYLE )
3555 self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
3557 bSizer7 = wx.BoxSizer( wx.VERTICAL )
3559 bSizer1 = wx.BoxSizer( wx.HORIZONTAL )
3561 from_lChoices = translation_languages.keys()
3562 from_lChoices.sort()
3563 self.from_l = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, from_lChoices, 0 )
3564 self.from_l.SetSelection( 0 )
3565 bSizer1.Add( self.from_l, 0, wx.ALL, 5 )
3567 self.m_staticText1 = wx.StaticText( self, wx.ID_ANY, _(u"to").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
3568 self.m_staticText1.Wrap( -1 )
3569 bSizer1.Add( self.m_staticText1, 0, wx.ALL, 5 )
3571 to_lChoices = from_lChoices
3572 self.to_l = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, to_lChoices, 0 )
3573 self.to_l.SetSelection( 0 )
3574 bSizer1.Add( self.to_l, 0, wx.ALL, 5 )
3577 bSizer7.Add( bSizer1, 1, wx.EXPAND, 5 )
3579 m_sdbSizer1 = wx.StdDialogButtonSizer()
3580 self.m_sdbSizer1OK = wx.Button( self, wx.ID_OK )
3581 m_sdbSizer1.AddButton( self.m_sdbSizer1OK )
3582 self.m_sdbSizer1Cancel = wx.Button( self, wx.ID_CANCEL )
3583 m_sdbSizer1.AddButton( self.m_sdbSizer1Cancel )
3584 m_sdbSizer1.Realize();
3586 bSizer7.Add( m_sdbSizer1, 1, wx.EXPAND, 5 )
3589 self.SetSizer( bSizer7 )
3593 self.Centre( wx.BOTH )
3595 def __del__( self ):
3598 def getfrom_l(self) :
3599 return translation_languages[self.from_l.GetStringSelection()]
3602 return translation_languages[self.to_l.GetStringSelection()]
3605 class MergeClusterFrame ( wx.Dialog ):
3607 def __init__( self, parent):
3608 #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 )
3609 wx.Dialog.__init__( self, parent, id = wx.ID_ANY, title = _(u'Merge Clusters').decode('utf8'), style = wx.DEFAULT_DIALOG_STYLE)
3611 self.ira = wx.GetApp().GetTopWindow()
3612 self.SetIcon(self.ira._icon)
3614 self.nameselection = {}
3617 self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
3619 bSizer1 = wx.BoxSizer( wx.VERTICAL )
3621 self.m_panel1 = wx.Panel( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
3622 self.m_panel1.SetBackgroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_WINDOW ) )
3624 fgSizer2 = wx.FlexGridSizer( 0, 2, 0, 0 )
3625 fgSizer2.SetFlexibleDirection( wx.BOTH )
3626 fgSizer2.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
3628 self.m_staticText5 = wx.StaticText( self.m_panel1, wx.ID_ANY, u"Select clusters", wx.DefaultPosition, wx.DefaultSize, 0 )
3629 self.m_staticText5.Wrap( -1 )
3630 fgSizer2.Add( self.m_staticText5, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALL, 5 )
3632 self.m_staticText7 = wx.StaticText( self.m_panel1, wx.ID_ANY, u"Already selected", wx.DefaultPosition, wx.DefaultSize, 0 )
3633 self.m_staticText7.Wrap( -1 )
3634 fgSizer2.Add( self.m_staticText7, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALL, 5 )
3636 self.m_treeCtrl2 = wx.TreeCtrl( self.m_panel1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TR_DEFAULT_STYLE|wx.TR_MULTIPLE )
3637 fgSizer2.Add( self.m_treeCtrl2, 5, wx.ALL|wx.EXPAND, 5 )
3638 self.m_treeCtrl2.SetMinSize( wx.Size( 350,400 ) )
3639 self.tree = self.m_treeCtrl2
3641 m_listBox4Choices = []
3642 self.m_listBox4 = wx.ListBox( self.m_panel1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, m_listBox4Choices, wx.LB_MULTIPLE )
3643 self.m_listBox4.SetMinSize( wx.Size( 350,400 ) )
3644 fgSizer2.Add( self.m_listBox4, 0, wx.ALL|wx.EXPAND, 5 )
3646 self.m_button2 = wx.Button( self.m_panel1, wx.ID_ANY, u"Select", wx.DefaultPosition, wx.DefaultSize, 0 )
3647 fgSizer2.Add( self.m_button2, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
3649 self.m_button3 = wx.Button( self.m_panel1, wx.ID_ANY, u"Unselect", wx.DefaultPosition, wx.DefaultSize, 0 )
3650 fgSizer2.Add( self.m_button3, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
3653 self.m_panel1.SetSizer( fgSizer2 )
3654 self.m_panel1.Layout()
3655 fgSizer2.Fit( self.m_panel1 )
3656 bSizer1.Add( self.m_panel1, 4, wx.EXPAND |wx.ALL, 5 )
3658 self.m_panel4 = wx.Panel( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
3659 bSizer5 = wx.BoxSizer( wx.HORIZONTAL )
3661 self.m_staticText13 = wx.StaticText( self.m_panel4, wx.ID_ANY, u"MyLabel", wx.DefaultPosition, wx.DefaultSize, 0 )
3662 self.m_staticText13.Wrap( -1 )
3663 bSizer5.Add( self.m_staticText13, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
3665 self.m_textCtrl5 = wx.TextCtrl( self.m_panel4, wx.ID_ANY, u"cl_", wx.DefaultPosition, wx.DefaultSize, 0 )
3666 self.m_textCtrl5.SetMinSize( wx.Size( 400,-1 ) )
3668 bSizer5.Add( self.m_textCtrl5, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
3670 self.m_staticText15 = wx.StaticText( self.m_panel4, wx.ID_ANY, u"+cluster number", wx.DefaultPosition, wx.DefaultSize, 0 )
3671 self.m_staticText15.Wrap( -1 )
3672 bSizer5.Add( self.m_staticText15, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
3675 self.m_panel4.SetSizer( bSizer5 )
3676 self.m_panel4.Layout()
3677 bSizer5.Fit( self.m_panel4 )
3678 bSizer1.Add( self.m_panel4, 1, wx.EXPAND |wx.ALL, 5 )
3680 self.m_panel3 = wx.Panel( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
3681 bSizer4 = wx.BoxSizer( wx.HORIZONTAL )
3683 self.m_staticText12 = wx.StaticText( self.m_panel3, wx.ID_ANY, u"Corpus name", wx.DefaultPosition, wx.DefaultSize, 0 )
3684 self.m_staticText12.Wrap( -1 )
3685 bSizer4.Add( self.m_staticText12, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
3687 self.m_textCtrl4 = wx.TextCtrl( self.m_panel3, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
3688 self.m_textCtrl4.SetMinSize( wx.Size( 400,-1 ) )
3690 bSizer4.Add( self.m_textCtrl4, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
3692 self.m_panel3.SetSizer( bSizer4 )
3693 self.m_panel3.Layout()
3694 bSizer4.Fit( self.m_panel3 )
3695 bSizer1.Add( self.m_panel3, 1, wx.EXPAND |wx.ALL, 5 )
3697 m_sdbSizer6 = wx.StdDialogButtonSizer()
3698 self.m_sdbSizer6OK = wx.Button( self, wx.ID_OK )
3699 m_sdbSizer6.AddButton( self.m_sdbSizer6OK )
3700 self.m_sdbSizer6Cancel = wx.Button( self, wx.ID_CANCEL )
3701 m_sdbSizer6.AddButton( self.m_sdbSizer6Cancel )
3702 m_sdbSizer6.Realize();
3704 bSizer1.Add( m_sdbSizer6, 1, wx.EXPAND, 5 )
3706 self.SetSizer( bSizer1 )
3711 self.Centre( wx.BOTH )
3714 self.m_treeCtrl2.Bind( wx.EVT_TREE_ITEM_ACTIVATED, self.OnItemSelect )
3715 self.m_treeCtrl2.Bind(wx.EVT_TREE_SEL_CHANGED, self.OnItemActivated )
3716 self.m_treeCtrl2.Bind( wx.EVT_TREE_ITEM_EXPANDED, self.OnItemActivated )
3717 self.m_listBox4.Bind( wx.EVT_LEFT_DCLICK, self.OnUnSelect )
3718 self.m_button3.Bind( wx.EVT_BUTTON, self.OnUnSelect )
3719 #self.Bind(wx.EVT_SIZE, self.OnSize)
3723 def __del__( self ):
3726 def feedtree( self ):
3728 il = wx.ImageList(isz[0], isz[1])
3732 #corpusidx = il.Add(wx.ArtProvider_GetBitmap(wx.ART_FOLDER, wx.ART_OTHER, isz))
3733 #fldropenidx = il.Add(wx.ArtProvider_GetBitmap(wx.ART_FOLDER_OPEN, wx.ART_OTHER, isz))
3734 #fileidx = il.Add(wx.ArtProvider_GetBitmap(wx.ART_NORMAL_FILE, wx.ART_OTHER, isz))
3735 #smileidx = il.Add(images.Smiles.GetBitmap())
3736 #self.selectidx = il.Add(wx.ArtProvider_GetBitmap(wx.ART_TICK_MARK, wx.ART_OTHER, isz))
3737 for img in self.ira.images_analyses :
3738 self.ild[img] = self.il.Add(self.ira.images_analyses[img])
3739 self.ild['selected'] = il.Add(wx.ArtProvider_GetBitmap(wx.ART_TICK_MARK, wx.ART_OTHER, isz))
3740 #self.SetImageList(self.il)
3742 self.tree.SetImageList(il)
3745 history = self.ira.tree.history
3746 self.tree.root = self.tree.AddRoot("Corpus")
3747 self.tree.SetItemImage(self.tree.root, self.ild['textroot'], wx.TreeItemIcon_Normal)
3748 self.tree.SetItemImage(self.tree.root, self.ild['textroot'], wx.TreeItemIcon_Expanded)
3749 self.tree.SetPyData(self.tree.root, {'root':"root"})
3750 for corpus in reversed(history.history) :
3751 if 'analyses' in corpus :
3752 for analyse in corpus['analyses'] :
3753 if analyse['type'] == 'alceste' :
3754 if corpus['uuid'] not in self.intree :
3755 child = self.tree.AppendItem(self.tree.root, corpus['corpus_name'])
3756 self.tree.SetItemImage(child, self.ild['corpus'], wx.TreeItemIcon_Normal)
3757 self.tree.SetItemImage(child, self.ild['corpus'], wx.TreeItemIcon_Expanded)
3758 self.tree.SetPyData(child, corpus)
3759 self.intree[corpus['uuid']] = corpus
3760 last = self.tree.AppendItem(child, analyse['name'])
3761 self.tree.SetItemImage(last, self.ild['reinert'], wx.TreeItemIcon_Normal)
3762 self.tree.SetItemImage(last, self.ild['reinert'], wx.TreeItemIcon_Expanded)
3764 self.tree.SetPyData(last, analyse)
3766 parametres = DoConf(analyse['ira']).getoptions()
3767 clnb = int(parametres['clnb'])
3768 for i in range(clnb) :
3769 cl = self.tree.AppendItem(last, 'classe %i' % (i+1))
3770 self.tree.SetItemImage(cl, self.ild['wordcloud'], wx.TreeItemIcon_Normal)
3771 self.tree.SetItemImage(cl, self.ild['wordcloud'], wx.TreeItemIcon_Expanded)
3772 self.tree.SetPyData(cl, {'type' : 'cluster', 'analyse': analyse['uuid'], 'number': i+1, 'corpus': analyse['corpus'], 'ira':analyse['ira']})
3776 def OnItemSelect( self, event ):
3777 item = event.GetItem()
3779 pydata = self.tree.GetPyData(item)
3780 if pydata.get('type', '') == 'cluster' :
3781 if (pydata['analyse'], pydata['corpus'], pydata['number']) not in self.selected :
3782 text = self.m_textCtrl5.GetValue() + '%03d' % pydata['number']
3783 if text in self.nameselection :
3784 dlg = wx.MessageDialog(self, 'This name: %s - is already use' % text, 'Problem', wx.OK | wx.ICON_ERROR)
3788 self.m_listBox4.Append(text)
3789 self.selected[(pydata['analyse'], pydata['corpus'], pydata['number'])] = self.m_textCtrl5.GetValue() + '%03d' % pydata['number']
3790 self.items[(pydata['analyse'], pydata['corpus'], pydata['number'])] = item
3791 self.nameselection[self.m_textCtrl5.GetValue() + '%03d' % pydata['number']] = (pydata['analyse'], pydata['corpus'], pydata['number'])
3792 self.irapath[pydata['analyse']] = pydata['ira']
3793 self.tree.SetItemImage(item, self.ild['selected'])
3796 def OnItemActivated(self, event) :
3797 item = event.GetItem()
3799 pydata = self.tree.GetPyData(item)
3800 if pydata.get('type', '') == 'alceste' :
3801 self.m_textCtrl5.SetValue('cl_' + pydata['name'])
3803 # Virtual event handlers, overide them in your derived class
3804 def OnSelect( self, event ):
3805 item = self.m_listBox3.GetSelection()
3806 text = self.m_textCtrl5.GetValue() + '%03d' % item
3807 self.m_listBox4.Append(text)
3810 def OnUnSelect( self, event ):
3811 selections = self.m_listBox4.GetSelections()
3812 selections = list(selections)
3813 selections.reverse()
3814 for val in selections :
3815 ref = self.nameselection[self.m_listBox4.GetString(val)]
3816 #item = self.getItemFromUUID(itemParent=None, uuid=ref[0])
3817 item = self.items[ref]
3818 self.tree.SetItemImage(item, self.ild['wordcloud'])
3819 del self.selected[ref]
3820 del self.nameselection[self.m_listBox4.GetString(val)]
3822 self.m_listBox4.Delete(val)
3826 class FullText ( wx.Frame ):
3828 def __init__( self, parent ):
3829 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 )
3831 self.SetSizeHints( -1, -1 )
3833 bSizer1 = wx.BoxSizer( wx.VERTICAL )
3835 self.m_panel1 = wx.Panel( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
3836 bSizer2 = wx.BoxSizer( wx.VERTICAL )
3838 self.m_htmlWin1 = wx.html.HtmlWindow( self.m_panel1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.html.HW_SCROLLBAR_AUTO )
3839 bSizer2.Add( self.m_htmlWin1, 8, wx.ALL | wx.EXPAND, 5 )
3841 #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 )
3842 #bSizer2.Add( self.m_richText1, 9, wx.EXPAND |wx.ALL, 5 )
3844 m_sdbSizer1 = wx.StdDialogButtonSizer()
3845 self.m_sdbSizer1OK = wx.Button( self.m_panel1, wx.ID_OK )
3846 m_sdbSizer1.AddButton( self.m_sdbSizer1OK )
3847 self.m_sdbSizer1Cancel = wx.Button( self.m_panel1, wx.ID_CANCEL )
3848 m_sdbSizer1.AddButton( self.m_sdbSizer1Cancel )
3849 m_sdbSizer1.Realize();
3851 bSizer2.Add( m_sdbSizer1, 0, wx.EXPAND, 5 )
3854 self.m_panel1.SetSizer( bSizer2 )
3855 self.m_panel1.Layout()
3856 bSizer2.Fit( self.m_panel1 )
3857 bSizer1.Add( self.m_panel1, 1, wx.EXPAND |wx.ALL, 5 )
3860 self.SetSizer( bSizer1 )
3863 self.Centre( wx.BOTH )
3865 def __del__( self ):