2 # -*- coding: utf-8 -*-
3 #Author: Pierre Ratinaud
4 #Copyright (c) 2008-2009 Pierre Ratinaud
7 import wx.lib.colourselect as csel
8 import wx.lib.sized_controls as sc
9 import wx.lib.filebrowsebutton as filebrowse
11 from functions import DoConf, exec_rcode
13 from shutil import copyfile
14 from PrintRScript import barplot
17 from KeyFrame import AlcOptFrame
18 #---------------------------------------------------------------------------
19 provider = wx.SimpleHelpProvider()
20 wx.HelpProvider_Set(provider)
22 #---------------------------------------------------------------------------
25 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']]
27 class FileOptionDialog(wx.Dialog):
29 self, parent, ID, title, sep=False, sheet = False, size=wx.DefaultSize, pos=wx.DefaultPosition,
30 style=wx.DEFAULT_DIALOG_STYLE
34 pre.SetExtraStyle(wx.DIALOG_EX_CONTEXTHELP)
35 pre.Create(parent, ID, title, pos, size, style)
39 sizer = wx.BoxSizer(wx.VERTICAL)
40 grid_sizer = wx.FlexGridSizer(0, 2, 2, 2)
41 ##############################
43 label = wx.StaticText(self, -1, _(u"First line is header").decode('utf8'))
44 label.SetHelpText(_(u"First line is header").decode('utf8'))
45 grid_sizer.Add(label, 0, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
46 on = [ _(u"yes").decode('utf8'), _(u"no").decode('utf8') ]
47 self.radio_box_1 = wx.RadioBox(self, -1, u"", choices=on, majorDimension=0, style=wx.RA_SPECIFY_ROWS)
48 self.radio_box_1.SetHelpText(_(u"First line is header").decode('utf8'))
49 grid_sizer.Add(self.radio_box_1, 1, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
51 ##############################
53 label = wx.StaticText(self, -1, _(u"First column is an id").decode('utf8'))
54 label.SetHelpText(_(u"First column is an id").decode('utf8'))
55 grid_sizer.Add(label, 0, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
56 on = [ _(u"yes").decode('utf8'), _(u"no").decode('utf8') ]
57 self.radio_box_2 = wx.RadioBox(self, -1, u"", choices=on, majorDimension=0, style=wx.RA_SPECIFY_ROWS)
58 self.radio_box_2.SetHelpText(_(u"First column is an id").decode('utf8'))
59 grid_sizer.Add(self.radio_box_2, 1, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
61 ##############################
63 label = wx.StaticText(self, -1, _(u"Column separator").decode('utf8'))
64 label.SetHelpText(_(u"Column separator").decode('utf8'))
65 grid_sizer.Add(label, 0, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
66 self.colsep = [";", "tabulation", ","]
67 self.choice3 = wx.Choice(self, -1, (100, 50), choices=self.colsep)
68 self.choice3.SetHelpText(_(u"Column separator").decode('utf8'))
69 grid_sizer.Add(self.choice3, 1, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
71 ##############################
73 label = wx.StaticText(self, -1, _(u"Text separator").decode('utf8'))
74 label.SetHelpText(_(u"Text separator").decode('utf8'))
75 grid_sizer.Add(label, 0, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
76 self.txtsep = ["\"", "'"]
77 self.choice4 = wx.Choice(self, -1, (100, 50), choices=self.txtsep)
78 self.choice4.SetHelpText(_(u"Text separator").decode('utf8'))
79 grid_sizer.Add(self.choice4, 1, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
80 self.choice3.SetSelection(0)
81 self.choice4.SetSelection(0)
82 self.text = wx.StaticText(self, -1, _(u"Characters set").decode('utf8'))
83 grid_sizer.Add(self.text, 1, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
84 self.le = [enc[0].lower() for enc in encodages]
85 self.list_encodages = wx.Choice(self, -1, (25, 30), choices=[' - '.join(encodage) for encodage in encodages])
86 if locale.getpreferredencoding().lower() == 'mac-roman' :
87 enc = self.le.index('macroman')
90 enc = self.le.index(sys.getdefaultencoding().lower())
92 enc = self.le.index('utf-8')
93 self.list_encodages.SetSelection(enc)
94 grid_sizer.Add(self.list_encodages, 1, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
96 label = wx.StaticText(self, -1, u"Feuille ")
97 grid_sizer.Add(label, 0, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
98 self.spin1 = wx.SpinCtrl(self, -1, '',size = (100,30), min=1, max=500)
99 grid_sizer.Add(self.spin1, 1, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
101 sizer.Add(grid_sizer, 0, wx.GROW | wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5)
104 line = wx.StaticLine(self, -1, size=(20, -1), style=wx.LI_HORIZONTAL)
105 sizer.Add(line, 0, wx.GROW | wx.ALIGN_CENTER_VERTICAL | wx.RIGHT | wx.TOP, 5)
107 btnsizer = wx.StdDialogButtonSizer()
109 if wx.Platform != "__WXMSW__":
110 btn = wx.ContextHelpButton(self)
111 btnsizer.AddButton(btn)
113 btn = wx.Button(self, wx.ID_OK)
115 btnsizer.AddButton(btn)
117 btn = wx.Button(self, wx.ID_CANCEL)
118 btnsizer.AddButton(btn)
121 sizer.Add(btnsizer, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_CENTER_HORIZONTAL, 5)
127 class ClusterNbDialog(wx.Dialog):
129 self, LIST_CLASSE, parent, ID, title, size=wx.DefaultSize, pos=wx.DefaultPosition,
130 style=wx.DEFAULT_DIALOG_STYLE
134 pre.SetExtraStyle(wx.DIALOG_EX_CONTEXTHELP)
135 pre.Create(parent, ID, title, pos, size, style)
139 # Now continue with the normal construction of the dialog
141 sizer = wx.BoxSizer(wx.VERTICAL)
143 label = wx.StaticText(self, -1, u"Résultats de la classification")
144 label.SetHelpText("This is the help text for the label")
145 sizer.Add(label, 0, wx.ALIGN_CENTRE | wx.ALL, 5)
147 box = wx.BoxSizer(wx.HORIZONTAL)
149 label = wx.StaticText(self, -1, u"Choisissez le nombre de classes")
150 label.SetHelpText("This is the help text for the label")
151 box.Add(label, 0, wx.ALIGN_CENTRE | wx.ALL, 5)
153 if type(LIST_CLASSE) != float :
154 for i in LIST_CLASSE :
155 LIST_CLASSE_OK.append(str(i))
157 LIST_CLASSE_OK.append(str(LIST_CLASSE))
158 self.list_box_1 = wx.ListBox(self, -1, choices=LIST_CLASSE_OK, style=wx.LB_SINGLE | wx.LB_HSCROLL)
159 self.list_box_1.SetHelpText("Here's some help text for field #1")
160 box.Add(self.list_box_1, 1, wx.ALIGN_CENTRE | wx.ALL, 5)
162 sizer.Add(box, 0, wx.GROW | wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5)
165 ###############################
166 line = wx.StaticLine(self, -1, size=(20, -1), style=wx.LI_HORIZONTAL)
167 sizer.Add(line, 0, wx.GROW | wx.ALIGN_CENTER_VERTICAL | wx.RIGHT | wx.TOP, 5)
169 btnsizer = wx.StdDialogButtonSizer()
171 if wx.Platform != "__WXMSW__":
172 btn = wx.ContextHelpButton(self)
173 btnsizer.AddButton(btn)
175 btn = wx.Button(self, wx.ID_OK)
177 btnsizer.AddButton(btn)
179 btn = wx.Button(self, wx.ID_CANCEL)
180 btnsizer.AddButton(btn)
183 sizer.Add(btnsizer, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5)
188 class CHDDialog(wx.Dialog):
190 self, parent, ID, title, size=wx.DefaultSize, pos=wx.DefaultPosition,
191 style=wx.DEFAULT_DIALOG_STYLE | wx.CANCEL
194 pre.SetExtraStyle(wx.DIALOG_EX_CONTEXTHELP)
195 pre.Create(parent, ID, title, pos, size, style)
199 self.colsep = parent.colsep
201 self.content = parent.content[:]
202 self.header = parent.header[:]
204 for i in self.header:
206 LABELLIST.append(i[0:60])
209 self.LABELLISTTOT = LABELLIST
211 #----------------------------------------------------------------------------------------------------
212 self.text1 = wx.StaticText(self, -1, u"Variables Actives (au moins 3)")
213 self.text2 = wx.StaticText(self, -1, u"Variables Supplémentaires (au moins 1)")
214 self.list_box_1 = wx.ListBox(self, -1, choices=LABELLIST, style=wx.LB_EXTENDED | wx.LB_HSCROLL)
215 self.list_box_2 = wx.ListBox(self, -1, choices=LABELLIST, style=wx.LB_EXTENDED | wx.LB_HSCROLL)
216 self.button_cancel = wx.Button(self, wx.ID_CANCEL)
217 self.button_back = wx.Button(self, wx.ID_BACKWARD)
218 self.button_forw = wx.Button(self, wx.ID_FORWARD)
219 self.button_ok = wx.Button(self, wx.ID_OK)
220 self.button_pref = wx.Button(self, wx.ID_PROPERTIES)
221 self.button_selectall = wx.Button(self, wx.NewId(), u"Sélectionner tout")
222 self.__set_properties()
225 self.Bind(wx.EVT_BUTTON, self.OnPrec, self.button_back)
226 self.Bind(wx.EVT_BUTTON, self.OnSuivant, self.button_forw)
227 self.Bind(wx.EVT_BUTTON, self.OnValider, self.button_ok)
228 self.Bind(wx.EVT_BUTTON, self.OnSelectAll, self.button_selectall)
231 self.TEMPDIR = parent.TEMPDIR
234 def __set_properties(self):
235 # begin wxGlade: ConfChi2.__set_properties
236 self.SetTitle(u"Sélection des variables")
237 self.list_box_2.Enable(False)
238 self.button_ok.Enable(False)
239 self.button_back.Enable(False)
242 def __do_layout(self):
243 # begin wxGlade: ConfChi2.__do_layout
244 sizer_1 = wx.BoxSizer(wx.VERTICAL)
245 sizer_2 = wx.BoxSizer(wx.VERTICAL)
246 sizer_3 = wx.BoxSizer(wx.HORIZONTAL)
247 sizer_4 = wx.BoxSizer(wx.HORIZONTAL)
248 sizer_5 = wx.BoxSizer(wx.HORIZONTAL)
249 sizer_6 = wx.BoxSizer(wx.HORIZONTAL)
250 sizer_7 = wx.BoxSizer(wx.HORIZONTAL)
251 sizer_5.Add(self.text1, 1, wx.CENTER | wx.ALL, 0)
252 sizer_5.Add(self.text2, 1, wx.CENTER | wx.ALL, 0)
253 sizer_3.Add(self.list_box_1, 0, wx.EXPAND, 0)
254 sizer_3.Add(self.list_box_2, 0, wx.EXPAND, 0)
255 sizer_6.Add(self.button_selectall, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL, 0)
256 sizer_7.Add(self.button_cancel, 0, wx.ALL, 0)
257 sizer_7.Add(self.button_pref, 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
258 sizer_7.Add(self.button_ok, 0, wx.wx.ALIGN_CENTER_HORIZONTAL, 0)
259 sizer_4.Add(self.button_back, 0, wx.ALL, 0)
260 sizer_4.Add(self.button_forw, 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
261 sizer_2.Add(sizer_5, 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
262 sizer_2.Add(sizer_3, 1, wx.EXPAND, 0)
263 sizer_2.Add(sizer_6, 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
264 sizer_2.Add(sizer_4, 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
265 sizer_2.Add(sizer_7, 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
266 sizer_1.Add(sizer_2, 1, wx.EXPAND, 4)
267 self.SetSizer(sizer_1)
271 #--------------FIXME-----------------------
272 #NETTOYAGE des variables inutiles
273 def OnSuivant(self, event):
274 LISTACTIVE = self.list_box_1.GetSelections()
275 if len(LISTACTIVE) != len(self.LABELLISTTOT) and len(LISTACTIVE) >= 3:
276 self.button_ok.Enable(True)
278 self.LISTHEADERINDICE = []
279 self.LISTNUMACTIVE = []
281 header = self.header[:]
282 for i in range(0, len(header)):
283 self.LISTHEADERINDICE.append(i)
284 for i in LISTACTIVE :
285 self.LISTNUMACTIVE.append(i)
286 header.pop(i - COMPT)
287 self.LISTHEADERINDICE.pop(i - COMPT)
292 self.LABELLIST.append(i[0:60])
294 self.LABELLIST.append(i)
295 self.list_box_2.Clear()
296 for i in self.LABELLIST :
297 self.list_box_2.Append(i)
299 self.list_box_1.Enable(False)
300 self.list_box_2.Enable(True)
301 self.button_forw.Enable(False)
302 self.button_back.Enable(True)
304 def OnValider(self, event):
305 LISTVARSUPSEL = self.list_box_2.GetSelections()
306 for i in LISTVARSUPSEL :
307 self.LISTVARSUP.append(self.LISTHEADERINDICE[i])
310 def OnPrec(self, event):
311 self.list_box_1.Enable(True)
312 self.list_box_2.Enable(False)
313 self.button_forw.Enable(True)
314 self.button_back.Enable(False)
315 self.button_ok.Enable(False)
319 def OnSelectAll(self, event):
321 for i in range(len(self.LABELLISTTOT)):
322 self.list_box_1.Select(i)
324 for i in range(len(self.LABELLIST)):
325 self.list_box_2.Select(i)
327 class PrefDialog ( wx.Dialog ):
329 def __init__( self, parent ):
330 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 )
333 self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
335 bSizer1 = wx.BoxSizer( wx.VERTICAL )
337 fgSizer1 = wx.FlexGridSizer( 0, 3, 0, 0 )
338 fgSizer1.SetFlexibleDirection( wx.BOTH )
339 fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
341 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 )
342 self.m_staticText1.Wrap( -1 )
343 fgSizer1.Add( self.m_staticText1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
345 self.m_staticText2 = wx.StaticText( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
346 self.m_staticText2.Wrap( -1 )
347 fgSizer1.Add( self.m_staticText2, 0, wx.ALL, 5 )
349 m_radioBox1Choices = [ _(u"yes").decode('utf8'), _(u"no").decode('utf8') ]
350 self.m_radioBox1 = wx.RadioBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, m_radioBox1Choices, 1, wx.RA_SPECIFY_COLS )
351 self.m_radioBox1.SetSelection( 0 )
352 fgSizer1.Add( self.m_radioBox1, 0, wx.ALIGN_RIGHT|wx.ALL, 5 )
354 msg = _(u"""Check for new
355 releases at startup""").decode('utf8')
356 self.m_staticText3 = wx.StaticText( self, wx.ID_ANY, msg, wx.DefaultPosition, wx.DefaultSize, 0 )
357 self.m_staticText3.Wrap( -1 )
358 fgSizer1.Add( self.m_staticText3, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
360 self.m_staticText4 = wx.StaticText( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
361 self.m_staticText4.Wrap( -1 )
362 fgSizer1.Add( self.m_staticText4, 0, wx.ALL, 5 )
364 m_radioBox2Choices = [ _(u"yes").decode('utf8'), _(u"no").decode('utf8') ]
365 self.m_radioBox2 = wx.RadioBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, m_radioBox2Choices, 1, wx.RA_SPECIFY_COLS )
366 self.m_radioBox2.SetSelection( 0 )
367 fgSizer1.Add( self.m_radioBox2, 0, wx.ALIGN_RIGHT|wx.ALL, 5 )
369 msg = _(u"Interface language").decode('utf8')
370 self.m_staticText45 = wx.StaticText( self, wx.ID_ANY, msg, wx.DefaultPosition, wx.DefaultSize, 0 )
371 self.m_staticText45.Wrap( -1 )
372 fgSizer1.Add( self.m_staticText45, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
374 self.m_staticText46 = wx.StaticText( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
375 self.m_staticText46.Wrap( -1 )
376 fgSizer1.Add( self.m_staticText46, 0, wx.ALL, 5 )
378 self.listlangues = [ u"french", u"english", u"spanish", u"portuguese", u"italian" ]
379 self.langues = wx.Choice( self, wx.ID_ANY, (200, -1), choices = self.listlangues)
380 #self.langues.SetSelection( 0 )
381 fgSizer1.Add( self.langues, 0, wx.ALIGN_RIGHT|wx.ALL, 5 )
383 msg = _(u"""Check installation
384 of R packages""").decode('utf8')
385 self.m_staticText5 = wx.StaticText( self, wx.ID_ANY, msg, wx.DefaultPosition, wx.DefaultSize, 0 )
386 self.m_staticText5.Wrap( -1 )
387 fgSizer1.Add( self.m_staticText5, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
389 self.m_staticText6 = wx.StaticText( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
390 self.m_staticText6.Wrap( -1 )
391 fgSizer1.Add( self.m_staticText6, 0, wx.ALL, 5 )
393 self.m_button1 = wx.Button( self, wx.ID_ANY, _(u"Check").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
394 fgSizer1.Add( self.m_button1, 0, wx.ALIGN_RIGHT|wx.ALL, 5 )
396 bSizer1.Add( fgSizer1, 1, wx.EXPAND, 5 )
397 if sys.platform == 'win32' :
398 bSizer2 = wx.BoxSizer( wx.HORIZONTAL )
401 memory for R""").decode('utf8')
402 self.m_staticText7 = wx.StaticText( self, wx.ID_ANY, msg, wx.DefaultPosition, wx.DefaultSize, 0 )
403 self.m_staticText7.Wrap( -1 )
404 bSizer2.Add( self.m_staticText7, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
406 self.m_checkBox1 = wx.CheckBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
407 bSizer2.Add( self.m_checkBox1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
409 self.m_spinCtrl1 = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 32, 16000, 1535 )
410 bSizer2.Add( self.m_spinCtrl1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
412 self.m_staticline7 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
413 bSizer2.Add( self.m_staticline7, 0, wx.EXPAND |wx.ALL, 5 )
415 bSizer1.Add( bSizer2, 0, wx.EXPAND, 5 )
416 self.m_checkBox1.Bind( wx.EVT_CHECKBOX, self.oncheckmem )
418 bSizer3 = wx.BoxSizer( wx.HORIZONTAL )
419 bSizer4 = wx.BoxSizer( wx.HORIZONTAL )
420 self.text8 = wx.StaticText( self, wx.ID_ANY, _(u"Use svdlibc").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
421 self.text8.Wrap( -1 )
422 fgSizer1.Add( self.text8, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
423 self.check_svdc = wx.CheckBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
424 bSizer4.Add( self.check_svdc, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
425 bSizer3.Add( bSizer4, 0, wx.EXPAND, 5 )
426 self.fbb = filebrowse.FileBrowseButton(self, -1, size=(250, -1), fileMode = 2, fileMask = '*')
427 bSizer3.Add( self.fbb, 0, wx.EXPAND, 5 )
428 self.fbb.SetLabel(_(u"Path : ").decode('utf8'))
429 fgSizer1.Add( wx.StaticText(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 ), wx.ID_ANY, wx.ALL, 5)
430 fgSizer1.Add( bSizer3, 0, wx.ALIGN_RIGHT|wx.ALL, 5 )
432 Rpath_text = wx.StaticText( self, wx.ID_ANY, _(u"R path").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
433 Rpath_text.Wrap( -1 )
434 fgSizer1.Add( Rpath_text, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
435 fgSizer1.Add( wx.StaticText(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 ), wx.ID_ANY, wx.ALL, 5)
436 self.Rpath_value = filebrowse.FileBrowseButton(self, -1, size=(350, -1), fileMode = 2, fileMask = '*')
437 self.Rpath_value.SetLabel(_(u"Path : ").decode('utf8'))
438 fgSizer1.Add( self.Rpath_value, 0, wx.ALIGN_RIGHT|wx.ALL, 5 )
440 mirror_text = wx.StaticText( self, wx.ID_ANY, _(u"Default R mirror").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
441 mirror_text.Wrap( -1 )
442 fgSizer1.Add( mirror_text, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
443 fgSizer1.Add( wx.StaticText(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 ), wx.ID_ANY, wx.ALL, 5)
444 self.mirror_value = wx.TextCtrl( self, wx.ID_ANY, u'http://cran.univ-lyon1.fr', wx.DefaultPosition, wx.Size( 300,30 ), 0 )
445 fgSizer1.Add( self.mirror_value, 0, wx.ALIGN_RIGHT|wx.ALL, 5 )
448 m_sdbSizer1 = wx.StdDialogButtonSizer()
449 self.m_sdbSizer1OK = wx.Button( self, wx.ID_OK )
450 m_sdbSizer1.AddButton( self.m_sdbSizer1OK )
451 self.m_sdbSizer1Cancel = wx.Button( self, wx.ID_CANCEL )
452 m_sdbSizer1.AddButton( self.m_sdbSizer1Cancel )
453 m_sdbSizer1.Realize()
454 bSizer1.Add( m_sdbSizer1, 0, wx.EXPAND, 5 )
456 self.SetSizer( bSizer1 )
460 self.Centre( wx.BOTH )
463 self.m_sdbSizer1OK.Bind( wx.EVT_BUTTON, self.OnValid )
464 self.m_button1.Bind( wx.EVT_BUTTON, parent.OnVerif )
465 self.check_svdc.Bind( wx.EVT_CHECKBOX, self.OnSVDC )
466 self.__set_properties()
468 def __set_properties(self):
469 self.SetTitle(_(u"Settings").decode('utf8'))
470 if self.parent.pref.getboolean('iramuteq', 'sound'): val1 = 0
472 self.m_radioBox1.SetSelection(val1)
473 if self.parent.pref.getboolean('iramuteq', 'checkupdate') : val2 = 0
475 self.m_radioBox2.SetSelection(val2)
476 self.langues.SetSelection(self.listlangues.index(self.parent.pref.get('iramuteq', 'guilanguage')))
477 if sys.platform == 'win32' :
478 if self.parent.pref.getboolean('iramuteq', 'R_mem') :
479 self.m_checkBox1.SetValue(True)
480 self.m_spinCtrl1.Enable(True)
481 self.m_spinCtrl1.SetValue(self.parent.pref.getint('iramuteq', 'R_max_mem'))
483 self.m_checkBox1.SetValue(False)
484 self.m_spinCtrl1.Enable(False)
485 if self.parent.pref.getboolean('iramuteq', 'libsvdc') :
486 self.check_svdc.SetValue(True)
487 self.fbb.SetValue(self.parent.pref.get('iramuteq', 'libsvdc_path'))
489 self.check_svdc.SetValue(False)
490 self.fbb.SetValue(self.parent.pref.get('iramuteq', 'libsvdc_path'))
491 self.fbb.Enable(False)
492 self.Rpath_value.SetValue(self.parent.PathPath.get('PATHS', 'rpath'))
493 self.mirror_value.SetValue(self.parent.pref.get('iramuteq', 'rmirror'))
495 def oncheckmem(self, evt):
496 if self.m_checkBox1.GetValue() :
497 self.m_spinCtrl1.Enable(True)
499 self.m_spinCtrl1.Enable(False)
501 def OnSVDC(self, evt):
502 if self.check_svdc.GetValue() :
503 self.fbb.Enable(True)
505 self.fbb.Enable(False)
507 def OnValid(self, event):
509 if self.m_radioBox1.GetSelection() == 0 : valsound = 'true'
510 else : valsound = 'false'
511 parent.pref.set('iramuteq', 'sound', valsound)
512 if self.m_radioBox2.GetSelection() == 0 : valcheck = 'true'
513 else : valcheck = 'false'
514 parent.pref.set('iramuteq', 'checkupdate', valcheck)
515 parent.pref.set('iramuteq', 'guilanguage', self.listlangues[self.langues.GetSelection()])
516 if sys.platform == 'win32' :
517 if self.m_checkBox1.GetValue() :
518 parent.pref.set('iramuteq', 'R_mem', 'true')
519 parent.pref.set('iramuteq', 'R_max_mem', str(self.m_spinCtrl1.GetValue()))
521 parent.pref.set('iramuteq', 'R_mem', 'false')
522 if self.check_svdc.GetValue() :
523 parent.pref.set('iramuteq', 'libsvdc', 'true')
525 parent.pref.set('iramuteq', 'libsvdc', 'false')
526 parent.pref.set('iramuteq', 'libsvdc_path', self.fbb.GetValue())
527 self.parent.pref.set('iramuteq', 'rmirror', self.mirror_value.GetValue())
528 file = open(parent.ConfigPath['preferences'], 'w')
529 parent.pref.write(file)
531 self.parent.PathPath.set('PATHS', 'rpath', self.Rpath_value.GetValue())
532 with open(self.parent.ConfigPath['path'], 'w') as f:
533 self.parent.PathPath.write(f)
536 class PrefGraph(wx.Dialog):
537 def __init__(self, parent, ID, paramgraph, title = '', size=wx.DefaultSize, pos=wx.DefaultPosition, style=wx.DEFAULT_DIALOG_STYLE):
539 pre.SetExtraStyle(wx.DIALOG_EX_CONTEXTHELP)
540 pre.Create(parent, ID, title, pos, size, style)
543 self.paramgraph=paramgraph
544 self.labeltype = wx.StaticText(self, -1, _(u"Graphic type").decode('utf8'))
545 if self.paramgraph['clnb'] <= 3 :
546 choix = [u'2D']#, 'web 2D']
548 choix=[u'2D' ,u'3D']#, 'web 2D', 'web 3D']
549 self.choicetype = wx.Choice(self, -1, (100,50), choices=choix)
550 self.label_format = wx.StaticText(self, -1, _(u"Picture format").decode('utf8'))
551 self.choix_format = wx.Choice(self, -1, (100,50), choices = ['png', 'svg'])
552 self.label_1 = wx.StaticText(self, -1, _(u"width").decode('utf8'))
553 self.spin1 = wx.SpinCtrl(self, -1, '',size = (100,30), min=100, max=5000)
554 self.label_2 = wx.StaticText(self, -1, _(u"height").decode('utf8'))
555 self.spin2 = wx.SpinCtrl(self, -1, '', size = (100,30), min=100, max=5000)
556 self.label_what = wx.StaticText(self, -1, _(u"Representation").decode('utf8'))
557 self.choice1 = wx.Choice(self, -1, (100,50), choices=[_(u"coordinates").decode('utf8'),_(u"correlations").decode('utf8')])
558 self.label_qui = wx.StaticText(self, -1, u'Variables')
559 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')])
560 self.label_3 = wx.StaticText(self, -1, _(u"Text size").decode('utf8'))
561 self.spin3 = wx.SpinCtrl(self, -1, '', size = (100,30), min=1, max=20)
562 txt = _(u"Take the x first points").decode('utf8')
563 self.label_4 = wx.StaticText(self, -1, txt)
564 self.check1 = wx.CheckBox(self, -1)
565 self.spin_nb = wx.SpinCtrl(self, -1, '', size = (100,30), min=2, max=1000)
566 txt = _(u"Take the x first points by cluster").decode('utf8')
567 self.label_chic = wx.StaticText(self, -1, txt)
568 self.check_chic = wx.CheckBox(self, -1)
569 self.spin_nbchic = wx.SpinCtrl(self, -1, '', size = (100,30), min=2, max=1000)
570 txt = _(u"Limit points by cluster chi2").decode('utf8')
571 self.label_5 = wx.StaticText(self, -1, txt)
572 self.check2 = wx.CheckBox(self, -1)
573 self.spin_chi = wx.SpinCtrl(self, -1, '',size = (100,30), min=2, max=1000)
574 self.label_6 = wx.StaticText(self, -1, _(u"Avoid overlay").decode('utf8'))
575 self.check3 = wx.CheckBox(self, -1)
576 txt = _(u"Text size proportional to frequency").decode('utf8')
577 self.label_7 = wx.StaticText(self, -1, txt)
578 self.check4 = wx.CheckBox(self, -1)
579 self.label_min = wx.StaticText(self, -1, 'min')
580 self.spin_min = wx.SpinCtrl(self, -1, '',size = (100,30), min = 1, max = 100)
581 self.label_max = wx.StaticText(self, -1, 'max')
582 self.spin_max = wx.SpinCtrl(self, -1, '',size = (100,30), min = 1, max = 100)
583 txt = _(u"Text size proportional to chi2").decode('utf8')
584 self.label_tchi = wx.StaticText(self, -1, txt)
585 self.check_tchi = wx.CheckBox(self, -1)
586 self.label_min_tchi = wx.StaticText(self, -1, 'min')
587 self.spin_min_tchi = wx.SpinCtrl(self, -1, '', size = (100,30), min = 1, max = 100)
588 self.label_max_tchi = wx.StaticText(self, -1, 'max')
589 self.spin_max_tchi = wx.SpinCtrl(self, -1, '', size = (100,30), min = 1, max = 100)
590 self.label_8 = wx.StaticText(self, -1, _(u"Factor x : ").decode('utf8'))
591 self.spin_f1 = wx.SpinCtrl(self, -1, '',size = (100,30), min=1, max=self.paramgraph['clnb']-1)
592 self.label_9 = wx.StaticText(self, -1, _(u"Factor y : ").decode('utf8'))
593 self.spin_f2 = wx.SpinCtrl(self, -1, '',size = (100,30), min=1, max=self.paramgraph['clnb']-1)
594 self.label_f3 = wx.StaticText(self, -1, _(u"Factor z : ").decode('utf8'))
595 self.spin_f3 = wx.SpinCtrl(self, -1, '',size = (100,30), min=1, max=self.paramgraph['clnb']-1)
596 self.label_sphere = wx.StaticText(self, -1, _(u"Spheres transparency").decode('utf8'))
597 self.slider_sphere = wx.Slider(self, -1, 10, 1, 100, size = (255,-1), style = wx.SL_HORIZONTAL | wx.SL_AUTOTICKS | wx.SL_LABELS)
599 self.label_film = wx.StaticText(self, -1, _(u"Make a movie").decode('utf8'))
600 self.film = wx.CheckBox(self, -1)
602 self.btnsizer = wx.StdDialogButtonSizer()
603 if wx.Platform != "__WXMSW__":
604 btn = wx.ContextHelpButton(self)
605 self.btnsizer.AddButton(btn)
606 btn = wx.Button(self, wx.ID_OK)
608 self.btnsizer.AddButton(btn)
609 btn = wx.Button(self, wx.ID_CANCEL)
610 self.btnsizer.AddButton(btn)
611 self.btnsizer.Realize()
613 self.Bind(wx.EVT_CHECKBOX, self.OnCheck1, self.check1)
614 self.Bind(wx.EVT_CHECKBOX, self.OnCheck2, self.check2)
615 self.Bind(wx.EVT_CHECKBOX, self.OnNorm, self.check4)
616 self.Bind(wx.EVT_CHECKBOX, self.OnCheckTchi, self.check_tchi)
617 self.Bind(wx.EVT_CHOICE, self.On3D, self.choicetype)
618 self.Bind(wx.EVT_CHOICE, self.OnPass, self.choice2)
619 self.Bind(wx.EVT_CHECKBOX, self.OnCheckChic, self.check_chic)
620 self.__set_properties()
621 self.OnNorm(wx.EVT_CHECKBOX)
622 self.OnCheckTchi(wx.EVT_CHECKBOX)
625 def __set_properties(self):
626 self.choicetype.SetSelection(self.paramgraph['typegraph'])
627 if self.paramgraph['typegraph'] == 0 or self.paramgraph['typegraph'] == 2:
628 self.film.Enable(False)
629 self.spin_f3.Enable(False)
630 self.slider_sphere.Enable(False)
631 self.choix_format.SetSelection(self.paramgraph['svg'])
632 self.choice1.SetSelection(self.paramgraph['what'])
633 self.choice2.SetSelection(self.paramgraph['qui'])
634 self.spin_chi.SetValue(self.paramgraph['select_nb'])
635 self.spin_nb.SetValue(self.paramgraph['select_chi'])
636 self.spin1.SetValue(self.paramgraph['width'])
637 self.spin2.SetValue(self.paramgraph['height'])
638 self.spin3.SetValue(self.paramgraph['taillecar'])
639 self.spin_nb.SetValue(self.paramgraph['select_nb'])
640 self.spin_chi.SetValue(self.paramgraph['select_chi'])
641 self.spin_nbchic.SetValue(self.paramgraph['nbchic'])
642 self.check1.SetValue(self.paramgraph['do_select_nb'])
643 self.check2.SetValue(self.paramgraph['do_select_chi'])
644 self.check_chic.SetValue(self.paramgraph['do_select_chi_classe'])
645 self.check3.SetValue(self.paramgraph['over'])
646 if self.paramgraph['do_select_nb'] :
647 self.spin_nb.Enable(True)
648 self.spin_chi.Enable(False)
649 self.spin_nbchic.Enable(False)
650 elif self.paramgraph['do_select_chi_classe'] :
651 self.spin_nb.Enable(False)
652 self.spin_chi.Enable(False)
653 self.spin_nbchic.Enable(True)
654 elif self.paramgraph['do_select_chi'] :
655 self.spin_nb.Enable(False)
656 self.spin_chi.Enable(True)
657 self.spin_nbchic.Enable(False)
659 self.spin_nb.Enable(False)
660 self.spin_chi.Enable(False)
661 self.spin_nbchic.Enable(False)
664 self.check4.SetValue(self.paramgraph['cex_txt'])
665 self.spin_min.SetValue(self.paramgraph['txt_min'])
666 self.spin_max.SetValue(self.paramgraph['txt_max'])
667 self.check_tchi.SetValue(self.paramgraph['tchi'])
668 self.spin_min_tchi.SetValue(self.paramgraph['tchi_min'])
669 self.spin_max_tchi.SetValue(self.paramgraph['tchi_max'])
671 self.spin_f1.SetValue(self.paramgraph['facteur'][0])
672 self.spin_f2.SetValue(self.paramgraph['facteur'][1])
673 self.spin_f3.SetValue(self.paramgraph['facteur'][2])
674 self.slider_sphere.SetValue(self.paramgraph['alpha'])
676 def __do_layout(self):
677 sizer_2 = wx.BoxSizer(wx.VERTICAL)
678 fsizer = wx.FlexGridSizer(0,2,0,5)
679 grid_min = wx.FlexGridSizer(0, 2, 0, 0)
680 grid_max = wx.FlexGridSizer(0, 2, 0, 0)
681 grid_minmax = wx.FlexGridSizer(0, 2, 0, 0)
682 grid_min_tchi = wx.FlexGridSizer(0, 2, 0, 0)
683 grid_max_tchi = wx.FlexGridSizer(0, 2, 0, 0)
684 grid_minmax_tchi = wx.FlexGridSizer(0, 2, 0, 0)
686 sizer_3 = wx.BoxSizer(wx.VERTICAL)
688 fsizer.Add(self.labeltype, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
689 fsizer.Add(self.choicetype, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
690 fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
691 fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
693 fsizer.Add(self.label_format, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
694 fsizer.Add(self.choix_format, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
695 fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
696 fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
698 fsizer.Add(self.label_what, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
699 fsizer.Add(self.choice1, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
700 fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
701 fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
703 fsizer.Add(self.label_qui, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
704 fsizer.Add(self.choice2, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
705 fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
706 fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
708 sizer_h1 = wx.BoxSizer(wx.HORIZONTAL)
709 sizer_h1.Add(self.label_1, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
710 sizer_h1.Add(self.spin1, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
711 fsizer.Add(sizer_h1, 0, wx.ALL, 5)
712 sizer_h2 = wx.BoxSizer(wx.HORIZONTAL)
713 sizer_h2.Add(self.label_2, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
714 sizer_h2.Add(self.spin2, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
715 fsizer.Add(sizer_h2, 0, wx.ALL, 5)
716 fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
717 fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
719 fsizer.Add(self.label_3, 0, wx.ALL | wx.LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
720 fsizer.Add(self.spin3, 0, wx.ALL | wx.LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
721 fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
722 fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
724 fsizer.Add(self.label_4, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
725 sizer_nb = wx.BoxSizer(wx.HORIZONTAL)
726 sizer_nb.Add(self.check1, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
727 sizer_nb.Add(self.spin_nb, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
728 fsizer.Add(sizer_nb, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
729 fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
730 fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
732 fsizer.Add(self.label_chic, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
733 sizer_nbchic = wx.BoxSizer(wx.HORIZONTAL)
734 sizer_nbchic.Add(self.check_chic, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
735 sizer_nbchic.Add(self.spin_nbchic, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
736 fsizer.Add(sizer_nbchic, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
737 fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
738 fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
740 fsizer.Add(self.label_5, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
741 sizer_chi = wx.BoxSizer(wx.HORIZONTAL)
742 sizer_chi.Add(self.check2, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
743 sizer_chi.Add(self.spin_chi, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
744 fsizer.Add(sizer_chi, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
745 fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
746 fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
748 fsizer.Add(self.label_6, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL| wx.ADJUST_MINSIZE, 5)
749 fsizer.Add(self.check3, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 5)
750 fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
751 fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
753 sizer_2.Add(fsizer, 0, wx.EXPAND, 0)
755 bsizer_1 = wx.FlexGridSizer(0,3,0,0)
756 bsizer_1.Add(self.label_7, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
757 bsizer_1.Add(self.check4, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL|wx.EXPAND, 5)
758 grid_min.Add(self.label_min, 0,wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
759 grid_min.Add(self.spin_min, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
760 grid_max.Add(self.label_max, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
761 grid_max.Add(self.spin_max, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
762 grid_minmax.Add(grid_min, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
763 grid_minmax.Add(grid_max, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
765 bsizer_1.Add(grid_minmax, 0, wx.ALL, 5)
767 bsizer_1.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
768 bsizer_1.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
769 bsizer_1.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
771 bsizer_1.Add(self.label_tchi, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
772 bsizer_1.Add(self.check_tchi, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL|wx.EXPAND, 5)
773 grid_min_tchi.Add(self.label_min_tchi, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
774 grid_min_tchi.Add(self.spin_min_tchi, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
775 grid_max_tchi.Add(self.label_max_tchi, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
776 grid_max_tchi.Add(self.spin_max_tchi, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
777 grid_minmax_tchi.Add(grid_min_tchi, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
778 grid_minmax_tchi.Add(grid_max_tchi, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
780 bsizer_1.Add(grid_minmax_tchi, 0, wx.ALL, 5)
781 sizer_2.Add(bsizer_1, 0, wx.EXPAND, 5)
783 sizer_2.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
785 sizer_f = wx.BoxSizer(wx.HORIZONTAL)
786 sizer_f.Add(self.label_8, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
787 sizer_f.Add(self.spin_f1, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
789 sizer_f.Add(self.label_9, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
790 sizer_f.Add(self.spin_f2, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
792 sizer_f.Add(self.label_f3, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
793 sizer_f.Add(self.spin_f3, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
794 sizer_2.Add(sizer_f, 0, wx.EXPAND, 5)
796 sizer_2.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 5)
798 fsizer2 = wx.FlexGridSizer(0,2,0,0)
799 fsizer2.Add(self.label_sphere, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
800 fsizer2.Add(self.slider_sphere, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
801 fsizer2.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
802 fsizer2.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
804 fsizer2.Add(self.label_film, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
805 fsizer2.Add(self.film, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
806 sizer_2.Add(fsizer2, 0, wx.EXPAND, 5)
807 sizer_2.Add(self.btnsizer, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_CENTER_HORIZONTAL, 5)
808 self.SetSizer(sizer_2)
812 def OnCheck1(self, event):
813 if self.check1.GetValue() :
814 self.check2.SetValue(False)
815 self.check_chic.SetValue(False)
816 self.spin_chi.Enable(False)
817 self.spin_nb.Enable(True)
818 self.spin_nbchic.Enable(False)
820 self.spin_nb.Enable(False)
822 def OnCheck2(self, event):
823 if self.check2.GetValue() :
824 self.check1.SetValue(False)
825 self.check_chic.SetValue(False)
826 self.spin_chi.Enable(True)
827 self.spin_nb.Enable(False)
828 self.spin_nbchic.Enable(False)
830 self.spin_chi.Enable(False)
832 def OnCheckChic(self, event) :
833 if self.check_chic.GetValue() :
834 self.check1.SetValue(False)
835 self.check2.SetValue(False)
836 self.spin_chi.Enable(False)
837 self.spin_nb.Enable(False)
838 self.spin_nbchic.Enable(True)
840 self.spin_nbchic.Enable(False)
842 def OnNorm(self, event):
843 if not self.check4.GetValue() :
844 self.spin_min.Disable()
845 self.spin_max.Disable()
847 self.spin_min.Enable(True)
848 self.spin_max.Enable(True)
849 self.check_tchi.SetValue(False)
850 self.OnCheckTchi(wx.EVT_CHECKBOX)
852 def OnCheckTchi(self, evt) :
853 if not self.check_tchi.GetValue() :
854 self.spin_min_tchi.Disable()
855 self.spin_max_tchi.Disable()
857 self.spin_min_tchi.Enable(True)
858 self.spin_max_tchi.Enable(True)
859 self.check4.SetValue(False)
860 self.OnNorm(wx.EVT_CHECKBOX)
862 def On3D(self, event) :
863 if event.GetString() == u'3D' :
864 self.film.Enable(True)
865 self.spin_f3.Enable(True)
866 self.slider_sphere.Enable(True)
868 self.film.Enable(False)
869 self.spin_f3.Enable(False)
870 self.slider_sphere.Enable(False)
872 def OnPass(self,evt) :
873 if evt.GetString() == _(u"clusters").decode('utf8') :
874 self.check4.SetValue(False)
875 self.check4.Enable(False)
876 self.OnNorm(wx.EVT_CHECKBOX)
881 class SelectColDial ( wx.Dialog ):
883 def __init__( self, parent ):
884 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 )
886 self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
888 self.bSizer2 = wx.BoxSizer( wx.VERTICAL )
890 #self.m_checkList2 = wx.CheckListBox( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, ['r','t','y'], 0 )
891 #bSizer2.Add( self.m_checkList2, 2, wx.ALL|wx.EXPAND, 5 )
893 self.m_sdbSizer2 = wx.StdDialogButtonSizer()
894 self.m_sdbSizer2OK = wx.Button( self, wx.ID_CANCEL)
895 self.butok = wx.Button( self, wx.ID_OK)
896 #m_sdbSizer2.AddButton( self.m_sdbSizer2OK )
897 #self.m_sdbSizer2Cancel = wx.Button( self, wx.ID_CANCEL )
898 #m_sdbSizer2.AddButton( self.m_sdbSizer2Cancel )
899 #m_sdbSizer2.Realize();
900 #self.bSizer2.Add( m_sdbSizer2, 0, wx.EXPAND, 5 )
902 self.SetSizer( self.bSizer2 )
905 self.Centre( wx.BOTH )
910 class PrefExport(wx.Dialog):
911 def __init__(self, parent, *args, **kwds):
912 kwds['style'] = wx.OK|wx.DEFAULT_DIALOG_STYLE
913 wx.Dialog.__init__(self, *args, **kwds)
916 sizer = wx.BoxSizer(wx.VERTICAL)
917 box = wx.BoxSizer(wx.HORIZONTAL)
918 box3 = wx.BoxSizer(wx.HORIZONTAL)
919 self.label_lem = wx.StaticText(self, -1, _(u"Lemmatised corpus").decode('utf8'))
920 box3.Add(self.label_lem, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
921 self.radio_lem = wx.RadioBox(self, -1, u"", choices= [ _(u"yes").decode('utf8'), _(u"no").decode('utf8') ], majorDimension=0, style=wx.RA_SPECIFY_ROWS)
922 box3.Add(self.radio_lem, 0, wx.ALIGN_RIGHT, 5)
923 sizer.Add(box3, 0, wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5)
924 self.label_txt = wx.StaticText(self, -1, _(u"Export for ...").decode('utf8'))
925 box.Add(self.label_txt, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
926 self.radio_type = wx.RadioBox(self, -1, u"", choices=['IRaMuTeQ/ALCESTE', 'Lexico'], majorDimension=0, style=wx.RA_SPECIFY_ROWS)
927 box.Add(self.radio_type, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
928 sizer.Add(box, 0, wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5)
929 box2 = wx.BoxSizer(wx.HORIZONTAL)
930 self.txt2 = wx.StaticText(self, -1, _(u"Output file").decode('utf8'))
931 box2.Add(self.txt2, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
932 self.fbb = filebrowse.FileBrowseButton(self, -1, size=(450, -1), fileMode = 2)
933 box2.Add(self.fbb, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
934 self.fbb.SetLabel("")
935 sizer.Add(box2, 0, wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5)
937 btnsizer = wx.StdDialogButtonSizer()
938 btn = wx.Button(self, wx.ID_CANCEL)
939 btnsizer.AddButton(btn)
940 btn_ok = wx.Button(self, wx.ID_OK)
942 btnsizer.AddButton(btn_ok)
944 sizer.Add(btnsizer, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL|wx.ALIGN_RIGHT, 5)
945 self.Bind(wx.EVT_BUTTON, self.check_file, btn_ok)
949 def check_file(self, evt) :
950 if evt.GetId() == wx.ID_OK :
951 if os.path.exists(self.fbb.GetValue()):
952 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)
954 if dlg.ShowModal() not in [wx.ID_NO, wx.ID_CANCEL]:
955 self.EndModal(wx.ID_OK)
957 self.EndModal(wx.ID_OK)
959 self.EndModal(wx.ID_CANCEL)
961 class PrefProfTypes(wx.Dialog):
962 def __init__(self, parent, *args, **kwds):
963 kwds['style'] = wx.OK|wx.DEFAULT_DIALOG_STYLE
964 wx.Dialog.__init__(self, parent, *args, **kwds)
967 sizer = wx.BoxSizer(wx.VERTICAL)
968 box = wx.BoxSizer(wx.HORIZONTAL)
969 box3 = wx.BoxSizer(wx.HORIZONTAL)
970 self.label_txt = wx.StaticText(self, -1, _(u"Settings").decode('utf8'))
971 box.Add(self.label_txt, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
972 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)
973 box.Add(self.radio_type, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
974 sizer.Add(box, 0, wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5)
975 box2 = wx.BoxSizer(wx.HORIZONTAL)
976 self.txt2 = wx.StaticText(self, -1, _(u"Output file").decode('utf8'))
977 box2.Add(self.txt2, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
978 self.fbb = filebrowse.FileBrowseButton(self, -1, size=(450, -1), fileMode = 2)
979 box2.Add(self.fbb, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
980 self.fbb.SetLabel("")
981 sizer.Add(box2, 0, wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5)
983 btnsizer = wx.StdDialogButtonSizer()
984 btn = wx.Button(self, wx.ID_CANCEL)
985 btnsizer.AddButton(btn)
986 btn_ok = wx.Button(self, wx.ID_OK)
988 btnsizer.AddButton(btn_ok)
990 sizer.Add(btnsizer, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL|wx.ALIGN_RIGHT, 5)
991 #self.Bind(wx.EVT_BUTTON, self.check_file, btn_ok)
995 class PrefSimpleFile(wx.Dialog):
996 def __init__(self, parent, *args, **kwds):
997 kwds['style'] = wx.OK|wx.DEFAULT_DIALOG_STYLE
999 self.mask = kwds['mask']
1001 else : self.mask = '*.*'
1002 wx.Dialog.__init__(self, *args, **kwds)
1004 self.parent = parent
1005 sizer = wx.BoxSizer(wx.VERTICAL)
1006 box2 = wx.BoxSizer(wx.HORIZONTAL)
1007 self.txt2 = wx.StaticText(self, -1, _(u"Output file").decode('utf8'))
1008 box2.Add(self.txt2, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
1009 self.fbb = filebrowse.FileBrowseButton(self, -1, size=(450, -1), fileMode = 2, fileMask = self.mask)
1010 box2.Add(self.fbb, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
1011 self.fbb.SetLabel("")
1012 sizer.Add(box2, 0, wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5)
1014 btnsizer = wx.StdDialogButtonSizer()
1015 btn = wx.Button(self, wx.ID_CANCEL)
1016 btnsizer.AddButton(btn)
1017 btn_ok = wx.Button(self, wx.ID_OK)
1019 btnsizer.AddButton(btn_ok)
1021 sizer.Add(btnsizer, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL|wx.ALIGN_RIGHT, 5)
1022 self.Bind(wx.EVT_BUTTON, self.check_file, btn_ok)
1023 self.SetSizer(sizer)
1026 def check_file(self, evt) :
1027 if evt.GetId() == wx.ID_OK :
1028 if os.path.exists(self.fbb.GetValue()):
1029 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)
1030 dlg.CenterOnParent()
1031 if dlg.ShowModal() not in [wx.ID_NO, wx.ID_CANCEL]:
1032 self.EndModal(wx.ID_OK)
1034 self.EndModal(wx.ID_OK)
1036 self.EndModal(wx.ID_CANCEL)
1038 class StatDialog ( wx.Dialog ):
1040 def __init__( self, parent, keys ):
1041 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 )
1044 self.parent = parent
1046 self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
1048 bSizer1 = wx.BoxSizer( wx.VERTICAL )
1050 gSizer1 = wx.GridSizer( 0, 2, 0, 0 )
1052 self.m_staticText1 = wx.StaticText( self, wx.ID_ANY, _(u"Lemmatization").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
1053 self.m_staticText1.Wrap( -1 )
1054 gSizer1.Add( self.m_staticText1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1056 radio_lemChoices = [ _(u"yes").decode('utf8'), _(u"no").decode('utf8') ]
1057 self.radio_lem = wx.RadioBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, radio_lemChoices, 1, wx.RA_SPECIFY_COLS )
1058 self.radio_lem.SetSelection( 0 )
1059 gSizer1.Add( self.radio_lem, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
1061 self.m_staticText2 = wx.StaticText( self, wx.ID_ANY, _(u"Keys properties").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
1062 self.m_staticText2.Wrap( -1 )
1063 gSizer1.Add( self.m_staticText2, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1065 self.button_5 = wx.Button( self, wx.ID_PREFERENCES, _(u"properties").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
1066 gSizer1.Add( self.button_5, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
1068 self.m_staticText3 = wx.StaticText( self, wx.ID_ANY, _(u"Dictionary").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
1069 self.m_staticText3.Wrap( -1 )
1070 gSizer1.Add( self.m_staticText3, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1072 radio_dictchoiceChoices = [ _(u"indexation").decode('utf8'), _(u"other").decode('utf8') ]
1073 self.radio_dictchoice = wx.RadioBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, radio_dictchoiceChoices, 1, wx.RA_SPECIFY_COLS )
1074 self.radio_dictchoice.SetSelection( 0 )
1075 gSizer1.Add( self.radio_dictchoice, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
1078 bSizer1.Add( gSizer1, 1, wx.EXPAND, 5 )
1080 self.dictpath = filebrowse.FileBrowseButton(self, -1, size=(350, -1), labelText = _(u"Path").decode('utf8'), fileMode = 2, fileMask = '*')
1081 bSizer1.Add( self.dictpath, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1082 self.dictpath.Enable(False)
1084 m_sdbSizer1 = wx.StdDialogButtonSizer()
1085 self.m_sdbSizer1OK = wx.Button( self, wx.ID_OK )
1086 m_sdbSizer1.AddButton( self.m_sdbSizer1OK )
1087 self.m_sdbSizer1Cancel = wx.Button( self, wx.ID_CANCEL )
1088 m_sdbSizer1.AddButton( self.m_sdbSizer1Cancel )
1089 m_sdbSizer1.Realize();
1091 bSizer1.Add( m_sdbSizer1, 0, wx.EXPAND, 5 )
1094 self.SetSizer( bSizer1 )
1098 self.Centre( wx.BOTH )
1101 self.button_5.Bind( wx.EVT_BUTTON, self.OnKeys )
1102 self.radio_dictchoice.Bind( wx.EVT_RADIOBOX, self.OnOther )
1104 def __del__( self ):
1108 # Virtual event handlers, overide them in your derived class
1109 def OnKeys( self, event ):
1110 dial = AlcOptFrame(self, self.parent)
1111 dial.CenterOnParent()
1113 for i in range(0,len(dial.listlabel)):
1114 dial.keys[dial.listcle[i]] = dial.listspin[i].GetValue()
1115 DoConf().makeoptions(['KEY'], [dial.keys], outfile = self.parent.ConfigPath['key'])
1118 def OnOther( self, event ):
1119 if self.radio_dictchoice.GetSelection() :
1120 self.dictpath.Enable(True)
1122 self.dictpath.Enable(False)
1124 # class StatDialog(wx.Dialog):
1125 # def __init__(self, parent, *args, **kwds):
1126 # kwds['style'] = wx.DEFAULT_DIALOG_STYLE
1127 # wx.Dialog.__init__(self, *args, **kwds)
1129 # self.parent = parent
1130 # self.label_lem = wx.StaticText(self, -1, _(u"Lemmatization").decode('utf8'))
1131 # self.radio_lem = wx.RadioBox(self, -1, u"", choices=[_(u'oui').decode('utf8'), _(u'non').decode('utf8')], majorDimension=0, style=wx.RA_SPECIFY_ROWS)
1132 # #txt = u"""Fréquence minimum d'une forme
1133 # #analysée (0 = non utilisé)"""
1134 # #self.label_8 = wx.StaticText(self, -1, txt)
1135 # #self.spin_ctrl_5 = wx.SpinCtrl(self, -1, "",size = (100,30), min=0, max=1000, initial=0)
1136 # #self.label_max_actives = wx.StaticText(self, -1, u"Nombre maximum de formes analysées")
1137 # #self.spin_max_actives = wx.SpinCtrl(self, -1, "",size = (100,30), min=20, max=10000, initial=1500)
1138 # self.label_4 = wx.StaticText(self, -1, _(u"Keys settings").decode('utf8'))
1139 # self.button_5 = wx.Button(self, wx.ID_PREFERENCES, "")
1140 # self.labeldictchoice = wx.StaticText(self, -1, _(u"Dictionary").decode('utf8'))
1141 # self.radio_dictchoice = wx.RadioBox(self, -1, u"", choices=[_(u'indexation').decode('utf8'), _(u'other').decode('utf8')], majorDimension=0, style=wx.RA_SPECIFY_ROWS)
1142 # #self.labeldictpath = wx.StaticText(self, -1, _(u"Path").decode('utf8'))
1143 # self.dictpath = filebrowse.FileBrowseButton(self, -1, size=(350, -1), labelText = _(u"Path").decode('utf8'), fileMode = 2, fileMask = '*')
1144 # self.dictpath.Enable(False)
1145 # #self.Bind(wx.EVT_CHECKBOX, self.OnCheckUce, self.check_uce)
1146 # #self.Bind(wx.EVT_SPINCTRL, self.OnSpin, self.spin_ctrl_5)
1147 # self.Bind(wx.EVT_BUTTON, self.OnKeys, self.button_5)
1148 # self.Bind(wx.EVT_RADIOBOX, self.OnOther, self.radio_dictchoice)
1149 # self.__do_layout()
1150 # self.__set_properties()
1152 # def __do_layout(self) :
1153 # first = wx.BoxSizer(wx.VERTICAL)
1154 # sizer = wx.FlexGridSizer(0,2,0,0)
1155 # sizer.Add(self.label_lem, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
1156 # sizer.Add(self.radio_lem, 0, wx.ALIGN_LEFT, 5)
1157 # sizer.Add(wx.StaticLine(self),0, wx.ALIGN_LEFT, 5)
1158 # sizer.Add(wx.StaticLine(self),0, wx.ALIGN_LEFT, 5)
1159 # #sizer.Add(self.txt_exp, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
1160 # #sizer.Add(self.exp, 0, wx.ALIGN_RIGHT, 5)
1161 # #sizer.Add(self.label_uce, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
1162 # #sizer.Add(self.check_uce, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
1163 # #sizer.Add(self.label_occuce, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
1164 # #sizer.Add(self.spin_ctrl_4, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
1165 # #sizer.Add(self.label_8, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
1166 # #sizer.Add(self.spin_ctrl_5, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
1167 # #sizer.Add(self.label_max_actives, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
1168 # #sizer.Add(self.spin_max_actives, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
1169 # sizer.Add(self.label_4, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
1170 # sizer.Add(self.button_5, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
1171 # sizer.Add(wx.StaticLine(self),0, wx.ALIGN_LEFT, 5)
1172 # sizer.Add(wx.StaticLine(self),0, wx.ALIGN_LEFT, 5)
1173 # sizer.Add(self.labeldictchoice, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
1174 # sizer.Add(self.radio_dictchoice, 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.labeldictpath, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
1178 # sizer.Add(self.dictpath, 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(box2, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT, 5)
1182 # first.Add(sizer, 0, wx.ALL, 5)
1183 # btnsizer = wx.StdDialogButtonSizer()
1184 # btn = wx.Button(self, wx.ID_CANCEL)
1185 # btnsizer.AddButton(btn)
1186 # btn_ok = wx.Button(self, wx.ID_OK)
1187 # btn_ok.SetDefault()
1188 # btnsizer.AddButton(btn_ok)
1189 # btnsizer.Realize()
1190 # first.Add(btnsizer, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT, 5)
1191 # self.SetSizer(first)
1194 # def __set_properties(self) :
1195 # self.SetTitle(_(u"Settings").decode('utf8'))
1197 # def OnKeys(self, evt):
1198 # dial = AlcOptFrame(self, self.parent.parent)
1199 # dial.CenterOnParent()
1201 # for i in range(0,len(dial.listlabel)):
1202 # dial.keys[dial.listcle[i]] = dial.listspin[i].GetValue()
1203 # DoConf().makeoptions(['KEY'], [dial.keys], outfile = self.parent.parent.ConfigPath['key'])
1206 # def OnOther(self, evt):
1207 # if self.radio_dictchoice.GetSelection() :
1208 # self.dictpath.Enable(True)
1210 # self.dictpath.Enable(False)
1212 class PrefUCECarac(wx.Dialog):
1213 def __init__(self, parent, *args, **kwds):
1214 kwds['style'] = wx.DEFAULT_DIALOG_STYLE
1215 kwds['title'] = _(u"Characteristic text segments").decode('utf8')
1216 wx.Dialog.__init__(self, *args, **kwds)
1217 self.parent = parent
1218 first = wx.BoxSizer(wx.VERTICAL)
1219 sizer = wx.FlexGridSizer(0,2,0,0)
1220 self.label_type = wx.StaticText(self, -1, _(u"Ranking score").decode('utf8'))
1221 sizer.Add(self.label_type, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
1222 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)
1223 sizer.Add(self.radio_type, 0, wx.ALIGN_RIGHT, 5)
1224 self.txt_eff = wx.StaticText(self, -1, _(u"Maximum number of text segments").decode('utf8'))
1225 sizer.Add(self.txt_eff, 0, wx.ALIGN_CENTRE, 5)
1226 self.spin_eff = wx.SpinCtrl(self, -1, '', size = (100, 30), min = 1, max = 100000, initial = 50)
1227 self.spin_eff.SetValue(50)
1228 sizer.Add(self.spin_eff, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
1229 first.Add(sizer, 0, wx.ALL, 5)
1230 btnsizer = wx.StdDialogButtonSizer()
1231 btn = wx.Button(self, wx.ID_CANCEL)
1232 btnsizer.AddButton(btn)
1233 btn_ok = wx.Button(self, wx.ID_OK)
1235 btnsizer.AddButton(btn_ok)
1237 first.Add(btnsizer, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT, 5)
1238 self.SetSizer(first)
1241 class PrefSegProf(wx.Dialog) :
1242 def __init__( self, parent ):
1243 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 )
1245 self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
1246 bSizer1 = wx.BoxSizer( wx.VERTICAL )
1247 txt = _(u"Be carefull : computation of repeated segments profiles can be very long on large corpus").decode('utf8')
1248 self.label = wx.StaticText( self, wx.ID_ANY, txt, wx.DefaultPosition, wx.DefaultSize, 0 )
1249 bSizer1.Add( self.label, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5 )
1251 fgSizer1 = wx.FlexGridSizer( 0, 2, 0, 0 )
1252 fgSizer1.SetFlexibleDirection( wx.BOTH )
1253 fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
1255 self.m_staticText1 = wx.StaticText( self, wx.ID_ANY, _(u"Lemmatised corpus").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
1256 self.m_staticText1.Wrap( -1 )
1257 fgSizer1.Add( self.m_staticText1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1259 box_lemChoices = [ _(u"yes").decode('utf8'), _(u"no").decode('utf8') ]
1260 self.box_lem = wx.RadioBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, box_lemChoices, 1, wx.RA_SPECIFY_COLS )
1261 self.box_lem.SetSelection( 1 )
1262 fgSizer1.Add( self.box_lem, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1263 #self.box_lem.Enable(False)
1265 self.m_staticText3 = wx.StaticText( self, wx.ID_ANY, _(u"Minimum size of segments").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
1266 self.m_staticText3.Wrap( -1 )
1267 fgSizer1.Add( self.m_staticText3, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1269 self.spin_min = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, (100,30), wx.SP_ARROW_KEYS, 2, 30, 2 )
1270 self.spin_min.SetValue(2)
1271 fgSizer1.Add( self.spin_min, 0, wx.ALL, 5 )
1273 self.m_staticText4 = wx.StaticText( self, wx.ID_ANY, _(u"Maxmum size of segments").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
1274 self.m_staticText4.Wrap( -1 )
1275 fgSizer1.Add( self.m_staticText4, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1277 self.spin_max = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, (100,30), wx.SP_ARROW_KEYS, 2, 30, 10 )
1278 self.spin_max.SetValue(10)
1279 fgSizer1.Add( self.spin_max, 0, wx.ALL, 5 )
1281 self.m_staticText5 = wx.StaticText( self, wx.ID_ANY, _(u"Minimum frequency of segments").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
1282 self.m_staticText5.Wrap( -1 )
1283 fgSizer1.Add( self.m_staticText5, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1285 self.spin_eff = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, (100,30), wx.SP_ARROW_KEYS, 4, 1000, 4 )
1286 self.spin_eff.SetValue(4)
1287 fgSizer1.Add( self.spin_eff, 0, wx.ALL, 5 )
1289 bSizer1.Add( fgSizer1, 1, wx.EXPAND, 5 )
1290 btnsizer = wx.StdDialogButtonSizer()
1291 btn = wx.Button(self, wx.ID_CANCEL)
1292 btnsizer.AddButton(btn)
1293 btn_ok = wx.Button(self, wx.ID_OK)
1295 btnsizer.AddButton(btn_ok)
1297 bSizer1.Add(btnsizer, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT, 5)
1299 self.SetSizer( bSizer1 )
1303 self.Centre( wx.BOTH )
1305 class PrefQuestAlc ( wx.Dialog ):
1307 def __init__( self, parent, tableau, sim = False):
1308 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 )
1310 self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
1312 #---------------------------------------------------------------
1313 #self.content = parent.content[:]
1314 self.header = tableau.get_colnames()
1315 labels = [val for val in self.header]
1316 self.labels_tot = labels
1319 #---------------------------------------------------------------
1320 bSizer2 = wx.BoxSizer( wx.VERTICAL )
1322 fgSizer1 = wx.FlexGridSizer( 0, 2, 0, 0 )
1323 fgSizer1.SetFlexibleDirection( wx.BOTH )
1324 fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
1327 self.lab_format = wx.StaticText( self, wx.ID_ANY, _(u"Supplementary variables are marked with a *").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
1328 self.lab_format.Wrap( -1 )
1329 fgSizer1.Add( self.lab_format, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1331 m_radioBox1Choices = [ _(u"yes").decode('utf8'), _(u"no").decode('utf8') ]
1332 self.m_radioBox1 = wx.RadioBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, m_radioBox1Choices, 1, wx.RA_SPECIFY_COLS )
1333 self.m_radioBox1.SetSelection( 0 )
1334 fgSizer1.Add( self.m_radioBox1, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1336 self.m_staticText3 = wx.StaticText( self, wx.ID_ANY, _(u"Actives variables (almost 3)").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
1337 self.m_staticText3.Wrap( -1 )
1338 fgSizer1.Add( self.m_staticText3, 0, wx.ALL, 5 )
1340 self.m_staticText2 = wx.StaticText( self, wx.ID_ANY, _(u"Supplementaries variables (almost 1)").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
1341 self.m_staticText2.Wrap( -1 )
1342 fgSizer1.Add( self.m_staticText2, 0, wx.ALL, 5 )
1344 self.ListActive = wx.ListBox( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, labels, wx.LB_EXTENDED )
1345 self.ListActive.SetMinSize( wx.Size( 300,250 ) )
1347 fgSizer1.Add( self.ListActive, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL|wx.EXPAND, 5 )
1349 self.ListSup = wx.ListBox( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, labels, wx.LB_EXTENDED )
1350 self.ListSup.SetMinSize( wx.Size( 300,250 ) )
1352 fgSizer1.Add( self.ListSup, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL|wx.EXPAND, 5 )
1354 self.but_suiv = wx.Button( self, wx.ID_ANY, _(u"Next").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
1355 fgSizer1.Add( self.but_suiv, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1357 self.but_prec = wx.Button( self, wx.ID_ANY, _(u"Previous").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
1358 fgSizer1.Add( self.but_prec, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1361 self.lab_nbcl = wx.StaticText( self, wx.ID_ANY, _(u"Number of terminal clusters on phase 1").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
1362 self.lab_nbcl.Wrap( -1 )
1363 fgSizer1.Add( self.lab_nbcl, 0, wx.ALL, 5 )
1365 self.spin_nbcl = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 2, 100, 10 )
1366 self.spin_nbcl.SetValue(10)
1367 self.spin_nbcl.SetMinSize( wx.Size( 100,30 ) )
1369 fgSizer1.Add( self.spin_nbcl, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1371 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 )
1372 self.lab_mincl.Wrap( -1 )
1373 fgSizer1.Add( self.lab_mincl, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
1375 self.spin_mincl = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 2, 1000, 0 )
1376 self.spin_mincl.SetValue(2)
1377 self.spin_mincl.SetMinSize( wx.Size( 100,30 ) )
1379 fgSizer1.Add( self.spin_mincl, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1381 bSizer2.Add( fgSizer1, 1, wx.EXPAND, 5 )
1383 m_sdbSizer2 = wx.StdDialogButtonSizer()
1384 self.m_sdbSizer2OK = wx.Button( self, wx.ID_OK )
1385 m_sdbSizer2.AddButton( self.m_sdbSizer2OK )
1386 self.m_sdbSizer2Cancel = wx.Button( self, wx.ID_CANCEL )
1387 m_sdbSizer2.AddButton( self.m_sdbSizer2Cancel )
1388 m_sdbSizer2.Realize();
1389 bSizer2.Add( m_sdbSizer2, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT|wx.ALL, 5 )
1391 self.SetSizer( bSizer2 )
1395 self.Centre( wx.BOTH )
1398 self.ListActive.Enable(False)
1399 self.ListSup.Enable(False)
1400 self.but_suiv.Enable(False)
1401 self.but_prec.Enable(False)
1403 self.ListSup.Enable(False)
1404 self.but_prec.Enable(False)
1408 self.m_radioBox1.Bind( wx.EVT_RADIOBOX, self.onformat )
1409 self.but_suiv.Bind(wx.EVT_BUTTON, self.onsuivant)
1410 self.but_prec.Bind(wx.EVT_BUTTON, self.onprec)
1411 self.m_sdbSizer2OK.Bind(wx.EVT_BUTTON, self.onvalid)
1413 def __del__( self ):
1416 # Virtual event handlers, overide them in your derived class
1417 def onformat( self, event ):
1418 if self.m_radioBox1.GetSelection() == 0 :
1419 self.ListActive.Enable(False)
1420 self.ListSup.Enable(False)
1421 self.but_suiv.Enable(False)
1422 self.m_sdbSizer2OK.Enable(True)
1424 self.ListActive.Enable(True)
1425 self.but_suiv.Enable(True)
1426 self.m_sdbSizer2OK.Enable(False)
1428 def onsuivant(self, evt) :
1429 actives = list(self.ListActive.GetSelections())
1431 if len(actives)>=3 and len(actives) != len(self.header) :
1435 header = self.header[:]
1436 for i in range(0, len(header)):
1437 self.hindices.append(i)
1439 self.nactives.append(i)
1440 header.pop(i - compt)
1441 self.hindices.pop(i - compt)
1443 self.labels = [val for val in header]
1444 self.ListSup.Clear()
1446 self.ListSup.Append(i)
1448 self.ListActive.Enable(False)
1449 self.ListSup.Enable(True)
1450 self.but_suiv.Enable(False)
1451 self.but_prec.Enable(True)
1453 self.m_sdbSizer2OK.Enable(True)
1455 def onprec(self, evt) :
1456 self.ListActive.Enable(True)
1457 self.ListSup.Enable(False)
1458 self.but_suiv.Enable(True)
1459 self.but_prec.Enable(False)
1461 self.m_sdbSizer2OK.Enable(False)
1463 def onvalid(self, evt) :
1464 for i in self.ListSup.GetSelections() :
1465 self.varsup.append(self.hindices[i])
1467 if len(self.varsup) >= 1 or self.m_radioBox1.GetSelection() == 0 :
1470 if len(self.varsup) >= 1 :
1473 class FindInCluster(wx.Frame):
1474 def __init__(self, parent, id, result, style = wx.DEFAULT_FRAME_STYLE):
1475 # begin wxGlade: MyFrame.__init__
1476 wx.Frame.__init__(self, parent, id)
1477 self.spanel = wx.ScrolledWindow(self, -1, style=wx.TAB_TRAVERSAL)
1478 self.sizer1 = wx.FlexGridSizer(0,4,0,0)
1479 self.parent = parent
1481 txt = [_(u"form").decode('utf8'),_(u"cluster").decode('utf8'),_(u"Chi2").decode('utf8'), _(u"see").decode('utf8')]
1483 self.sizer1.Add( wx.StaticText(self.spanel, -1, val), 0, wx.ALL, 5)
1485 self.sizer1.Add(wx.StaticLine(self.spanel, -1), 0, wx.ALL, 5)
1486 for i,val in enumerate(result) :
1490 pan = wx.Panel(self.spanel, -1, style=wx.SIMPLE_BORDER)
1491 siz = wx.BoxSizer(wx.VERTICAL)
1492 txt = wx.StaticText(pan, -1, forme)
1493 siz.Add(txt, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5)
1495 self.sizer1.Add(pan, 0, wx.ALL|wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 5)
1496 pan = wx.Panel(self.spanel, -1, style=wx.SIMPLE_BORDER)
1497 siz = wx.BoxSizer(wx.VERTICAL)
1498 txt = wx.StaticText(pan, -1, str(cl))
1499 siz.Add(txt, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5)
1501 self.sizer1.Add(pan, 0, wx.ALL|wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 5)
1502 pan = wx.Panel(self.spanel, -1, style=wx.SIMPLE_BORDER)
1503 siz = wx.BoxSizer(wx.VERTICAL)
1504 txt = wx.StaticText(pan, -1, str(chi))
1505 siz.Add(txt, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5)
1507 self.sizer1.Add(pan, 0, wx.ALL|wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 5)
1509 self.formes[idbut] = [forme, cl]
1510 but = wx.Button(self.spanel, idbut, u"voir")
1511 self.sizer1.Add(but, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5)
1512 self.Bind(wx.EVT_BUTTON, self.showitem, but)
1513 self.button_1 = wx.Button(self, -1, "Fermer")
1514 self.Bind(wx.EVT_BUTTON, self.OnCloseMe, self.button_1)
1515 self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)
1516 self.__set_properties()
1520 def __set_properties(self):
1521 self.SetTitle(_(u"Results").decode('utf8'))
1522 self.spanel.EnableScrolling(True,True)
1523 #self.panel_1.SetSize((1000,1000))
1524 self.spanel.SetScrollRate(20, 20)
1525 h = 60 * len(self.formes)
1530 self.SetSize(wx.Size(400,h))
1532 def __do_layout(self):
1533 # begin wxGlade: MyFrame.__do_layout
1534 sizer_1 = wx.BoxSizer(wx.VERTICAL)
1535 sizer_2 = wx.BoxSizer(wx.VERTICAL)
1536 self.spanel.SetSizer(self.sizer1)
1537 sizer_1.Add(self.spanel, 4, wx.EXPAND, 0)
1538 sizer_1.Add(self.button_1, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ADJUST_MINSIZE, 0)
1539 #sizer_1.Add(sizer_2, 1, wx.EXPAND, 0)
1540 self.SetAutoLayout(True)
1541 self.SetSizer(sizer_1)
1545 def showitem(self, evt) :
1546 idb = evt.GetEventObject().GetId()
1548 profile = nb.GetPage(nb.GetSelection())
1549 cl = self.formes[idb][1] - 1
1550 forme = self.formes[idb][0]
1551 profile.ProfNB.SetSelection(cl)
1552 UnSelectList(profile.ProfNB.GetPage(cl))
1553 datas = dict([[profile.ProfNB.GetPage(cl).getColumnText(i,6),i] for i in range(profile.ProfNB.GetPage(cl).GetItemCount())])
1554 profile.ProfNB.GetPage(cl).SetItemState(datas[self.formes[idb][0]], wx.LIST_STATE_SELECTED, wx.LIST_STATE_SELECTED)
1555 profile.ProfNB.GetPage(cl).Focus(datas[forme])
1556 profile.ProfNB.GetPage(cl).SetFocus()
1558 def OnCloseMe(self, evt) :
1561 def OnCloseWindow(self, evt):
1564 class SearchDial ( wx.Frame ):
1566 def __init__( self, parent, listctrl, col, shown):
1567 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 )
1568 self.parent = parent
1569 self.listctrl = listctrl
1572 self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
1574 bSizer1 = wx.BoxSizer( wx.VERTICAL )
1576 self.search = wx.SearchCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.TE_PROCESS_ENTER )
1577 self.search.ShowSearchButton( True )
1578 self.search.ShowCancelButton( True )
1579 bSizer1.Add( self.search, 0, wx.ALL, 5 )
1580 sizer2 = wx.BoxSizer(wx.HORIZONTAL)
1581 self.backward = wx.Button(self, wx.ID_BACKWARD, _(u"Previous").decode('utf8'))
1582 self.forward = wx.Button(self, wx.ID_FORWARD, _(u"Next").decode('utf8'))
1583 sizer2.Add(self.backward, 0, wx.ALL, 5)
1584 sizer2.Add(self.forward, 0, wx.ALL, 5)
1585 bSizer1.Add( sizer2, 0, wx.ALL, 5 )
1587 self.SetSizer( bSizer1 )
1590 self.Bind(wx.EVT_SEARCHCTRL_SEARCH_BTN, self.OnSearch, self.search)
1591 self.Bind(wx.EVT_SEARCHCTRL_CANCEL_BTN, self.OnCancel, self.search)
1592 self.Bind(wx.EVT_TEXT_ENTER, self.OnSearch, self.search)
1593 self.Bind(wx.EVT_BUTTON, self.onforward, self.forward)
1594 self.Bind(wx.EVT_BUTTON, self.onbackward, self.backward)
1595 self.search.SetFocus()
1596 self.forward.Enable(False)
1597 self.backward.Enable(False)
1599 self.Centre( wx.BOTH )
1601 def __del__( self ):
1604 def OnSearch(self, evt):
1605 UnSelectList(self.listctrl)
1606 search_word = self.search.GetValue()
1607 if search_word.strip() != '' :
1608 formes = [self.listctrl.getColumnText(i, self.col) for i in range(self.listctrl.GetItemCount())]
1609 if search_word.endswith(u'*') :
1610 search_word = search_word[0:-1]
1611 result = [j for j, forme in enumerate(formes) if forme.startswith(search_word)]
1613 result = [j for j, forme in enumerate(formes) if forme == search_word]
1616 elif self.shown == True :
1617 self.showitems(result)
1619 self.showresult(result)
1624 def showitems(self, items) :
1625 if len(items) == 1 :
1626 self.listctrl.SetItemState(items[0], wx.LIST_STATE_SELECTED, wx.LIST_STATE_SELECTED)
1627 self.listctrl.Focus(items[0])
1628 self.listctrl.SetFocus()
1632 self.listctrl.SetItemState(i, wx.LIST_STATE_SELECTED, wx.LIST_STATE_SELECTED)
1633 self.listctrl.Focus(items[0])
1634 self.listctrl.SetFocus()
1635 self.forward.Enable(True)
1636 self.backward.Enable(False)
1641 def showresult(self, result) :
1642 toshow = [self.listctrl.itemDataMap[int(self.listctrl.getColumnText(i,0))] for i in result]
1643 proflist = [[[line[1], i+1, val] for i, val in enumerate(line[2:]) if val>=2] for line in toshow]
1644 #FIXME: intervenir en aval en virant les forme avec chi<2
1645 if proflist != [[]] :
1646 proflist = [val for line in proflist for val in line if line !=[]]
1647 nb = self.parent.parent.nb
1648 profile = nb.GetPage(nb.GetSelection())
1649 first_forme = proflist[0]
1650 cl = first_forme[1] - 1
1651 profile.ProfNB.SetSelection(cl)
1652 profile.ProfNB.GetPage(cl).SetFocus()
1653 UnSelectList(profile.ProfNB.GetPage(cl))
1654 datas = dict([[profile.ProfNB.GetPage(cl).getColumnText(i,6),i] for i in range(profile.ProfNB.GetPage(cl).GetItemCount())])
1655 profile.ProfNB.GetPage(cl).SetItemState(datas[first_forme[0]], wx.LIST_STATE_SELECTED, wx.LIST_STATE_SELECTED)
1656 profile.ProfNB.GetPage(cl).Focus(datas[first_forme[0]])
1657 profile.ProfNB.GetPage(cl).SetFocus()
1658 if len(proflist) == 1 :
1661 SearchResult = FindInCluster(self.parent.parent, -1, proflist)
1667 def onforward(self, evt) :
1668 self.listctrl.Focus(self.items[self.forwitem])
1669 self.listctrl.SetFocus()
1671 if self.forwitem == len(self.items) :
1672 self.forward.Enable(False)
1673 self.backward.Enable(True)
1677 self.backward.Enable(True)
1679 def onbackward(self, evt) :
1680 self.listctrl.Focus(self.items[self.backitem])
1681 self.listctrl.SetFocus()
1683 if self.backitem == -1 :
1685 self.forward.Enable(True)
1686 self.backward.Enable(False)
1689 self.forward.Enable(True)
1691 def noresult(self) :
1692 msg = _(u"Absent form").decode('utf8')
1693 dial = wx.MessageDialog(self, _(u"Absent form").decode('utf8'),_(u"Absent form").decode('utf8'), wx.OK | wx.ICON_INFORMATION)
1694 dial.CenterOnParent()
1698 def OnCancel(self, evt) :
1701 def UnSelectList(liste) :
1702 if liste.GetFirstSelected() != -1 :
1703 last = liste.GetFirstSelected()
1704 liste.Select(liste.GetFirstSelected(), False)
1705 while liste.GetNextSelected(last) != -1 :
1706 last = liste.GetNextSelected(last)
1707 liste.Select(liste.GetFirstSelected(),False)
1710 class OptLexi(wx.Dialog):
1711 def __init__(self, parent, force_chi = False):
1712 # begin wxGlade: MyDialog.__init__
1713 #kwds["style"] = wx.DEFAULT_DIALOG_STYLE
1714 wx.Dialog.__init__(self, parent, style = wx.DEFAULT_DIALOG_STYLE)
1716 self.variables = None
1717 self.force_chi = force_chi
1718 #self.labellem = wx.StaticText(self, -1, u"Lemmatisation : ")
1719 #self.checklem = wx.CheckBox(self, -1)
1720 if not self.force_chi :
1721 self.label_typeformes = wx.StaticText(self, -1, _(u"Used forms").decode('utf8'))
1722 typeformeschoiceChoices = [ _(u"actives and supplementaries").decode('utf8'), _(u"actives").decode('utf8'), _(u"supplementaries").decode('utf8')]
1723 self.typeformes = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, typeformeschoiceChoices, 0 )
1724 self.typeformes.SetSelection( 0 )
1726 self.label_var = wx.StaticText(self, -1, _(u"Select by").decode('utf8'))
1727 self.choice = wx.Choice(self, -1, (100,50), choices = [_(u"variables").decode('utf8'), _(u"modalities").decode('utf8')])
1728 self.label1 = wx.StaticText(self, -1, _(u"Choice").decode('utf8'))
1729 self.list_box_1 = wx.ListBox(self, -1, choices=[], size = wx.Size( 150,200 ), style=wx.LB_EXTENDED | wx.LB_HSCROLL)
1730 self.button_2 = wx.Button(self, wx.ID_CANCEL, "")
1731 self.button_1 = wx.Button(self, wx.ID_OK, "")
1732 if not self.force_chi :
1733 indices = [_(u"hypergeometrical law").decode('utf8'), _(u"chi2").decode('utf8')]
1735 indices = [_(u"chi2").decode('utf8')]
1736 self.label_indice = wx.StaticText(self, -1, _(u"Score").decode('utf8'))
1737 self.choice_indice = wx.Choice(self, -1, (100,50), choices = indices)
1738 if not self.force_chi :
1739 self.label = wx.StaticText(self, -1, _(u"Minimum frequency").decode('utf8'))
1740 self.spin = wx.SpinCtrl(self, -1, min = 1, max = 10000, initial = 10)
1741 self.Bind(wx.EVT_CHOICE, self.onselect, self.choice)
1742 self.Bind(wx.EVT_LISTBOX, self.onchoose, self.list_box_1)
1743 self.__set_properties()
1747 def __set_properties(self):
1748 # begin wxGlade: MyDialog.__set_properties
1749 self.SetTitle(_(u"Variables choice").decode('utf8'))
1750 if not self.force_chi :
1751 self.spin.SetValue(10)
1752 self.choice.SetSelection(0)
1753 self.choice_indice.SetSelection(0)
1754 self.button_1.Enable(False)
1755 #self.SetMinSize(wx.Size(300, 400))
1758 def __do_layout(self):
1759 # begin wxGlade: MyDialog.__do_layout
1760 sizer_1 = wx.BoxSizer(wx.VERTICAL)
1761 sizer_2 = wx.FlexGridSizer(0,2,0,0)
1762 sizer_3 = wx.BoxSizer(wx.HORIZONTAL)
1763 #sizer_2.Add(self.labellem, 0, wx.ALIGN_CENTER_VERTICAL, 3)
1764 #sizer_2.Add(self.checklem, 0, wx.ALIGN_CENTER_VERTICAL, 3)
1765 if not self.force_chi :
1766 sizer_2.Add(self.label_typeformes, 0, wx.ALIGN_CENTER_VERTICAL, 3)
1767 sizer_2.Add(self.typeformes, 0, wx.ALIGN_CENTER_VERTICAL, 3)
1768 sizer_2.Add(self.label_var, 0, wx.ALIGN_CENTER_VERTICAL, 3)
1769 sizer_2.Add(self.choice, 0, wx.ALIGN_CENTER_VERTICAL, 3)
1770 sizer_2.Add(self.label1, 0, wx.ALIGN_CENTER_VERTICAL, 3)
1771 sizer_2.Add(self.list_box_1, 0, wx.ALIGN_RIGHT, 3)
1772 sizer_3.Add(self.button_2, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 3)
1773 sizer_3.Add(self.button_1, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 3)
1774 sizer_2.Add(self.label_indice, 0, wx.ALIGN_CENTER_VERTICAL, 3)
1775 sizer_2.Add(self.choice_indice, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 3)
1776 if not self.force_chi :
1777 sizer_2.Add(self.label, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 3)
1778 sizer_2.Add(self.spin, 0, wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 3)
1779 sizer_1.Add(sizer_2, 0, wx.ALIGN_CENTER_HORIZONTAL, 3)
1780 sizer_1.Add(sizer_3, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_RIGHT, 3)
1781 self.SetSizer(sizer_1)
1786 def onselect(self, evt):
1787 self.list_box_1.Clear()
1788 if self.choice.GetSelection() == 0 :
1789 for var in self.variables :
1790 self.list_box_1.Append(var)
1792 for et in self.listet :
1793 self.list_box_1.Append(et)
1795 def onchoose(self, evt):
1796 if self.choice.GetSelection()== 0 :
1797 if len(self.list_box_1.GetSelections()) > 0 :
1798 self.button_1.Enable(True)
1800 self.button_1.Enable(False)
1801 elif self.choice.GetSelection() == 1 :
1802 if len(self.list_box_1.GetSelections()) > 1 :
1803 self.button_1.Enable(True)
1805 self.button_1.Enable(False)
1807 class PrefDendro ( wx.Dialog ):
1809 def __init__( self, parent, param ):
1810 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 )
1812 self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
1814 fgSizer1 = wx.FlexGridSizer( 0, 2, 0, 0 )
1815 fgSizer1.SetFlexibleDirection( wx.BOTH )
1816 fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
1818 self.m_staticText1 = wx.StaticText( self, wx.ID_ANY, _(u"Picture size").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
1819 self.m_staticText1.Wrap( -1 )
1820 fgSizer1.Add( self.m_staticText1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1822 bSizer2 = wx.BoxSizer( wx.VERTICAL )
1824 bSizer3 = wx.BoxSizer( wx.HORIZONTAL )
1826 self.m_staticText2 = wx.StaticText( self, wx.ID_ANY, _(u"height").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
1827 self.m_staticText2.Wrap( -1 )
1828 bSizer3.Add( self.m_staticText2, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1830 self.m_spinCtrl1 = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 50, 10000, 600 )
1831 bSizer3.Add( self.m_spinCtrl1, 0, wx.ALL, 5 )
1833 bSizer2.Add( bSizer3, 1, wx.EXPAND, 5 )
1835 bSizer31 = wx.BoxSizer( wx.HORIZONTAL )
1837 self.m_staticText3 = wx.StaticText( self, wx.ID_ANY, _(u"width").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
1838 self.m_staticText3.Wrap( -1 )
1839 bSizer31.Add( self.m_staticText3, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1841 self.m_spinCtrl2 = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 50, 10000, 600 )
1842 bSizer31.Add( self.m_spinCtrl2, 0, wx.ALL, 5 )
1844 bSizer2.Add( bSizer31, 1, wx.EXPAND, 5 )
1846 fgSizer1.Add( bSizer2, 1, wx.EXPAND, 5 )
1848 self.m_staticline1 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1849 fgSizer1.Add( self.m_staticline1, 0, wx.EXPAND |wx.ALL, 5 )
1851 self.m_staticline2 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1852 fgSizer1.Add( self.m_staticline2, 0, wx.EXPAND |wx.ALL, 5 )
1854 self.m_staticText4 = wx.StaticText( self, wx.ID_ANY, _(u"Dendrogram type").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
1855 self.m_staticText4.Wrap( -1 )
1856 fgSizer1.Add( self.m_staticText4, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1858 m_choice1Choices = [ u"phylogram", u"cladogram", u"fan", u"unrooted", u"radial" ]
1859 self.m_choice1 = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, m_choice1Choices, 0 )
1860 self.m_choice1.SetSelection( 0 )
1861 fgSizer1.Add( self.m_choice1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT|wx.ALL, 5 )
1863 self.m_staticline3 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1864 fgSizer1.Add( self.m_staticline3, 0, wx.EXPAND |wx.ALL, 5 )
1866 self.m_staticline4 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1867 fgSizer1.Add( self.m_staticline4, 0, wx.EXPAND |wx.ALL, 5 )
1869 self.text_format_image = wx.StaticText( self, wx.ID_ANY, _(u"Image format").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
1870 self.text_format_image.Wrap( -1 )
1871 fgSizer1.Add( self.text_format_image, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1873 self.choice_format = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, ['png', 'svg'], 0 )
1874 self.choice_format.SetSelection( 0 )
1875 fgSizer1.Add( self.choice_format, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT|wx.ALL, 5 )
1877 self.m_staticline31 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1878 fgSizer1.Add( self.m_staticline31, 0, wx.EXPAND |wx.ALL, 5 )
1880 self.m_staticline41 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1881 fgSizer1.Add( self.m_staticline41, 0, wx.EXPAND |wx.ALL, 5 )
1884 self.m_staticText5 = wx.StaticText( self, wx.ID_ANY, _(u"Color or black and white").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
1885 self.m_staticText5.Wrap( -1 )
1886 fgSizer1.Add( self.m_staticText5, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1888 m_radioBox1Choices = [ _(u"color").decode('utf8'), _(u"black and white").decode('utf8') ]
1889 self.m_radioBox1 = wx.RadioBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, m_radioBox1Choices, 1, wx.RA_SPECIFY_COLS )
1890 self.m_radioBox1.SetSelection( 0 )
1891 fgSizer1.Add( self.m_radioBox1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT|wx.ALL, 5 )
1893 self.m_staticline5 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1894 fgSizer1.Add( self.m_staticline5, 0, wx.EXPAND |wx.ALL, 5 )
1896 self.m_staticline6 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1897 fgSizer1.Add( self.m_staticline6, 0, wx.EXPAND |wx.ALL, 5 )
1899 bSizer4 = wx.BoxSizer( wx.HORIZONTAL )
1901 self.m_staticText6 = wx.StaticText( self, wx.ID_ANY, _(u"Add cluster size").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
1902 self.m_staticText6.Wrap( -1 )
1903 bSizer4.Add( self.m_staticText6, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1905 self.m_checkBox1 = wx.CheckBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
1906 self.m_checkBox1.SetValue(True)
1907 bSizer4.Add( self.m_checkBox1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1909 fgSizer1.Add( bSizer4, 1, wx.EXPAND, 5 )
1911 m_radioBox2Choices = [ _(u"circular diagram").decode('utf8'), _(u"bar").decode('utf8') ]
1912 self.m_radioBox2 = wx.RadioBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, m_radioBox2Choices, 1, wx.RA_SPECIFY_COLS )
1913 self.m_radioBox2.SetSelection( 0 )
1914 fgSizer1.Add( self.m_radioBox2, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT|wx.ALL, 5 )
1916 self.m_staticline7 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1917 fgSizer1.Add( self.m_staticline7, 0, wx.EXPAND |wx.ALL, 5 )
1919 self.m_staticline8 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1920 fgSizer1.Add( self.m_staticline8, 0, wx.EXPAND |wx.ALL, 5 )
1923 fgSizer1.AddSpacer( ( 0, 0), 1, wx.EXPAND, 5 )
1925 m_sdbSizer2 = wx.StdDialogButtonSizer()
1926 self.m_sdbSizer2OK = wx.Button( self, wx.ID_OK )
1927 m_sdbSizer2.AddButton( self.m_sdbSizer2OK )
1928 self.m_sdbSizer2Cancel = wx.Button( self, wx.ID_CANCEL )
1929 m_sdbSizer2.AddButton( self.m_sdbSizer2Cancel )
1930 m_sdbSizer2.Realize();
1931 fgSizer1.Add( m_sdbSizer2, 1, wx.EXPAND, 5 )
1933 self.__set_properties()
1934 self.SetSizer( fgSizer1 )
1936 fgSizer1.Fit( self )
1938 self.Centre( wx.BOTH )
1940 def __set_properties(self):
1941 self.m_spinCtrl2.SetValue(self.param['width'])
1942 self.m_spinCtrl1.SetValue(self.param['height'])
1943 self.m_choice1.SetSelection(self.param['type_dendro'])
1944 self.m_radioBox1.SetSelection(self.param['color_nb'])
1945 self.m_checkBox1.SetValue(self.param['taille_classe'])
1946 self.m_radioBox2.SetSelection(self.param['type_tclasse'])
1947 self.choice_format.SetSelection(self.param['svg'])
1949 def __del__( self ):
1953 class PrefWordCloud ( wx.Dialog ):
1955 def __init__( self, parent, fromcluster = False ):
1956 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 )
1958 self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
1960 fgSizer1 = wx.FlexGridSizer( 0, 2, 0, 0 )
1961 fgSizer1.SetFlexibleDirection( wx.BOTH )
1962 fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
1964 #self.m_staticText1 = wx.StaticText( self, wx.ID_ANY, u"Sélectionner les formes", wx.DefaultPosition, wx.DefaultSize, 0 )
1965 #self.m_staticText1.Wrap( -1 )
1966 #fgSizer1.Add( self.m_staticText1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
1968 #self.but_selectcol = wx.Button( self, wx.ID_ANY, u"Sélectionner", wx.DefaultPosition, wx.DefaultSize, 0 )
1969 #fgSizer1.Add( self.but_selectcol, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1971 #self.m_staticline1 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1972 #fgSizer1.Add( self.m_staticline1, 0, wx.EXPAND |wx.ALL, 5 )
1974 #self.m_staticline2 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1975 #fgSizer1.Add( self.m_staticline2, 0, wx.EXPAND |wx.ALL, 5 )
1977 bSizer1 = wx.BoxSizer( wx.HORIZONTAL )
1979 self.m_staticText3 = wx.StaticText( self, wx.ID_ANY, _(u"height").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
1980 self.m_staticText3.Wrap( -1 )
1981 bSizer1.Add( self.m_staticText3, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
1983 self.spin_H = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size( 100,30 ), wx.SP_ARROW_KEYS, 0, 10000, 600 )
1984 self.spin_H.SetValue( 800 )
1985 bSizer1.Add( self.spin_H, 0, wx.ALL, 5 )
1987 fgSizer1.Add( bSizer1, 1, wx.EXPAND, 5 )
1989 bSizer3 = wx.BoxSizer( wx.HORIZONTAL )
1991 self.m_staticText4 = wx.StaticText( self, wx.ID_ANY, _(u"width").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
1992 self.m_staticText4.Wrap( -1 )
1993 bSizer3.Add( self.m_staticText4, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
1995 self.spin_L = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size( 100,30 ), wx.SP_ARROW_KEYS, 0, 10000, 600 )
1996 self.spin_L.SetValue( 800 )
1997 bSizer3.Add( self.spin_L, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1999 fgSizer1.Add( bSizer3, 1, wx.EXPAND, 5 )
2001 self.m_staticline3 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
2002 fgSizer1.Add( self.m_staticline3, 0, wx.EXPAND |wx.ALL, 5 )
2004 self.m_staticline4 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
2005 fgSizer1.Add( self.m_staticline4, 0, wx.EXPAND |wx.ALL, 5 )
2007 self.m_staticText11 = wx.StaticText( self, wx.ID_ANY, _(u"Picture format").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2008 self.m_staticText11.Wrap( -1 )
2009 fgSizer1.Add( self.m_staticText11, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2011 formatChoices = [ u"png", u"svg" ]
2012 self.format = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, formatChoices, 0 )
2013 self.format.SetSelection( 0 )
2014 fgSizer1.Add( self.format, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2017 self.m_staticText111 = wx.StaticText( self, wx.ID_ANY, _(u"Word size proportional to ...").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2018 self.m_staticText11.Wrap( -1 )
2019 fgSizer1.Add( self.m_staticText111, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2021 IndiceChoices = [ _(u"chi2").decode('utf8'), _(u"frequency").decode('utf8') ]
2022 self.indice = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, IndiceChoices, 0 )
2023 self.indice.SetSelection( 0 )
2024 fgSizer1.Add( self.indice, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2026 self.m_staticline13 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
2027 fgSizer1.Add( self.m_staticline13, 0, wx.EXPAND |wx.ALL, 5 )
2029 self.m_staticline14 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
2030 fgSizer1.Add( self.m_staticline14, 0, wx.EXPAND |wx.ALL, 5 )
2032 self.m_staticText5 = wx.StaticText( self, wx.ID_ANY, _(u"Maximum number of forms").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2033 self.m_staticText5.Wrap( -1 )
2034 fgSizer1.Add( self.m_staticText5, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2036 self.spin_maxword = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 0, 10000, 600 )
2037 self.spin_maxword.SetValue( 600 )
2038 fgSizer1.Add( self.spin_maxword, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2040 self.m_staticline5 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
2041 fgSizer1.Add( self.m_staticline5, 0, wx.EXPAND |wx.ALL, 5 )
2043 self.m_staticline6 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
2044 fgSizer1.Add( self.m_staticline6, 0, wx.EXPAND |wx.ALL, 5 )
2046 self.typeformes = wx.StaticText( self, wx.ID_ANY, _(u"Used forms").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2047 self.typeformes.Wrap( -1 )
2048 fgSizer1.Add( self.typeformes, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2050 typeformeschoiceChoices = [ _(u"actives").decode('utf8'), _(u"supplementaries").decode('utf8'), _(u"actives and supplementaries").decode('utf8') ]
2051 self.typeformeschoice = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, typeformeschoiceChoices, 0 )
2052 self.typeformeschoice.SetSelection( 0 )
2053 fgSizer1.Add( self.typeformeschoice, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2055 self.m_staticline11 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
2056 fgSizer1.Add( self.m_staticline11, 0, wx.EXPAND |wx.ALL, 5 )
2058 self.m_staticline12 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
2059 fgSizer1.Add( self.m_staticline12, 0, wx.EXPAND |wx.ALL, 5 )
2061 self.m_staticText6 = wx.StaticText( self, wx.ID_ANY, _(u"Text size").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2062 self.m_staticText6.Wrap( -1 )
2063 fgSizer1.Add( self.m_staticText6, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2065 bSizer4 = wx.BoxSizer( wx.VERTICAL )
2067 bSizer5 = wx.BoxSizer( wx.HORIZONTAL )
2069 self.m_staticText7 = wx.StaticText( self, wx.ID_ANY, u"Min", wx.DefaultPosition, wx.DefaultSize, 0 )
2070 self.m_staticText7.Wrap( -1 )
2071 bSizer5.Add( self.m_staticText7, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2073 self.spin_mincex = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 0, 1000, 5 )
2074 self.spin_mincex.SetValue( 5 )
2075 bSizer5.Add( self.spin_mincex, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT|wx.ALL, 5 )
2077 bSizer4.Add( bSizer5, 1, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.EXPAND, 5 )
2079 bSizer6 = wx.BoxSizer( wx.HORIZONTAL )
2081 self.m_staticText8 = wx.StaticText( self, wx.ID_ANY, u"Max", wx.DefaultPosition, wx.DefaultSize, 0 )
2082 self.m_staticText8.Wrap( -1 )
2083 bSizer6.Add( self.m_staticText8, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2085 self.spin_maxcex = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 0, 1000, 50 )
2086 self.spin_maxcex.SetValue( 50 )
2087 bSizer6.Add( self.spin_maxcex, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2089 bSizer4.Add( bSizer6, 1, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.EXPAND, 5 )
2091 fgSizer1.Add( bSizer4, 1, wx.EXPAND, 5 )
2093 self.m_staticline7 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
2094 fgSizer1.Add( self.m_staticline7, 0, wx.EXPAND |wx.ALL, 5 )
2096 self.m_staticline8 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
2097 fgSizer1.Add( self.m_staticline8, 0, wx.EXPAND |wx.ALL, 5 )
2099 bSizer61 = wx.BoxSizer( wx.HORIZONTAL )
2101 self.m_staticText81 = wx.StaticText( self, wx.ID_ANY, _(u"Text color").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2102 self.m_staticText81.Wrap( -1 )
2103 bSizer61.Add( self.m_staticText81, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2105 self.color_text = wx.ColourPickerCtrl( self, wx.ID_ANY, wx.BLACK, wx.DefaultPosition, wx.DefaultSize, wx.CLRP_DEFAULT_STYLE )
2106 bSizer61.Add( self.color_text, 0, wx.ALL, 5 )
2108 fgSizer1.Add( bSizer61, 1, wx.EXPAND, 5 )
2110 bSizer7 = wx.BoxSizer( wx.HORIZONTAL )
2112 self.m_staticText9 = wx.StaticText( self, wx.ID_ANY, _(u"Background color").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2113 self.m_staticText9.Wrap( -1 )
2114 bSizer7.Add( self.m_staticText9, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2116 self.color_bg = wx.ColourPickerCtrl( self, wx.ID_ANY, (255,255,255), wx.DefaultPosition, wx.DefaultSize, wx.CLRP_DEFAULT_STYLE )
2117 bSizer7.Add( self.color_bg, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2119 fgSizer1.Add( bSizer7, 1, wx.EXPAND, 5 )
2121 self.m_staticline9 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
2122 fgSizer1.Add( self.m_staticline9, 0, wx.EXPAND |wx.ALL, 5 )
2124 self.m_staticline10 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
2125 fgSizer1.Add( self.m_staticline10, 0, wx.EXPAND |wx.ALL, 5 )
2127 fgSizer1.AddSpacer( ( 0, 0), 1, wx.EXPAND, 5 )
2129 m_sdbSizer1 = wx.StdDialogButtonSizer()
2130 self.m_sdbSizer1OK = wx.Button( self, wx.ID_OK )
2131 m_sdbSizer1.AddButton( self.m_sdbSizer1OK )
2132 self.m_sdbSizer1Cancel = wx.Button( self, wx.ID_CANCEL )
2133 m_sdbSizer1.AddButton( self.m_sdbSizer1Cancel )
2134 m_sdbSizer1.Realize();
2135 fgSizer1.Add( m_sdbSizer1, 1, wx.EXPAND, 5 )
2137 self.SetSizer( fgSizer1 )
2139 fgSizer1.Fit( self )
2141 self.Centre( wx.BOTH )
2143 def __del__( self ):
2146 class PrefChi(sc.SizedDialog):
2147 def __init__(self, parent, ID, optionchi, title):
2149 sc.SizedDialog.__init__(self, None, -1, _(u"Settings").decode('utf8'),
2150 style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER)
2151 pane = self.GetContentsPane()
2152 pane.SetSizerType("form")
2153 pane.SetSizerProps(border=("all",5))
2154 self.parent = parent
2155 self.optionchi = optionchi
2158 self.label_obs = wx.StaticText(pane, -1, _(u"observed values").decode('utf8'))
2159 self.check1 = wx.CheckBox(pane, -1)
2161 self.label_theo = wx.StaticText(pane, -1, _(u"expected values").decode('utf8'))
2162 self.check2 = wx.CheckBox(pane, -1)
2164 self.label_resi = wx.StaticText(pane, -1, _(u"residuals").decode('utf8'))
2165 self.check3 = wx.CheckBox(pane, -1)
2167 self.label_contrib = wx.StaticText(pane, -1, _(u"standardized residuals").decode('utf8'))
2168 self.check4 = wx.CheckBox(pane, -1)
2169 # self.label_graph = wx.StaticText(pane, -1, u'graphique')
2170 # self.check8 = wx.CheckBox(pane, -1)
2171 self.label_pourcent = wx.StaticText(pane, -1, _(u"total percentage").decode('utf8'))
2172 self.check5 = wx.CheckBox(pane, -1)
2174 self.label_prl = wx.StaticText(pane, -1, _(u"row percentage").decode('utf8'))
2175 self.check6 = wx.CheckBox(pane, -1)
2177 self.label_prc = wx.StaticText(pane, -1, _(u"column percentage").decode('utf8'))
2178 self.check7 = wx.CheckBox(pane, -1)
2180 self.label_graph = wx.StaticText(pane, -1, _(u"graphical").decode('utf8'))
2181 self.check8 = wx.CheckBox(pane, -1)
2183 self.label_graphbw = wx.StaticText(pane, -1, _(u"black and white graphical").decode('utf8'))
2184 self.checkbw = wx.CheckBox(pane, -1)
2186 self.SetButtonSizer(self.CreateStdDialogButtonSizer(wx.OK | wx.CANCEL))
2188 self.__set_properties()
2190 self.SetMinSize(self.GetSize())
2192 def __set_properties(self):
2193 self.check1.SetValue(self.optionchi['valobs'])
2194 self.check2.SetValue(self.optionchi['valtheo'])
2195 self.check3.SetValue(self.optionchi['resi'])
2196 self.check4.SetValue(self.optionchi['contrib'])
2197 self.check5.SetValue(self.optionchi['pourcent'])
2198 self.check6.SetValue(self.optionchi['pourcentl'])
2199 self.check7.SetValue(self.optionchi['pourcentc'])
2200 self.check8.SetValue(self.optionchi['graph'])
2201 self.checkbw.SetValue(self.optionchi['bw'])
2203 class ChiDialog(wx.Dialog):
2205 self, parent, ID, title, optionchi, tableau, size=wx.DefaultSize, pos=wx.DefaultPosition,
2206 style=wx.DEFAULT_DIALOG_STYLE
2209 pre = wx.PreDialog()
2210 pre.SetExtraStyle(wx.DIALOG_EX_CONTEXTHELP)
2211 pre.Create(parent, ID, title, pos, size, style)
2213 self.PostCreate(pre)
2214 self.parent = parent
2215 self.optionchi = optionchi
2217 self.tableau = tableau
2218 #self.Filename=parent.filename
2219 #self.content=parent.content[:]
2220 self.headers=self.tableau.get_colnames()
2223 for i in self.headers:
2225 LABELLIST.append(i[0:60])
2230 self.LabelListOK=LABELLIST
2232 self.list_box_1 = wx.ListBox(self, -1, choices=self.LabelListOK, style=wx.LB_EXTENDED|wx.LB_HSCROLL)
2233 self.list_box_2 = wx.ListBox(self, -1, choices=self.LabelListOK, style=wx.LB_EXTENDED|wx.LB_HSCROLL)
2234 self.button_1 = wx.Button(self, wx.ID_OK)
2235 self.button_cancel = wx.Button(self, wx.ID_CANCEL)
2236 self.button_pref = wx.Button(self, wx.ID_PREFERENCES)
2237 self.__set_properties()
2240 self.Bind(wx.EVT_LISTBOX, self.Select1, self.list_box_1)
2241 self.Bind(wx.EVT_BUTTON, self.onparam, self.button_pref)
2243 #-------------------------------
2244 def __set_properties(self):
2245 # begin wxGlade: ConfChi2.__set_properties
2246 self.SetTitle(_(u"Variables selection").decode('utf8'))
2248 def __do_layout(self):
2249 # begin wxGlade: ConfChi2.__do_layout
2250 sizer_1 = wx.BoxSizer(wx.VERTICAL)
2251 sizer_2 = wx.BoxSizer(wx.VERTICAL)
2252 sizer_3 = wx.BoxSizer(wx.HORIZONTAL)
2253 sizer_4 = wx.BoxSizer(wx.HORIZONTAL)
2254 sizer_3.Add(self.list_box_1, 0, wx.EXPAND, 0)
2255 sizer_3.Add(self.list_box_2, 0, wx.EXPAND|wx.ALIGN_CENTER_HORIZONTAL, 0)
2256 sizer_2.Add(sizer_3, 1, wx.EXPAND, 0)
2257 sizer_4.Add(self.button_cancel, 0, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL, 0)
2258 sizer_4.Add(self.button_pref, 0, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL, 0)
2259 sizer_4.Add(self.button_1, 0, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL, 0)
2260 sizer_2.Add(sizer_4, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL, 0)
2261 sizer_1.Add(sizer_2, 1, wx.EXPAND, 0)
2262 self.SetSizer(sizer_1)
2267 def Select1(self, event): # wxGlade: ConfChi2.<event_handler>
2271 def onparam(self,event):
2272 self.dial = PrefChi(self.parent, -1, self.optionchi, '')
2273 self.dial.CenterOnParent()
2274 self.chiopt = self.dial.ShowModal()
2276 class CorpusPref ( wx.Dialog ):
2278 def __init__( self, parent, parametres ):
2279 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 )
2280 self.parent = parent
2281 langues_n = [u'français', u'english', u'german (expérimentale)', u'italian', u'swedish (expérimentale)', u'portuguese', u'spanish (expérimentale)', u'greek (expériementale)', u'galician (expérimentale)', u'autre...']
2282 self.langues = [u'french', u'english', u'german', u'italian', u'swedish', u'portuguese', u'spanish', u'greek', u'galician', u'other']
2283 self.encodages = [enc[0].lower() for enc in encodages]
2285 ucimark = [u'****', u'0000']
2286 ucemethod = [_(u"characters").decode('utf8'), _(u"occurrences").decode('utf8'), _(u"paragraphs").decode('utf8')]
2288 self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
2290 bSizer1 = wx.BoxSizer( wx.VERTICAL )
2292 self.m_notebook1 = wx.Notebook( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, 0 )
2293 self.m_panel1 = wx.Panel( self.m_notebook1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
2294 fgSizer1 = wx.FlexGridSizer( 0, 2, 0, 0 )
2295 fgSizer1.SetFlexibleDirection( wx.BOTH )
2296 fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
2298 self.m_staticText7 = wx.StaticText( self.m_panel1, wx.ID_ANY, _(u"corpus").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2299 self.m_staticText7.Wrap( -1 )
2300 fgSizer1.Add( self.m_staticText7, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2302 self.txtpath = wx.StaticText( self.m_panel1, wx.ID_ANY, _(u"Path").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2303 self.txtpath.Wrap( -1 )
2304 fgSizer1.Add( self.txtpath, 0, wx.ALL, 5 )
2306 self.m_staticText18 = wx.StaticText( self.m_panel1, wx.ID_ANY, _(u"Corpus' name").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2307 self.m_staticText18.Wrap( -1 )
2308 fgSizer1.Add( self.m_staticText18, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2310 self.corpusname = wx.TextCtrl( self.m_panel1, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size( 200,-1 ), 0 )
2311 fgSizer1.Add( self.corpusname, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2313 self.m_staticText1 = wx.StaticText( self.m_panel1, wx.ID_ANY, _(u"Characters set").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2314 self.m_staticText1.Wrap( -1 )
2315 fgSizer1.Add( self.m_staticText1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2317 encodage_choicesChoices = [' - '.join(encodage) for encodage in encodages]
2318 self.encodage_choices = wx.Choice( self.m_panel1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, encodage_choicesChoices, 0 )
2319 self.encodage_choices.SetSelection( 0 )
2320 fgSizer1.Add( self.encodage_choices, 0, wx.ALL, 5 )
2322 self.m_staticText2 = wx.StaticText( self.m_panel1, wx.ID_ANY, _(u"Language").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2323 self.m_staticText2.Wrap( -1 )
2324 fgSizer1.Add( self.m_staticText2, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2326 lang_choicesChoices = langues_n
2327 self.lang_choices = wx.Choice( self.m_panel1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, lang_choicesChoices, 0 )
2328 self.lang_choices.SetSelection( 0 )
2329 fgSizer1.Add( self.lang_choices, 0, wx.ALL, 5 )
2331 self.m_staticText19 = wx.StaticText( self.m_panel1, wx.ID_ANY, _(u"Dictionary").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2332 self.m_staticText19.Wrap( -1 )
2333 fgSizer1.Add( self.m_staticText19, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2335 bSizer2 = wx.BoxSizer( wx.HORIZONTAL )
2337 fgSizer5 = wx.FlexGridSizer( 2, 2, 0, 0 )
2338 fgSizer5.SetFlexibleDirection( wx.BOTH )
2339 fgSizer5.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
2341 self.radio_default_dict = wx.RadioButton( self.m_panel1, wx.ID_ANY, _(u"Default").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2342 fgSizer5.Add( self.radio_default_dict, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2344 self.defaultdictpath = wx.TextCtrl( self.m_panel1, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size( 300,-1 ), wx.TE_READONLY )
2345 self.defaultdictpath.Enable( False )
2347 fgSizer5.Add( self.defaultdictpath, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2349 self.radio_other_dict = wx.RadioButton( self.m_panel1, wx.ID_ANY, _(u"Other").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2350 fgSizer5.Add( self.radio_other_dict, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2352 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 )
2353 self.otherdictpath.SetMinSize(wx.Size(300, -1))
2354 fgSizer5.Add( self.otherdictpath, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2355 self.otherdictpath.Enable( False )
2358 bSizer2.Add( fgSizer5, 1, wx.EXPAND, 5 )
2361 fgSizer1.Add( bSizer2, 1, wx.EXPAND, 5 )
2363 self.m_staticText3 = wx.StaticText( self.m_panel1, wx.ID_ANY, _(u"Output folder").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2364 self.m_staticText3.Wrap( -1 )
2365 fgSizer1.Add( self.m_staticText3, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2368 fgSizer41 = wx.FlexGridSizer( 0, 2, 0, 0 )
2369 fgSizer41.SetFlexibleDirection( wx.BOTH )
2370 fgSizer41.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
2372 self.repout_choices = wx.TextCtrl( self.m_panel1, wx.ID_ANY, u"MyLabel", wx.DefaultPosition, wx.DefaultSize, 0 )
2373 self.repout_choices.SetMinSize( wx.Size( 400,-1 ) )
2374 fgSizer41.Add( self.repout_choices, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2376 self.m_button1 = wx.Button( self.m_panel1, wx.ID_ANY, _(u"Change ...").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2377 fgSizer41.Add( self.m_button1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2379 fgSizer1.Add( fgSizer41, 1, wx.EXPAND, 5 )
2381 self.m_staticText12 = wx.StaticText( self.m_panel1, wx.ID_ANY, _(u"Text mark").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2382 self.m_staticText12.Wrap( -1 )
2383 fgSizer1.Add( self.m_staticText12, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2385 ucimark_choicesChoices = ucimark
2386 self.ucimark_choices = wx.Choice( self.m_panel1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, ucimark_choicesChoices, 0 )
2387 self.ucimark_choices.SetSelection( 0 )
2388 fgSizer1.Add( self.ucimark_choices, 0, wx.ALL, 5 )
2390 self.m_staticText6 = wx.StaticText( self.m_panel1, wx.ID_ANY, _(u"Use the expression dictionary").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2391 self.m_staticText6.Wrap( -1 )
2392 fgSizer1.Add( self.m_staticText6, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2394 self.check_expressions = wx.CheckBox( self.m_panel1, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
2395 self.check_expressions.SetValue(True)
2396 fgSizer1.Add( self.check_expressions, 0, wx.ALL, 5 )
2398 self.m_staticText9 = wx.StaticText( self.m_panel1, wx.ID_ANY, _(u"Make text segments").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2399 self.m_staticText9.Wrap( -1 )
2400 fgSizer1.Add( self.m_staticText9, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2402 self.check_makeuce = wx.CheckBox( self.m_panel1, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
2403 self.check_makeuce.SetValue(True)
2404 fgSizer1.Add( self.check_makeuce, 0, wx.ALL, 5 )
2406 self.m_staticText10 = wx.StaticText( self.m_panel1, wx.ID_ANY, _(u"Text segments build process").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2407 self.m_staticText10.Wrap( -1 )
2408 fgSizer1.Add( self.m_staticText10, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2410 uce_modeChoices = ucemethod
2411 self.uce_mode = wx.Choice( self.m_panel1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, uce_modeChoices, 0 )
2412 self.uce_mode.SetSelection( 0 )
2413 fgSizer1.Add( self.uce_mode, 0, wx.ALL, 5 )
2415 self.m_staticText13 = wx.StaticText( self.m_panel1, wx.ID_ANY, _(u"Text segments size").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2416 self.m_staticText13.Wrap( -1 )
2417 fgSizer1.Add( self.m_staticText13, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2419 self.uce_size = wx.SpinCtrl( self.m_panel1, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 1, 1000000, 40 )
2420 fgSizer1.Add( self.uce_size, 0, wx.ALL, 5 )
2423 self.m_panel1.SetSizer( fgSizer1 )
2424 self.m_panel1.Layout()
2425 fgSizer1.Fit( self.m_panel1 )
2426 self.m_notebook1.AddPage( self.m_panel1, _(u"General").decode('utf8'), True )
2427 self.m_panel2 = wx.Panel( self.m_notebook1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
2428 fgSizer3 = wx.FlexGridSizer( 0, 2, 0, 0 )
2429 fgSizer3.SetFlexibleDirection( wx.BOTH )
2430 fgSizer3.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
2432 self.m_staticText4 = wx.StaticText( self.m_panel2, wx.ID_ANY, _(u"Put text in lowercase").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2433 self.m_staticText4.Wrap( -1 )
2434 fgSizer3.Add( self.m_staticText4, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2436 self.check_lower = wx.CheckBox( self.m_panel2, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
2437 self.check_lower.SetValue(True)
2438 fgSizer3.Add( self.check_lower, 0, wx.ALL, 5 )
2440 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 )
2441 self.m_staticText5.Wrap( -1 )
2442 fgSizer3.Add( self.m_staticText5, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2444 fgSizer4 = wx.FlexGridSizer( 0, 2, 0, 0 )
2445 fgSizer4.SetFlexibleDirection( wx.BOTH )
2446 fgSizer4.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
2448 self.check_charact = wx.CheckBox( self.m_panel2, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
2449 self.check_charact.SetValue(True)
2450 fgSizer4.Add( self.check_charact, 0, wx.ALL, 5 )
2452 self.txt_charact = wx.TextCtrl( self.m_panel2, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
2453 self.txt_charact.SetMinSize( wx.Size( 400,-1 ) )
2455 fgSizer4.Add( self.txt_charact, 0, wx.ALL|wx.EXPAND, 5 )
2458 fgSizer3.Add( fgSizer4, 1, wx.ALIGN_CENTER_VERTICAL|wx.EXPAND, 5 )
2460 self.m_staticText14 = wx.StaticText( self.m_panel2, wx.ID_ANY, _(u"Replace apostrophe by space").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2461 self.m_staticText14.Wrap( -1 )
2462 fgSizer3.Add( self.m_staticText14, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2464 self.check_apos = wx.CheckBox( self.m_panel2, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
2465 self.check_apos.SetValue(True)
2466 fgSizer3.Add( self.check_apos, 0, wx.ALL, 5 )
2468 self.m_staticText15 = wx.StaticText( self.m_panel2, wx.ID_ANY, _(u"Replace dash by space").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2469 self.m_staticText15.Wrap( -1 )
2470 fgSizer3.Add( self.m_staticText15, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2472 self.check_tirets = wx.CheckBox( self.m_panel2, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
2473 self.check_tirets.SetValue(True)
2474 fgSizer3.Add( self.check_tirets, 0, wx.ALL, 5 )
2476 self.m_staticText17 = wx.StaticText( self.m_panel2, wx.ID_ANY, _(u"Keep punctuation").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2477 self.m_staticText17.Wrap( -1 )
2478 fgSizer3.Add( self.m_staticText17, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2480 self.check_ponct = wx.CheckBox( self.m_panel2, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
2481 fgSizer3.Add( self.check_ponct, 0, wx.ALL, 5 )
2483 self.m_staticText16 = wx.StaticText( self.m_panel2, wx.ID_ANY, _(u"No space between two forms").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2484 self.m_staticText16.Wrap( -1 )
2485 fgSizer3.Add( self.m_staticText16, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2487 self.check_tolist = wx.CheckBox( self.m_panel2, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
2488 fgSizer3.Add( self.check_tolist, 0, wx.ALL, 5 )
2491 self.m_panel2.SetSizer( fgSizer3 )
2492 self.m_panel2.Layout()
2493 fgSizer3.Fit( self.m_panel2 )
2494 self.m_notebook1.AddPage( self.m_panel2, _(u"Cleaning").decode('utf8'), False )
2496 bSizer1.Add( self.m_notebook1, 1, wx.EXPAND |wx.ALL, 5 )
2498 m_sdbSizer1 = wx.StdDialogButtonSizer()
2499 self.m_sdbSizer1OK = wx.Button( self, wx.ID_OK )
2500 m_sdbSizer1.AddButton( self.m_sdbSizer1OK )
2501 self.m_sdbSizer1Cancel = wx.Button( self, wx.ID_CANCEL )
2502 m_sdbSizer1.AddButton( self.m_sdbSizer1Cancel )
2503 m_sdbSizer1.Realize();
2505 bSizer1.Add( m_sdbSizer1, 0, wx.EXPAND, 5 )
2509 self.Bind(wx.EVT_BUTTON, self.OnChangeDir, self.m_button1)
2510 self.lang_choices.Bind( wx.EVT_CHOICE, self.OnChangeLangage )
2511 self.radio_other_dict.Bind( wx.EVT_RADIOBUTTON, self.changedictchoice )
2512 self.radio_default_dict.Bind( wx.EVT_RADIOBUTTON, self.changedictchoice )
2513 self.otherdictpath.Bind( wx.EVT_FILEPICKER_CHANGED, self.selectdict)
2515 self.setparametres(parametres)
2516 self.SetSizer( bSizer1 )
2520 self.Centre( wx.BOTH )
2522 def OnChangeDir(self, evt) :
2523 dlg = wx.DirDialog(self.parent, _(u"Choose a folder").decode('utf8'), style = wx.DD_DEFAULT_STYLE)
2524 if dlg.ShowModal() == wx.ID_OK :
2525 self.repout_choices.SetValue(dlg.GetPath())
2527 def __del__( self ):
2530 def setparametres(self, parametres) :
2531 if locale.getpreferredencoding().lower() == 'mac-roman' :
2532 enc = self.encodages.index('macroman')
2535 enc = self.encodages.index(locale.getpreferredencoding().lower())
2537 enc = self.encodages.index('utf-8')
2538 self.encodage_choices.SetSelection(enc)
2539 self.lang_choices.SetSelection(0)
2540 self.repout_choices.SetValue(parametres['pathout'])
2541 self.corpusname.SetValue(parametres['corpus_name'])
2542 self.ucimark_choices.SetSelection(parametres['ucimark'])
2543 self.check_expressions.SetValue(parametres['expressions'])
2544 self.check_makeuce.SetValue(parametres['douce'])
2545 self.uce_mode.SetSelection(parametres['ucemethod'])
2546 self.uce_size.SetValue(parametres['ucesize'])
2547 self.check_lower.SetValue(parametres['lower'])
2548 #self.check_charact.SetValue(parametres['charact'])
2549 self.txt_charact.SetValue(parametres['keep_caract'])
2550 self.check_apos.SetValue(parametres['apos'])
2551 self.check_tirets.SetValue(parametres['tiret'])
2552 self.check_tolist.SetValue(parametres['tolist'])
2553 self.check_ponct.SetValue(parametres['keep_ponct'])
2554 self.defaultdictpath.SetValue(self.langues[0])
2556 def doparametres(self) :
2558 parametres['encoding'] = encodages[self.encodage_choices.GetSelection()][0]
2559 parametres['lang'] = self.langues[self.lang_choices.GetSelection()]
2560 parametres['pathout'] = self.repout_choices.GetValue()
2561 parametres['corpus_name'] = self.corpusname.GetValue()
2562 parametres['ucimark'] = self.ucimark_choices.GetSelection()
2563 parametres['expressions'] = self.check_expressions.GetValue()
2564 parametres['douce'] = self.check_makeuce.GetValue()
2565 parametres['ucemethod'] = self.uce_mode.GetSelection()
2566 parametres['ucesize'] = self.uce_size.GetValue()
2567 parametres['lower'] = self.check_lower.GetValue()
2568 parametres['charact'] = self.check_charact.GetValue()
2569 parametres['keep_caract'] = self.txt_charact.GetValue()
2570 parametres['apos'] = self.check_apos.GetValue()
2571 parametres['tiret'] = self.check_tirets.GetValue()
2572 parametres['tolist'] = self.check_tolist.GetValue()
2573 parametres['keep_ponct'] = self.check_ponct.GetValue()
2574 if self.radio_other_dict.GetValue() :
2575 parametres['dictionary'] = self.otherdictpath.GetPath()
2576 for val in parametres :
2577 if isinstance(parametres[val], bool) :
2578 if parametres[val] :
2584 def OnChangeLangage(self, evt):
2585 self.defaultdictpath.SetValue(self.langues[self.lang_choices.GetSelection()])
2587 def changedictchoice(self, evt):
2588 if self.radio_default_dict.GetValue() :
2589 self.otherdictpath.Enable( False )
2590 self.m_sdbSizer1OK.Enable( True )
2592 self.otherdictpath.Enable( True )
2593 if self.otherdictpath.GetPath() == '' :
2594 self.m_sdbSizer1OK.Enable( False )
2596 def selectdict(self, evt):
2597 if self.otherdictpath.GetPath() != '' :
2598 self.m_sdbSizer1OK.Enable( True )
2602 class ConcordList(wx.HtmlListBox):
2603 def __init__(self, parent, concord):
2604 self.concord = concord
2605 #self.script_status = dict()
2606 wx.HtmlListBox.__init__(self, parent, -1, size = (900, 600))
2607 self.SetItemCount(len(concord))
2608 #self.Bind(wx.EVT_LISTBOX, self.RefreshMe)
2609 #self.Bind(wx.EVT_LISTBOX_DCLICK, self.Download)
2611 def OnGetItem(self, index):
2612 return self.concord[index] #+ '<br>'
2614 class message(wx.Frame):
2615 def __init__(self, parent, items, title, size, save = True, uceids = None):
2616 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 )
2618 self.uceids = uceids
2619 self.ira = wx.GetApp().GetTopWindow()
2620 self.SetIcon(self.ira._icon)
2621 self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
2624 #self.HtmlPage=wx.html.HtmlWindow(self, -1)
2625 self.HtmlPage = ConcordList(self, items)
2626 #self.HtmlPage.SetMinSize( size )
2627 #if "gtk2" in wx.PlatformInfo:
2628 # self.HtmlPage.SetStandardFonts()
2629 #self.HtmlPage.SetFonts('Courier','Courier')
2631 self.button_1 = wx.Button(self, wx.ID_CANCEL)
2633 self.Bind(wx.EVT_BUTTON, self.OnCloseMe, self.button_1)
2635 self.button_2 = wx.Button(self, wx.ID_SAVE)
2636 self.Bind(wx.EVT_BUTTON, self.OnSavePage, self.button_2)
2637 if self.uceids is not None :
2638 self.butsub = wx.Button(self, -1, _(u"Build sub corpus").decode('utf8'))
2639 self.Bind(wx.EVT_BUTTON, self.OnSub, self.butsub)
2640 self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)
2643 def __do_layout(self):
2644 sizer_2 = wx.BoxSizer(wx.VERTICAL)
2645 sizer_2.Add(self.HtmlPage, 1, wx.EXPAND|wx.ADJUST_MINSIZE, 0)
2646 #m_sdbSizer1 = wx.StdDialogButtonSizer()
2647 m_sdbSizer1 = wx.BoxSizer(wx.HORIZONTAL)
2648 m_sdbSizer1.Add( self.button_1 , 0, wx.RIGHT | wx.EXPAND)
2650 m_sdbSizer1.Add( self.button_2 , 0, wx.RIGHT | wx.EXPAND)
2651 if self.uceids is not None :
2652 m_sdbSizer1.Add( self.butsub , 0, wx.RIGHT | wx.EXPAND)
2653 #m_sdbSizer1.Realize()
2654 sizer_2.Add(m_sdbSizer1, 0, wx.RIGHT | wx.EXPAND, 5)
2655 self.SetSizer(sizer_2)
2659 def OnSavePage(self, evt) :
2660 dlg = wx.FileDialog(
2661 self, message=_(u"Save as ...").decode('utf8'), defaultDir=os.getcwd(),
2662 defaultFile="concordancier.html", wildcard="html|*.html", style=wx.SAVE | wx.OVERWRITE_PROMPT
2664 dlg.SetFilterIndex(2)
2665 dlg.CenterOnParent()
2666 self.html = '<br>'.join([self.items[i] for i in range(0,len(self.items))])
2667 if dlg.ShowModal() == wx.ID_OK:
2668 path = dlg.GetPath()
2669 with open(path, 'w') as f :
2672 def OnCloseMe(self, event):
2675 def OnCloseWindow(self, event):
2678 def OnSub(self ,evt):
2679 parametres = {'fromuceids' : True, 'uceids' : self.uceids, 'isempty' : True}
2680 self.ira.OnSubText(wx.MenuEvent(), None, parametres)
2683 class ExtractDialog ( wx.Dialog ):
2685 def __init__( self, parent, option ):
2686 wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = wx.EmptyString, pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.DEFAULT_DIALOG_STYLE )
2688 self.option = option
2690 self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
2692 fgSizer1 = wx.FlexGridSizer( 0, 2, 0, 0 )
2693 fgSizer1.SetFlexibleDirection( wx.BOTH )
2694 fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
2696 self.m_staticText1 = wx.StaticText( self, wx.ID_ANY, _(u"corpus").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2697 self.m_staticText1.Wrap( -1 )
2698 fgSizer1.Add( self.m_staticText1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2700 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 )
2701 self.corpusfile.SetMinSize( wx.Size( 500,-1 ) )
2703 fgSizer1.Add( self.corpusfile, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL|wx.EXPAND, 5 )
2705 self.m_staticText2 = wx.StaticText( self, wx.ID_ANY, _(u"Characters set").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2706 self.m_staticText2.Wrap( -1 )
2707 fgSizer1.Add( self.m_staticText2, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2709 encodageChoices = [' - '.join(encodage) for encodage in encodages]
2710 self.encodage = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, encodageChoices, 0 )
2711 self.encodage.SetSelection( 0 )
2712 self.encodage.SetMinSize( wx.Size( 200,-1 ) )
2714 fgSizer1.Add( self.encodage, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL|wx.EXPAND, 5 )
2716 if option == 'splitvar' :
2717 self.m_staticText3 = wx.StaticText( self, wx.ID_ANY, _(u"Variables (with the * but without the _)").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2718 self.m_staticText3.Wrap( -1 )
2719 fgSizer1.Add( self.m_staticText3, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2721 self.txtvar = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
2722 self.txtvar.SetMinSize( wx.Size( 200,-1 ) )
2724 fgSizer1.Add( self.txtvar, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL|wx.EXPAND, 5 )
2726 if option == 'mods' :
2727 self.m_staticText4 = wx.StaticText( self, wx.ID_ANY, _(u"Modalities (one by line, with the *)").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2728 self.m_staticText4.Wrap( -1 )
2729 fgSizer1.Add( self.m_staticText4, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2731 self.txtmods = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.TE_MULTILINE )
2732 self.txtmods.SetMinSize( wx.Size( 200,150 ) )
2734 fgSizer1.Add( self.txtmods, 0, wx.ALL|wx.EXPAND, 5 )
2736 self.m_staticText5 = wx.StaticText( self, wx.ID_ANY, _(u"Extraction type").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2737 self.m_staticText5.Wrap( -1 )
2738 fgSizer1.Add( self.m_staticText5, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2740 extractformatChoices = [ _(u"Only one file").decode('utf8'), _(u"One file by modality").decode('utf8') ]
2741 self.extractformat = wx.RadioBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, extractformatChoices, 1, wx.RA_SPECIFY_COLS )
2742 self.extractformat.SetSelection( 0 )
2743 fgSizer1.Add( self.extractformat, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2745 if option == 'them' :
2746 self.m_staticText4 = wx.StaticText( self, wx.ID_ANY, _(u"thematics (one by line, with the -*)").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2747 self.m_staticText4.Wrap( -1 )
2748 fgSizer1.Add( self.m_staticText4, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2750 self.txtmods = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.TE_MULTILINE )
2751 self.txtmods.SetMinSize( wx.Size( 200,150 ) )
2753 fgSizer1.Add( self.txtmods, 0, wx.ALL|wx.EXPAND, 5 )
2755 #self.m_staticText5 = wx.StaticText( self, wx.ID_ANY, _(u"Extraction type").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2756 #self.m_staticText5.Wrap( -1 )
2757 #fgSizer1.Add( self.m_staticText5, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2759 #extractformatChoices = [ _(u"Only one file").decode('utf8'), _(u"One file by thematic").decode('utf8') ]
2760 #self.extractformat = wx.RadioBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, extractformatChoices, 1, wx.RA_SPECIFY_COLS )
2761 #self.extractformat.SetSelection( 0 )
2762 #fgSizer1.Add( self.extractformat, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2765 fgSizer1.AddSpacer( ( 0, 0), 1, wx.EXPAND, 5 )
2767 m_sdbSizer1 = wx.StdDialogButtonSizer()
2768 self.m_sdbSizer1OK = wx.Button( self, wx.ID_OK )
2769 m_sdbSizer1.AddButton( self.m_sdbSizer1OK )
2770 self.m_sdbSizer1Cancel = wx.Button( self, wx.ID_CANCEL )
2771 m_sdbSizer1.AddButton( self.m_sdbSizer1Cancel )
2772 m_sdbSizer1.Realize()
2774 fgSizer1.Add( m_sdbSizer1, 1, wx.EXPAND, 5 )
2777 self.SetSizer( fgSizer1 )
2779 fgSizer1.Fit( self )
2781 self.Centre( wx.BOTH )
2783 def make_param(self) :
2785 le = [enc[0].lower() for enc in encodages]
2786 parametres['filein'] = self.corpusfile.GetPath()
2787 encodage = le[self.encodage.GetSelection()]
2788 parametres['encodein'] = encodage
2789 if self.option == 'splitvar' :
2790 parametres['var'] = self.txtvar.GetValue()
2791 if self.option == 'mods' :
2792 parametres['mods'] = self.txtmods.GetValue().splitlines()
2793 if self.extractformat.GetSelection() == 0 :
2794 parametres['onefile'] = True
2796 parametres['onefile'] = False
2797 if self.option == 'them' :
2798 parametres['them'] = self.txtmods.GetValue().splitlines()
2799 # if self.extractformat.GetSelection() == 0 :
2800 # parametres['onefile'] = True
2802 # parametres['onefile'] = False
2803 parametres['encodeout'] = le[self.encodage.GetSelection()]
2806 def __del__( self ):
2809 class FreqDialog ( wx.Dialog ):
2811 def __init__( self, parent, listcol, title, size = wx.Size( -1,-1 ), showNA = True):
2812 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 )
2814 self.header = listcol
2816 self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
2818 bSizer1 = wx.BoxSizer( wx.VERTICAL )
2820 m_listBox1Choices = self.header
2821 self.m_listBox1 = wx.ListBox( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, m_listBox1Choices, wx.LB_EXTENDED|wx.LB_HSCROLL )
2822 self.m_listBox1.SetMinSize( wx.Size( 500,-1 ) )
2823 bSizer1.Add( self.m_listBox1, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2826 fgSizer1 = wx.FlexGridSizer( 0, 2, 0, 0 )
2827 fgSizer1.SetFlexibleDirection( wx.BOTH )
2828 fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
2830 self.m_staticText1 = wx.StaticText( self, wx.ID_ANY, _(u"Include empty cells (NA)").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2831 self.m_staticText1.Wrap( -1 )
2832 fgSizer1.Add( self.m_staticText1, 0, wx.ALL, 5 )
2834 self.includeNA = wx.CheckBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
2835 fgSizer1.Add( self.includeNA, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2837 bSizer1.Add( fgSizer1, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL, 5 )
2839 m_sdbSizer1 = wx.StdDialogButtonSizer()
2840 self.m_sdbSizer1OK = wx.Button( self, wx.ID_OK )
2841 m_sdbSizer1.AddButton( self.m_sdbSizer1OK )
2842 self.m_sdbSizer1Cancel = wx.Button( self, wx.ID_CANCEL )
2843 m_sdbSizer1.AddButton( self.m_sdbSizer1Cancel )
2844 m_sdbSizer1.Realize();
2846 bSizer1.Add( m_sdbSizer1, 0, wx.EXPAND, 5 )
2849 self.SetSizer( bSizer1 )
2853 self.Centre( wx.BOTH )
2855 def __del__( self ):
2860 class ProtoDial ( wx.Dialog ):
2862 def __init__( self, parent, headers ):
2863 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 )
2865 self.SetSizeHintsSz( wx.Size( -1,-1 ), wx.DefaultSize )
2867 bSizer1 = wx.BoxSizer( wx.VERTICAL )
2869 fgSizer1 = wx.FlexGridSizer( 0, 2, 0, 0 )
2870 fgSizer1.SetFlexibleDirection( wx.BOTH )
2871 fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
2873 self.m_staticText1 = wx.StaticText( self, wx.ID_ANY, _(u"Variables").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2874 self.m_staticText1.Wrap( -1 )
2875 fgSizer1.Add( self.m_staticText1, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALL, 5 )
2877 self.m_staticText2 = wx.StaticText( self, wx.ID_ANY, _(u"Ranks").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2878 self.m_staticText2.Wrap( -1 )
2879 fgSizer1.Add( self.m_staticText2, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALL, 5 )
2881 variablesChoices = headers
2882 self.variables = wx.ListBox( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, variablesChoices, wx.LB_HSCROLL|wx.LB_MULTIPLE )
2883 self.variables.SetMinSize( wx.Size( 350,-1 ) )
2885 fgSizer1.Add( self.variables, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL|wx.EXPAND, 5 )
2887 rangsChoices = headers
2888 self.rangs = wx.ListBox( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, rangsChoices, wx.LB_HSCROLL|wx.LB_MULTIPLE )
2889 self.rangs.SetMinSize( wx.Size( 350,-1 ) )
2891 fgSizer1.Add( self.rangs, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL|wx.EXPAND, 5 )
2894 bSizer1.Add( fgSizer1, 1, wx.ALIGN_CENTER_HORIZONTAL, 5 )
2896 fgSizer3 = wx.FlexGridSizer( 0, 2, 0, 0 )
2897 fgSizer3.SetFlexibleDirection( wx.BOTH )
2898 fgSizer3.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
2900 self.m_staticText3 = wx.StaticText( self, wx.ID_ANY, _(u"Limit frequency").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2901 self.m_staticText3.Wrap( -1 )
2902 fgSizer3.Add( self.m_staticText3, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2904 bSizer2 = wx.BoxSizer( wx.HORIZONTAL )
2906 choix_freqChoices = [ _(u"automatic (mean)").decode('utf8'), _(u"manual").decode('utf8') ]
2907 self.choix_freq = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, choix_freqChoices, 0 )
2908 self.choix_freq.SetSelection( 0 )
2909 bSizer2.Add( self.choix_freq, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2911 self.freqlim = wx.TextCtrl( self, wx.ID_ANY, u"0", wx.DefaultPosition, wx.DefaultSize, wx.TE_CENTRE )
2912 self.freqlim.Enable( False )
2913 self.freqlim.SetMinSize( wx.Size( 100,-1 ) )
2915 bSizer2.Add( self.freqlim, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2918 fgSizer3.Add( bSizer2, 1, wx.EXPAND, 5 )
2920 self.m_staticText4 = wx.StaticText( self, wx.ID_ANY, _(u"Limit rank").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2921 self.m_staticText4.Wrap( -1 )
2922 fgSizer3.Add( self.m_staticText4, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2924 bSizer21 = wx.BoxSizer( wx.HORIZONTAL )
2926 choix_rangChoices = [ _(u"automatic (mean)").decode('utf8'), _(u"manual").decode('utf8')]
2927 self.choix_rang = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, choix_rangChoices, 0 )
2928 self.choix_rang.SetSelection( 0 )
2929 bSizer21.Add( self.choix_rang, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2931 self.ranglim = wx.TextCtrl( self, wx.ID_ANY, u"0", wx.DefaultPosition, wx.DefaultSize, wx.TE_CENTRE )
2932 self.ranglim.Enable( False )
2933 self.ranglim.SetMinSize( wx.Size( 100,-1 ) )
2935 bSizer21.Add( self.ranglim, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2938 fgSizer3.Add( bSizer21, 1, wx.EXPAND, 5 )
2940 self.m_staticText5 = wx.StaticText( self, wx.ID_ANY, _(u"Minimum frequency").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2941 self.m_staticText5.Wrap( -1 )
2942 fgSizer3.Add( self.m_staticText5, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2944 self.m_textCtrl4 = wx.TextCtrl( self, wx.ID_ANY, u"2", wx.DefaultPosition, wx.DefaultSize, wx.TE_CENTRE )
2945 fgSizer3.Add( self.m_textCtrl4, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALL, 5 )
2947 self.m_staticText6 = wx.StaticText( self, wx.ID_ANY, u"Type de représentation", wx.DefaultPosition, wx.DefaultSize, 0 )
2948 self.m_staticText6.Wrap( -1 )
2949 fgSizer3.Add( self.m_staticText6, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2951 m_choice3Choices = [ u"Classical - List", u"Classical - Cloud", u"Plan" ]
2952 self.typegraph = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, m_choice3Choices, 0 )
2953 self.typegraph.SetSelection( 0 )
2954 fgSizer3.Add( self.typegraph, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALL, 5 )
2956 bSizer1.Add( fgSizer3, 0, wx.ALIGN_CENTER_HORIZONTAL, 5 )
2958 m_sdbSizer1 = wx.StdDialogButtonSizer()
2959 self.m_sdbSizer1OK = wx.Button( self, wx.ID_OK )
2960 m_sdbSizer1.AddButton( self.m_sdbSizer1OK )
2961 self.m_sdbSizer1Cancel = wx.Button( self, wx.ID_CANCEL )
2962 m_sdbSizer1.AddButton( self.m_sdbSizer1Cancel )
2963 m_sdbSizer1.Realize();
2965 bSizer1.Add( m_sdbSizer1, 0, wx.EXPAND, 5 )
2967 self.SetSizer( bSizer1 )
2971 self.Centre( wx.BOTH )
2974 self.choix_freq.Bind( wx.EVT_CHOICE, self.UpdateText )
2975 self.choix_rang.Bind( wx.EVT_CHOICE, self.UpdateText )
2977 def __del__( self ):
2981 # Virtual event handlers, overide them in your derived class
2982 def UpdateText( self, event ):
2985 class SimpleDialog ( wx.Dialog ):
2987 def __init__( self, parent ):
2988 wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = wx.EmptyString, pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.DEFAULT_DIALOG_STYLE )
2990 self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
2992 bSizer1 = wx.BoxSizer( wx.VERTICAL )
2994 self.m_panel1 = wx.Panel( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
2995 bSizer2 = wx.BoxSizer( wx.VERTICAL )
2997 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 )
2998 self.m_staticText1.Wrap( -1 )
2999 bSizer2.Add( self.m_staticText1, 0, wx.ALL, 5 )
3001 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 )
3002 bSizer2.Add( self.link, 0, wx.ALL, 5 )
3005 self.m_panel1.SetSizer( bSizer2 )
3006 self.m_panel1.Layout()
3007 bSizer2.Fit( self.m_panel1 )
3008 bSizer1.Add( self.m_panel1, 1, wx.EXPAND |wx.ALL, 5 )
3010 m_sdbSizer1 = wx.StdDialogButtonSizer()
3011 self.m_sdbSizer1OK = wx.Button( self, wx.ID_OK )
3012 m_sdbSizer1.AddButton( self.m_sdbSizer1OK )
3013 m_sdbSizer1.Realize();
3015 bSizer1.Add( m_sdbSizer1, 0, wx.EXPAND, 5 )
3018 self.SetSizer( bSizer1 )
3022 self.Centre( wx.BOTH )
3024 def __del__( self ):
3028 class SubTextFromMetaDial ( wx.Dialog ):
3030 def __init__( self, parent, parametres ):
3031 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 )
3033 self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
3035 bSizer1 = wx.BoxSizer( wx.VERTICAL )
3037 fgSizer1 = wx.FlexGridSizer( 0, 2, 0, 0 )
3038 fgSizer1.SetFlexibleDirection( wx.BOTH )
3039 fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
3041 self.m_staticText1 = wx.StaticText( self, wx.ID_ANY, _(u"Name").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
3042 self.m_staticText1.Wrap( -1 )
3043 fgSizer1.Add( self.m_staticText1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
3045 self.subcorpusname = wx.TextCtrl( self, wx.ID_ANY, parametres['corpus_name'], wx.DefaultPosition, wx.Size( 300,-1 ), 0 )
3046 fgSizer1.Add( self.subcorpusname, 0, wx.ALL, 5 )
3048 self.m_staticText2 = wx.StaticText( self, wx.ID_ANY, _(u"Select one or more metadata").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
3049 self.m_staticText2.Wrap( -1 )
3050 fgSizer1.Add( self.m_staticText2, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
3052 m_listBox1Choices = parametres['meta']
3053 self.m_listBox1 = wx.ListBox( self, wx.ID_ANY, wx.DefaultPosition, wx.Size( -1,-1 ), m_listBox1Choices, wx.LB_HSCROLL|wx.LB_MULTIPLE )
3054 self.m_listBox1.SetMinSize( wx.Size( -1,200 ) )
3055 self.m_listBox1.SetMaxSize( wx.Size( -1,500 ) )
3057 fgSizer1.Add( self.m_listBox1, 0, wx.ALL|wx.EXPAND, 5 )
3060 bSizer1.Add( fgSizer1, 1, wx.EXPAND, 5 )
3062 m_sdbSizer1 = wx.StdDialogButtonSizer()
3063 self.m_sdbSizer1OK = wx.Button( self, wx.ID_OK )
3064 m_sdbSizer1.AddButton( self.m_sdbSizer1OK )
3065 self.m_sdbSizer1Cancel = wx.Button( self, wx.ID_CANCEL )
3066 m_sdbSizer1.AddButton( self.m_sdbSizer1Cancel )
3067 m_sdbSizer1.Realize();
3069 bSizer1.Add( m_sdbSizer1, 0, wx.EXPAND, 5 )
3072 self.SetSizer( bSizer1 )
3076 self.Centre( wx.BOTH )
3077 self.Bind(wx.EVT_LISTBOX, self.onchoose, self.m_listBox1)
3078 if not parametres.get('isempty', False) :
3079 self.m_sdbSizer1OK.Enable(False)
3081 def __del__( self ):
3084 def onchoose(self, evt):
3085 if len(self.m_listBox1.GetSelections()) > 0 :
3086 self.m_sdbSizer1OK.Enable(True)
3088 self.m_sdbSizer1OK.Enable(False)
3090 class BarGraphDialog ( wx.Dialog ):
3092 def __init__( self, parent, width, height ):
3093 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 )
3095 self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
3097 bSizer1 = wx.BoxSizer( wx.VERTICAL )
3099 bSizer2 = wx.BoxSizer( wx.HORIZONTAL )
3101 self.m_staticText1 = wx.StaticText( self, wx.ID_ANY, _(u"Size").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
3102 self.m_staticText1.Wrap( -1 )
3103 bSizer2.Add( self.m_staticText1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
3105 sizeradioChoices = [ _(u"automatic").decode('utf8'), _(u"manual").decode('utf8') ]
3106 self.sizeradio = wx.RadioBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, sizeradioChoices, 1, wx.RA_SPECIFY_COLS )
3107 self.sizeradio.SetSelection( 0 )
3108 bSizer2.Add( self.sizeradio, 0, wx.ALIGN_TOP|wx.ALL, 5 )
3110 fgSizer1 = wx.FlexGridSizer( 0, 2, 0, 0 )
3111 fgSizer1.SetFlexibleDirection( wx.BOTH )
3112 fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
3114 self.m_staticText2 = wx.StaticText( self, wx.ID_ANY, _(u"width").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
3115 self.m_staticText2.Wrap( -1 )
3116 fgSizer1.Add( self.m_staticText2, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
3118 self.widthsp = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 0, 1000000, 600 )
3119 fgSizer1.Add( self.widthsp, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
3121 self.m_staticText3 = wx.StaticText( self, wx.ID_ANY, _(u"height").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
3122 self.m_staticText3.Wrap( -1 )
3123 fgSizer1.Add( self.m_staticText3, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
3125 self.heightsp = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 1, 10000000, 400 )
3126 fgSizer1.Add( self.heightsp, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
3129 bSizer2.Add( fgSizer1, 1, wx.EXPAND, 5 )
3132 bSizer1.Add( bSizer2, 1, wx.EXPAND, 5 )
3134 bSizer3 = wx.BoxSizer( wx.HORIZONTAL )
3136 self.m_staticText4 = wx.StaticText( self, wx.ID_ANY, _(u"Image format").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
3137 self.m_staticText4.Wrap( -1 )
3138 bSizer3.Add( self.m_staticText4, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
3140 formatChoices = [ u"png", u"svg" ]
3141 self.format = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, formatChoices, 0 )
3142 self.format.SetSelection( 0 )
3143 bSizer3.Add( self.format, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
3146 bSizer1.Add( bSizer3, 1, wx.EXPAND, 5 )
3148 m_sdbSizer1 = wx.StdDialogButtonSizer()
3149 self.m_sdbSizer1OK = wx.Button( self, wx.ID_OK )
3150 m_sdbSizer1.AddButton( self.m_sdbSizer1OK )
3151 self.m_sdbSizer1Cancel = wx.Button( self, wx.ID_CANCEL )
3152 m_sdbSizer1.AddButton( self.m_sdbSizer1Cancel )
3153 m_sdbSizer1.Realize();
3155 bSizer1.Add( m_sdbSizer1, 0, wx.EXPAND, 5 )
3158 self.SetSizer( bSizer1 )
3162 self.Centre( wx.BOTH )
3165 self.sizeradio.Bind( wx.EVT_RADIOBOX, self.OnSizeRadio )
3167 self.widthsp.SetValue(width)
3168 self.heightsp.SetValue(height)
3169 self.widthsp.Enable(False)
3170 self.heightsp.Enable(False)
3171 self.m_sdbSizer1OK.SetFocus()
3173 def __del__( self ):
3177 # Virtual event handlers, overide them in your derived class
3178 def OnSizeRadio( self, event ):
3179 if self.sizeradio.GetSelection() == 0 :
3180 self.widthsp.Enable(False)
3181 self.heightsp.Enable(False)
3183 self.widthsp.Enable(True)
3184 self.heightsp.Enable(True)
3187 class MessageImage(wx.Frame):
3188 def __init__(self, parent, parametres, title, size):
3189 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 )
3190 self.ira = wx.GetApp().GetTopWindow()
3191 self.SetIcon(self.ira._icon)
3192 self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
3193 self.parametres = parametres
3194 self.imageFile = self.parametres['tmpgraph']
3195 if parametres['svg'] == 'TRUE' :
3196 self.imagename = u"image.svg"
3198 self.imagename = u"image.png"
3199 self.HtmlPage = wx.html.HtmlWindow(self, -1)
3200 self.HtmlPage.SetMinSize(size)
3201 if "gtk2" in wx.PlatformInfo:
3202 self.HtmlPage.SetStandardFonts()
3203 self.HtmlPage.SetFonts('Courier', 'Courier')
3205 self.button_1 = wx.Button(self, wx.ID_CANCEL)
3206 self.button_2 = wx.Button(self, wx.ID_SAVE)
3207 self.Bind(wx.EVT_BUTTON, self.OnCloseMe, self.button_1)
3208 self.Bind(wx.EVT_BUTTON, self.OnSaveImage, self.button_2)
3211 def do_layout(self):
3212 self.sizer_1 = wx.BoxSizer(wx.VERTICAL)
3213 self.sizer_2 = wx.BoxSizer(wx.HORIZONTAL)
3214 self.sizer_1.Add(self.HtmlPage, 2, wx.EXPAND, 0)
3216 self.m_sdbSizer1 = wx.StdDialogButtonSizer()
3217 self.m_sdbSizer1.AddButton( self.button_2 )
3218 self.m_sdbSizer1.AddButton( self.button_1 )
3219 self.m_sdbSizer1.Realize()
3220 self.sizer_1.Add(self.m_sdbSizer1, 0, wx.EXPAND, 5)
3221 self.SetSizer(self.sizer_1)
3223 self.sizer_1.Fit( self )
3225 def OnCloseMe(self, event):
3228 def OnSaveImage(self, event) :
3229 dlg = wx.FileDialog(
3230 self, message=_(u"Save as...").decode('utf8'), defaultDir=os.getcwd(),
3231 defaultFile= self.imagename, wildcard=self.parametres['wildcard'], style=wx.SAVE | wx.OVERWRITE_PROMPT
3233 dlg.SetFilterIndex(2)
3234 dlg.CenterOnParent()
3235 if dlg.ShowModal() == wx.ID_OK:
3236 path = dlg.GetPath()
3237 copyfile(self.imageFile, path)
3240 def __init__(self, ira, table, colnames, rownames, tree = False):
3242 width = 100 + (10*len(rownames)) + (100 * len(colnames))
3243 height = len(rownames) * 15
3248 height = (35 * len(colnames)) + (15 * len(rownames))
3249 dial = BarGraphDialog(ira, width, height)
3250 val = dial.ShowModal()
3251 if val == wx.ID_OK :
3252 tmpgraph = tempfile.mktemp(dir=ira.TEMPDIR)
3253 if dial.format.GetSelection() == 0 :
3255 wildcard = "png|*.png"
3258 wildcard = "svg|*.svg"
3259 parametres = {'width' : dial.widthsp.GetValue(),
3260 'height': dial.heightsp.GetValue(),
3261 'colnames' : colnames,
3262 'rownames' : rownames,
3263 'tmpgraph' : tmpgraph,
3264 'rgraph' : ira.RscriptsPath['Rgraph'],
3266 'wildcard' : wildcard}
3268 parametres['tree'] = tree
3269 txt = barplot(table, parametres)
3270 tmpscript = tempfile.mktemp(dir=ira.TEMPDIR)
3271 with open(tmpscript,'w') as f :
3273 exec_rcode(ira.RPath, tmpscript, wait = True)
3274 win = MessageImage(ira, parametres, _(u"Graphic").decode('utf8'), size=(700, 500))
3276 txt = "<img src='%s'>" % tmpgraph
3278 txt = """Copiez ce lien dans votre navigateur : <br>
3279 <a href="%s">%s</a>""" % (tmpgraph, tmpgraph)
3280 win.HtmlPage.SetPage(txt)