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", 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", 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", u"no" ]
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", 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", 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", 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", u"other" ]
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 )
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.__set_properties()
1746 def __set_properties(self):
1747 # begin wxGlade: MyDialog.__set_properties
1748 self.SetTitle(_(u"Variables choice").decode('utf8'))
1749 if not self.force_chi :
1750 self.spin.SetValue(10)
1751 self.choice.SetSelection(0)
1752 self.choice_indice.SetSelection(0)
1753 #self.SetMinSize(wx.Size(300, 400))
1756 def __do_layout(self):
1757 # begin wxGlade: MyDialog.__do_layout
1758 sizer_1 = wx.BoxSizer(wx.VERTICAL)
1759 sizer_2 = wx.FlexGridSizer(0,2,0,0)
1760 sizer_3 = wx.BoxSizer(wx.HORIZONTAL)
1761 #sizer_2.Add(self.labellem, 0, wx.ALIGN_CENTER_VERTICAL, 3)
1762 #sizer_2.Add(self.checklem, 0, wx.ALIGN_CENTER_VERTICAL, 3)
1763 if not self.force_chi :
1764 sizer_2.Add(self.label_typeformes, 0, wx.ALIGN_CENTER_VERTICAL, 3)
1765 sizer_2.Add(self.typeformes, 0, wx.ALIGN_CENTER_VERTICAL, 3)
1766 sizer_2.Add(self.label_var, 0, wx.ALIGN_CENTER_VERTICAL, 3)
1767 sizer_2.Add(self.choice, 0, wx.ALIGN_CENTER_VERTICAL, 3)
1768 sizer_2.Add(self.label1, 0, wx.ALIGN_CENTER_VERTICAL, 3)
1769 sizer_2.Add(self.list_box_1, 0, wx.ALIGN_RIGHT, 3)
1770 sizer_3.Add(self.button_2, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 3)
1771 sizer_3.Add(self.button_1, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 3)
1772 sizer_2.Add(self.label_indice, 0, wx.ALIGN_CENTER_VERTICAL, 3)
1773 sizer_2.Add(self.choice_indice, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 3)
1774 if not self.force_chi :
1775 sizer_2.Add(self.label, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 3)
1776 sizer_2.Add(self.spin, 0, wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 3)
1777 sizer_1.Add(sizer_2, 0, wx.ALIGN_CENTER_HORIZONTAL, 3)
1778 sizer_1.Add(sizer_3, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_RIGHT, 3)
1779 self.SetSizer(sizer_1)
1784 def onselect(self, evt):
1785 self.list_box_1.Clear()
1786 if self.choice.GetSelection() == 0 :
1787 for var in self.variables :
1788 self.list_box_1.Append(var)
1790 for et in self.listet :
1791 self.list_box_1.Append(et)
1794 class PrefDendro ( wx.Dialog ):
1796 def __init__( self, parent, param ):
1797 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 )
1799 self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
1801 fgSizer1 = wx.FlexGridSizer( 0, 2, 0, 0 )
1802 fgSizer1.SetFlexibleDirection( wx.BOTH )
1803 fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
1805 self.m_staticText1 = wx.StaticText( self, wx.ID_ANY, _(u"Picture size").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
1806 self.m_staticText1.Wrap( -1 )
1807 fgSizer1.Add( self.m_staticText1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1809 bSizer2 = wx.BoxSizer( wx.VERTICAL )
1811 bSizer3 = wx.BoxSizer( wx.HORIZONTAL )
1813 self.m_staticText2 = wx.StaticText( self, wx.ID_ANY, _(u"height").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
1814 self.m_staticText2.Wrap( -1 )
1815 bSizer3.Add( self.m_staticText2, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1817 self.m_spinCtrl1 = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 50, 10000, 600 )
1818 bSizer3.Add( self.m_spinCtrl1, 0, wx.ALL, 5 )
1820 bSizer2.Add( bSizer3, 1, wx.EXPAND, 5 )
1822 bSizer31 = wx.BoxSizer( wx.HORIZONTAL )
1824 self.m_staticText3 = wx.StaticText( self, wx.ID_ANY, _(u"width").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
1825 self.m_staticText3.Wrap( -1 )
1826 bSizer31.Add( self.m_staticText3, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1828 self.m_spinCtrl2 = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 50, 10000, 600 )
1829 bSizer31.Add( self.m_spinCtrl2, 0, wx.ALL, 5 )
1831 bSizer2.Add( bSizer31, 1, wx.EXPAND, 5 )
1833 fgSizer1.Add( bSizer2, 1, wx.EXPAND, 5 )
1835 self.m_staticline1 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1836 fgSizer1.Add( self.m_staticline1, 0, wx.EXPAND |wx.ALL, 5 )
1838 self.m_staticline2 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1839 fgSizer1.Add( self.m_staticline2, 0, wx.EXPAND |wx.ALL, 5 )
1841 self.m_staticText4 = wx.StaticText( self, wx.ID_ANY, _(u"Dendrogram type").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
1842 self.m_staticText4.Wrap( -1 )
1843 fgSizer1.Add( self.m_staticText4, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1845 m_choice1Choices = [ u"phylogram", u"cladogram", u"fan", u"unrooted", u"radial" ]
1846 self.m_choice1 = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, m_choice1Choices, 0 )
1847 self.m_choice1.SetSelection( 0 )
1848 fgSizer1.Add( self.m_choice1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT|wx.ALL, 5 )
1850 self.m_staticline3 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1851 fgSizer1.Add( self.m_staticline3, 0, wx.EXPAND |wx.ALL, 5 )
1853 self.m_staticline4 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1854 fgSizer1.Add( self.m_staticline4, 0, wx.EXPAND |wx.ALL, 5 )
1856 self.m_staticText5 = wx.StaticText( self, wx.ID_ANY, _(u"Color or black and white").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
1857 self.m_staticText5.Wrap( -1 )
1858 fgSizer1.Add( self.m_staticText5, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1860 m_radioBox1Choices = [ _(u"color").decode('utf8'), _(u"black and white").decode('utf8') ]
1861 self.m_radioBox1 = wx.RadioBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, m_radioBox1Choices, 1, wx.RA_SPECIFY_COLS )
1862 self.m_radioBox1.SetSelection( 0 )
1863 fgSizer1.Add( self.m_radioBox1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT|wx.ALL, 5 )
1865 self.m_staticline5 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1866 fgSizer1.Add( self.m_staticline5, 0, wx.EXPAND |wx.ALL, 5 )
1868 self.m_staticline6 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1869 fgSizer1.Add( self.m_staticline6, 0, wx.EXPAND |wx.ALL, 5 )
1871 bSizer4 = wx.BoxSizer( wx.HORIZONTAL )
1873 self.m_staticText6 = wx.StaticText( self, wx.ID_ANY, _(u"Add cluster size").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
1874 self.m_staticText6.Wrap( -1 )
1875 bSizer4.Add( self.m_staticText6, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1877 self.m_checkBox1 = wx.CheckBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
1878 self.m_checkBox1.SetValue(True)
1879 bSizer4.Add( self.m_checkBox1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1881 fgSizer1.Add( bSizer4, 1, wx.EXPAND, 5 )
1883 m_radioBox2Choices = [ _(u"circular diagram").decode('utf8'), _(u"bar").decode('utf8') ]
1884 self.m_radioBox2 = wx.RadioBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, m_radioBox2Choices, 1, wx.RA_SPECIFY_COLS )
1885 self.m_radioBox2.SetSelection( 0 )
1886 fgSizer1.Add( self.m_radioBox2, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT|wx.ALL, 5 )
1888 self.m_staticline7 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1889 fgSizer1.Add( self.m_staticline7, 0, wx.EXPAND |wx.ALL, 5 )
1891 self.m_staticline8 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1892 fgSizer1.Add( self.m_staticline8, 0, wx.EXPAND |wx.ALL, 5 )
1895 fgSizer1.AddSpacer( ( 0, 0), 1, wx.EXPAND, 5 )
1897 m_sdbSizer2 = wx.StdDialogButtonSizer()
1898 self.m_sdbSizer2OK = wx.Button( self, wx.ID_OK )
1899 m_sdbSizer2.AddButton( self.m_sdbSizer2OK )
1900 self.m_sdbSizer2Cancel = wx.Button( self, wx.ID_CANCEL )
1901 m_sdbSizer2.AddButton( self.m_sdbSizer2Cancel )
1902 m_sdbSizer2.Realize();
1903 fgSizer1.Add( m_sdbSizer2, 1, wx.EXPAND, 5 )
1905 self.__set_properties()
1906 self.SetSizer( fgSizer1 )
1908 fgSizer1.Fit( self )
1910 self.Centre( wx.BOTH )
1912 def __set_properties(self):
1913 self.m_spinCtrl2.SetValue(self.param['width'])
1914 self.m_spinCtrl1.SetValue(self.param['height'])
1915 self.m_choice1.SetSelection(self.param['type_dendro'])
1916 self.m_radioBox1.SetSelection(self.param['color_nb'])
1917 self.m_checkBox1.SetValue(self.param['taille_classe'])
1918 self.m_radioBox2.SetSelection(self.param['type_tclasse'])
1920 def __del__( self ):
1924 class PrefWordCloud ( wx.Dialog ):
1926 def __init__( self, parent, fromcluster = False ):
1927 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 )
1929 self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
1931 fgSizer1 = wx.FlexGridSizer( 0, 2, 0, 0 )
1932 fgSizer1.SetFlexibleDirection( wx.BOTH )
1933 fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
1935 #self.m_staticText1 = wx.StaticText( self, wx.ID_ANY, u"Sélectionner les formes", wx.DefaultPosition, wx.DefaultSize, 0 )
1936 #self.m_staticText1.Wrap( -1 )
1937 #fgSizer1.Add( self.m_staticText1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
1939 #self.but_selectcol = wx.Button( self, wx.ID_ANY, u"Sélectionner", wx.DefaultPosition, wx.DefaultSize, 0 )
1940 #fgSizer1.Add( self.but_selectcol, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1942 #self.m_staticline1 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1943 #fgSizer1.Add( self.m_staticline1, 0, wx.EXPAND |wx.ALL, 5 )
1945 #self.m_staticline2 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1946 #fgSizer1.Add( self.m_staticline2, 0, wx.EXPAND |wx.ALL, 5 )
1948 bSizer1 = wx.BoxSizer( wx.HORIZONTAL )
1950 self.m_staticText3 = wx.StaticText( self, wx.ID_ANY, _(u"height").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
1951 self.m_staticText3.Wrap( -1 )
1952 bSizer1.Add( self.m_staticText3, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
1954 self.spin_H = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size( 100,30 ), wx.SP_ARROW_KEYS, 0, 10000, 600 )
1955 self.spin_H.SetValue( 800 )
1956 bSizer1.Add( self.spin_H, 0, wx.ALL, 5 )
1958 fgSizer1.Add( bSizer1, 1, wx.EXPAND, 5 )
1960 bSizer3 = wx.BoxSizer( wx.HORIZONTAL )
1962 self.m_staticText4 = wx.StaticText( self, wx.ID_ANY, _(u"width").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
1963 self.m_staticText4.Wrap( -1 )
1964 bSizer3.Add( self.m_staticText4, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
1966 self.spin_L = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size( 100,30 ), wx.SP_ARROW_KEYS, 0, 10000, 600 )
1967 self.spin_L.SetValue( 800 )
1968 bSizer3.Add( self.spin_L, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1970 fgSizer1.Add( bSizer3, 1, wx.EXPAND, 5 )
1972 self.m_staticline3 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1973 fgSizer1.Add( self.m_staticline3, 0, wx.EXPAND |wx.ALL, 5 )
1975 self.m_staticline4 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1976 fgSizer1.Add( self.m_staticline4, 0, wx.EXPAND |wx.ALL, 5 )
1978 self.m_staticText11 = wx.StaticText( self, wx.ID_ANY, _(u"Picture format").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
1979 self.m_staticText11.Wrap( -1 )
1980 fgSizer1.Add( self.m_staticText11, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1982 formatChoices = [ u"png", u"svg" ]
1983 self.format = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, formatChoices, 0 )
1984 self.format.SetSelection( 0 )
1985 fgSizer1.Add( self.format, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1988 self.m_staticText111 = wx.StaticText( self, wx.ID_ANY, _(u"Word size proportional to ...").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
1989 self.m_staticText11.Wrap( -1 )
1990 fgSizer1.Add( self.m_staticText111, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1992 IndiceChoices = [ _(u"chi2").decode('utf8'), _(u"frequency").decode('utf8') ]
1993 self.indice = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, IndiceChoices, 0 )
1994 self.indice.SetSelection( 0 )
1995 fgSizer1.Add( self.indice, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1997 self.m_staticline13 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
1998 fgSizer1.Add( self.m_staticline13, 0, wx.EXPAND |wx.ALL, 5 )
2000 self.m_staticline14 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
2001 fgSizer1.Add( self.m_staticline14, 0, wx.EXPAND |wx.ALL, 5 )
2003 self.m_staticText5 = wx.StaticText( self, wx.ID_ANY, _(u"Maximum number of forms").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2004 self.m_staticText5.Wrap( -1 )
2005 fgSizer1.Add( self.m_staticText5, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2007 self.spin_maxword = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 0, 10000, 600 )
2008 self.spin_maxword.SetValue( 600 )
2009 fgSizer1.Add( self.spin_maxword, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2011 self.m_staticline5 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
2012 fgSizer1.Add( self.m_staticline5, 0, wx.EXPAND |wx.ALL, 5 )
2014 self.m_staticline6 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
2015 fgSizer1.Add( self.m_staticline6, 0, wx.EXPAND |wx.ALL, 5 )
2017 self.typeformes = wx.StaticText( self, wx.ID_ANY, _(u"Used forms").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2018 self.typeformes.Wrap( -1 )
2019 fgSizer1.Add( self.typeformes, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2021 typeformeschoiceChoices = [ _(u"actives").decode('utf8'), _(u"supplementaries").decode('utf8'), _(u"actives and supplementaries").decode('utf8') ]
2022 self.typeformeschoice = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, typeformeschoiceChoices, 0 )
2023 self.typeformeschoice.SetSelection( 0 )
2024 fgSizer1.Add( self.typeformeschoice, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2026 self.m_staticline11 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
2027 fgSizer1.Add( self.m_staticline11, 0, wx.EXPAND |wx.ALL, 5 )
2029 self.m_staticline12 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
2030 fgSizer1.Add( self.m_staticline12, 0, wx.EXPAND |wx.ALL, 5 )
2032 self.m_staticText6 = wx.StaticText( self, wx.ID_ANY, _(u"Text size").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2033 self.m_staticText6.Wrap( -1 )
2034 fgSizer1.Add( self.m_staticText6, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2036 bSizer4 = wx.BoxSizer( wx.VERTICAL )
2038 bSizer5 = wx.BoxSizer( wx.HORIZONTAL )
2040 self.m_staticText7 = wx.StaticText( self, wx.ID_ANY, u"Min", wx.DefaultPosition, wx.DefaultSize, 0 )
2041 self.m_staticText7.Wrap( -1 )
2042 bSizer5.Add( self.m_staticText7, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2044 self.spin_mincex = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 0, 1000, 5 )
2045 self.spin_mincex.SetValue( 5 )
2046 bSizer5.Add( self.spin_mincex, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT|wx.ALL, 5 )
2048 bSizer4.Add( bSizer5, 1, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.EXPAND, 5 )
2050 bSizer6 = wx.BoxSizer( wx.HORIZONTAL )
2052 self.m_staticText8 = wx.StaticText( self, wx.ID_ANY, u"Max", wx.DefaultPosition, wx.DefaultSize, 0 )
2053 self.m_staticText8.Wrap( -1 )
2054 bSizer6.Add( self.m_staticText8, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2056 self.spin_maxcex = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 0, 1000, 50 )
2057 self.spin_maxcex.SetValue( 50 )
2058 bSizer6.Add( self.spin_maxcex, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2060 bSizer4.Add( bSizer6, 1, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.EXPAND, 5 )
2062 fgSizer1.Add( bSizer4, 1, wx.EXPAND, 5 )
2064 self.m_staticline7 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
2065 fgSizer1.Add( self.m_staticline7, 0, wx.EXPAND |wx.ALL, 5 )
2067 self.m_staticline8 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
2068 fgSizer1.Add( self.m_staticline8, 0, wx.EXPAND |wx.ALL, 5 )
2070 bSizer61 = wx.BoxSizer( wx.HORIZONTAL )
2072 self.m_staticText81 = wx.StaticText( self, wx.ID_ANY, _(u"Text color").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2073 self.m_staticText81.Wrap( -1 )
2074 bSizer61.Add( self.m_staticText81, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2076 self.color_text = wx.ColourPickerCtrl( self, wx.ID_ANY, wx.BLACK, wx.DefaultPosition, wx.DefaultSize, wx.CLRP_DEFAULT_STYLE )
2077 bSizer61.Add( self.color_text, 0, wx.ALL, 5 )
2079 fgSizer1.Add( bSizer61, 1, wx.EXPAND, 5 )
2081 bSizer7 = wx.BoxSizer( wx.HORIZONTAL )
2083 self.m_staticText9 = wx.StaticText( self, wx.ID_ANY, _(u"Background color").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2084 self.m_staticText9.Wrap( -1 )
2085 bSizer7.Add( self.m_staticText9, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2087 self.color_bg = wx.ColourPickerCtrl( self, wx.ID_ANY, (255,255,255), wx.DefaultPosition, wx.DefaultSize, wx.CLRP_DEFAULT_STYLE )
2088 bSizer7.Add( self.color_bg, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2090 fgSizer1.Add( bSizer7, 1, wx.EXPAND, 5 )
2092 self.m_staticline9 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
2093 fgSizer1.Add( self.m_staticline9, 0, wx.EXPAND |wx.ALL, 5 )
2095 self.m_staticline10 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
2096 fgSizer1.Add( self.m_staticline10, 0, wx.EXPAND |wx.ALL, 5 )
2098 fgSizer1.AddSpacer( ( 0, 0), 1, wx.EXPAND, 5 )
2100 m_sdbSizer1 = wx.StdDialogButtonSizer()
2101 self.m_sdbSizer1OK = wx.Button( self, wx.ID_OK )
2102 m_sdbSizer1.AddButton( self.m_sdbSizer1OK )
2103 self.m_sdbSizer1Cancel = wx.Button( self, wx.ID_CANCEL )
2104 m_sdbSizer1.AddButton( self.m_sdbSizer1Cancel )
2105 m_sdbSizer1.Realize();
2106 fgSizer1.Add( m_sdbSizer1, 1, wx.EXPAND, 5 )
2108 self.SetSizer( fgSizer1 )
2110 fgSizer1.Fit( self )
2112 self.Centre( wx.BOTH )
2114 def __del__( self ):
2117 class PrefChi(sc.SizedDialog):
2118 def __init__(self, parent, ID, optionchi, title):
2120 sc.SizedDialog.__init__(self, None, -1, _(u"Settings").decode('utf8'),
2121 style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER)
2122 pane = self.GetContentsPane()
2123 pane.SetSizerType("form")
2124 pane.SetSizerProps(border=("all",5))
2125 self.parent = parent
2126 self.optionchi = optionchi
2129 self.label_obs = wx.StaticText(pane, -1, _(u"observed values").decode('utf8'))
2130 self.check1 = wx.CheckBox(pane, -1)
2132 self.label_theo = wx.StaticText(pane, -1, _(u"expected values").decode('utf8'))
2133 self.check2 = wx.CheckBox(pane, -1)
2135 self.label_resi = wx.StaticText(pane, -1, _(u"residuals").decode('utf8'))
2136 self.check3 = wx.CheckBox(pane, -1)
2138 self.label_contrib = wx.StaticText(pane, -1, _(u"standardized residuals").decode('utf8'))
2139 self.check4 = wx.CheckBox(pane, -1)
2140 # self.label_graph = wx.StaticText(pane, -1, u'graphique')
2141 # self.check8 = wx.CheckBox(pane, -1)
2142 self.label_pourcent = wx.StaticText(pane, -1, _(u"total percentage").decode('utf8'))
2143 self.check5 = wx.CheckBox(pane, -1)
2145 self.label_prl = wx.StaticText(pane, -1, _(u"row percentage").decode('utf8'))
2146 self.check6 = wx.CheckBox(pane, -1)
2148 self.label_prc = wx.StaticText(pane, -1, _(u"column percentage").decode('utf8'))
2149 self.check7 = wx.CheckBox(pane, -1)
2151 self.label_graph = wx.StaticText(pane, -1, _(u"graphical").decode('utf8'))
2152 self.check8 = wx.CheckBox(pane, -1)
2154 self.label_graphbw = wx.StaticText(pane, -1, _(u"black and white graphical").decode('utf8'))
2155 self.checkbw = wx.CheckBox(pane, -1)
2157 self.SetButtonSizer(self.CreateStdDialogButtonSizer(wx.OK | wx.CANCEL))
2159 self.__set_properties()
2161 self.SetMinSize(self.GetSize())
2163 def __set_properties(self):
2164 self.check1.SetValue(self.optionchi['valobs'])
2165 self.check2.SetValue(self.optionchi['valtheo'])
2166 self.check3.SetValue(self.optionchi['resi'])
2167 self.check4.SetValue(self.optionchi['contrib'])
2168 self.check5.SetValue(self.optionchi['pourcent'])
2169 self.check6.SetValue(self.optionchi['pourcentl'])
2170 self.check7.SetValue(self.optionchi['pourcentc'])
2171 self.check8.SetValue(self.optionchi['graph'])
2172 self.checkbw.SetValue(self.optionchi['bw'])
2174 class ChiDialog(wx.Dialog):
2176 self, parent, ID, title, optionchi, tableau, size=wx.DefaultSize, pos=wx.DefaultPosition,
2177 style=wx.DEFAULT_DIALOG_STYLE
2180 pre = wx.PreDialog()
2181 pre.SetExtraStyle(wx.DIALOG_EX_CONTEXTHELP)
2182 pre.Create(parent, ID, title, pos, size, style)
2184 self.PostCreate(pre)
2185 self.parent = parent
2186 self.optionchi = optionchi
2188 self.tableau = tableau
2189 #self.Filename=parent.filename
2190 #self.content=parent.content[:]
2191 self.headers=self.tableau.get_colnames()
2194 for i in self.headers:
2196 LABELLIST.append(i[0:60])
2201 self.LabelListOK=LABELLIST
2203 self.list_box_1 = wx.ListBox(self, -1, choices=self.LabelListOK, style=wx.LB_EXTENDED|wx.LB_HSCROLL)
2204 self.list_box_2 = wx.ListBox(self, -1, choices=self.LabelListOK, style=wx.LB_EXTENDED|wx.LB_HSCROLL)
2205 self.button_1 = wx.Button(self, wx.ID_OK)
2206 self.button_cancel = wx.Button(self, wx.ID_CANCEL)
2207 self.button_pref = wx.Button(self, wx.ID_PREFERENCES)
2208 self.__set_properties()
2211 self.Bind(wx.EVT_LISTBOX, self.Select1, self.list_box_1)
2212 self.Bind(wx.EVT_BUTTON, self.onparam, self.button_pref)
2214 #-------------------------------
2215 def __set_properties(self):
2216 # begin wxGlade: ConfChi2.__set_properties
2217 self.SetTitle(_(u"Variables selection").decode('utf8'))
2219 def __do_layout(self):
2220 # begin wxGlade: ConfChi2.__do_layout
2221 sizer_1 = wx.BoxSizer(wx.VERTICAL)
2222 sizer_2 = wx.BoxSizer(wx.VERTICAL)
2223 sizer_3 = wx.BoxSizer(wx.HORIZONTAL)
2224 sizer_4 = wx.BoxSizer(wx.HORIZONTAL)
2225 sizer_3.Add(self.list_box_1, 0, wx.EXPAND, 0)
2226 sizer_3.Add(self.list_box_2, 0, wx.EXPAND|wx.ALIGN_CENTER_HORIZONTAL, 0)
2227 sizer_2.Add(sizer_3, 1, wx.EXPAND, 0)
2228 sizer_4.Add(self.button_cancel, 0, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL, 0)
2229 sizer_4.Add(self.button_pref, 0, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL, 0)
2230 sizer_4.Add(self.button_1, 0, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL, 0)
2231 sizer_2.Add(sizer_4, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL, 0)
2232 sizer_1.Add(sizer_2, 1, wx.EXPAND, 0)
2233 self.SetSizer(sizer_1)
2238 def Select1(self, event): # wxGlade: ConfChi2.<event_handler>
2242 def onparam(self,event):
2243 self.dial = PrefChi(self.parent, -1, self.optionchi, '')
2244 self.dial.CenterOnParent()
2245 self.chiopt = self.dial.ShowModal()
2247 class CorpusPref ( wx.Dialog ):
2249 def __init__( self, parent, parametres ):
2250 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 )
2251 self.parent = parent
2252 langues_n = [u'français', u'english', u'german (expérimentale)', u'italian', u'swedish (expérimentale)', u'portuguese (expérimentale)', u'spanish (expérimentale)', u'greek (expériementale)', u'galician (expérimentale)', u'autre...']
2253 self.langues = [u'french', u'english', u'german', u'italian', u'swedish', u'portuguese', u'spanish', u'greek', u'galician', u'other']
2254 self.encodages = [enc[0].lower() for enc in encodages]
2256 ucimark = [u'****', u'0000']
2257 ucemethod = [_(u"characters").decode('utf8'), _(u"occurrences").decode('utf8'), _(u"paragraphs").decode('utf8')]
2259 self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
2261 bSizer1 = wx.BoxSizer( wx.VERTICAL )
2263 self.m_notebook1 = wx.Notebook( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, 0 )
2264 self.m_panel1 = wx.Panel( self.m_notebook1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
2265 fgSizer1 = wx.FlexGridSizer( 0, 2, 0, 0 )
2266 fgSizer1.SetFlexibleDirection( wx.BOTH )
2267 fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
2269 self.m_staticText7 = wx.StaticText( self.m_panel1, wx.ID_ANY, _(u"corpus").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2270 self.m_staticText7.Wrap( -1 )
2271 fgSizer1.Add( self.m_staticText7, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2273 self.txtpath = wx.StaticText( self.m_panel1, wx.ID_ANY, _(u"Path").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2274 self.txtpath.Wrap( -1 )
2275 fgSizer1.Add( self.txtpath, 0, wx.ALL, 5 )
2277 self.m_staticText18 = wx.StaticText( self.m_panel1, wx.ID_ANY, _(u"Corpus' name").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2278 self.m_staticText18.Wrap( -1 )
2279 fgSizer1.Add( self.m_staticText18, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2281 self.corpusname = wx.TextCtrl( self.m_panel1, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size( 200,-1 ), 0 )
2282 fgSizer1.Add( self.corpusname, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2284 self.m_staticText1 = wx.StaticText( self.m_panel1, wx.ID_ANY, _(u"Characters set").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2285 self.m_staticText1.Wrap( -1 )
2286 fgSizer1.Add( self.m_staticText1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2288 encodage_choicesChoices = [' - '.join(encodage) for encodage in encodages]
2289 self.encodage_choices = wx.Choice( self.m_panel1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, encodage_choicesChoices, 0 )
2290 self.encodage_choices.SetSelection( 0 )
2291 fgSizer1.Add( self.encodage_choices, 0, wx.ALL, 5 )
2293 self.m_staticText2 = wx.StaticText( self.m_panel1, wx.ID_ANY, _(u"Language").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2294 self.m_staticText2.Wrap( -1 )
2295 fgSizer1.Add( self.m_staticText2, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2297 lang_choicesChoices = langues_n
2298 self.lang_choices = wx.Choice( self.m_panel1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, lang_choicesChoices, 0 )
2299 self.lang_choices.SetSelection( 0 )
2300 fgSizer1.Add( self.lang_choices, 0, wx.ALL, 5 )
2302 self.m_staticText19 = wx.StaticText( self.m_panel1, wx.ID_ANY, _(u"Dictionary").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2303 self.m_staticText19.Wrap( -1 )
2304 fgSizer1.Add( self.m_staticText19, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2306 bSizer2 = wx.BoxSizer( wx.HORIZONTAL )
2308 fgSizer5 = wx.FlexGridSizer( 2, 2, 0, 0 )
2309 fgSizer5.SetFlexibleDirection( wx.BOTH )
2310 fgSizer5.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
2312 self.radio_default_dict = wx.RadioButton( self.m_panel1, wx.ID_ANY, _(u"Default").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2313 fgSizer5.Add( self.radio_default_dict, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2315 self.defaultdictpath = wx.TextCtrl( self.m_panel1, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size( 300,-1 ), wx.TE_READONLY )
2316 self.defaultdictpath.Enable( False )
2318 fgSizer5.Add( self.defaultdictpath, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2320 self.radio_other_dict = wx.RadioButton( self.m_panel1, wx.ID_ANY, _(u"Other").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2321 fgSizer5.Add( self.radio_other_dict, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2323 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 )
2324 fgSizer5.Add( self.otherdictpath, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2327 bSizer2.Add( fgSizer5, 1, wx.EXPAND, 5 )
2330 fgSizer1.Add( bSizer2, 1, wx.EXPAND, 5 )
2332 self.m_staticText3 = wx.StaticText( self.m_panel1, wx.ID_ANY, _(u"Output folder").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2333 self.m_staticText3.Wrap( -1 )
2334 fgSizer1.Add( self.m_staticText3, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2337 fgSizer41 = wx.FlexGridSizer( 0, 2, 0, 0 )
2338 fgSizer41.SetFlexibleDirection( wx.BOTH )
2339 fgSizer41.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
2341 self.repout_choices = wx.TextCtrl( self.m_panel1, wx.ID_ANY, u"MyLabel", wx.DefaultPosition, wx.DefaultSize, 0 )
2342 self.repout_choices.SetMinSize( wx.Size( 400,-1 ) )
2343 fgSizer41.Add( self.repout_choices, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2345 self.m_button1 = wx.Button( self.m_panel1, wx.ID_ANY, _(u"Change ...").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2346 fgSizer41.Add( self.m_button1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2348 fgSizer1.Add( fgSizer41, 1, wx.EXPAND, 5 )
2350 self.m_staticText12 = wx.StaticText( self.m_panel1, wx.ID_ANY, _(u"Text mark").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2351 self.m_staticText12.Wrap( -1 )
2352 fgSizer1.Add( self.m_staticText12, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2354 ucimark_choicesChoices = ucimark
2355 self.ucimark_choices = wx.Choice( self.m_panel1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, ucimark_choicesChoices, 0 )
2356 self.ucimark_choices.SetSelection( 0 )
2357 fgSizer1.Add( self.ucimark_choices, 0, wx.ALL, 5 )
2359 self.m_staticText6 = wx.StaticText( self.m_panel1, wx.ID_ANY, _(u"Use the expression dictionary").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2360 self.m_staticText6.Wrap( -1 )
2361 fgSizer1.Add( self.m_staticText6, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2363 self.check_expressions = wx.CheckBox( self.m_panel1, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
2364 self.check_expressions.SetValue(True)
2365 fgSizer1.Add( self.check_expressions, 0, wx.ALL, 5 )
2367 self.m_staticText9 = wx.StaticText( self.m_panel1, wx.ID_ANY, _(u"Make text segments").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2368 self.m_staticText9.Wrap( -1 )
2369 fgSizer1.Add( self.m_staticText9, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2371 self.check_makeuce = wx.CheckBox( self.m_panel1, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
2372 self.check_makeuce.SetValue(True)
2373 fgSizer1.Add( self.check_makeuce, 0, wx.ALL, 5 )
2375 self.m_staticText10 = wx.StaticText( self.m_panel1, wx.ID_ANY, _(u"Text segments build process").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2376 self.m_staticText10.Wrap( -1 )
2377 fgSizer1.Add( self.m_staticText10, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2379 uce_modeChoices = ucemethod
2380 self.uce_mode = wx.Choice( self.m_panel1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, uce_modeChoices, 0 )
2381 self.uce_mode.SetSelection( 0 )
2382 fgSizer1.Add( self.uce_mode, 0, wx.ALL, 5 )
2384 self.m_staticText13 = wx.StaticText( self.m_panel1, wx.ID_ANY, _(u"Text segments size").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2385 self.m_staticText13.Wrap( -1 )
2386 fgSizer1.Add( self.m_staticText13, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2388 self.uce_size = wx.SpinCtrl( self.m_panel1, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 1, 1000000, 40 )
2389 fgSizer1.Add( self.uce_size, 0, wx.ALL, 5 )
2392 self.m_panel1.SetSizer( fgSizer1 )
2393 self.m_panel1.Layout()
2394 fgSizer1.Fit( self.m_panel1 )
2395 self.m_notebook1.AddPage( self.m_panel1, _(u"General").decode('utf8'), True )
2396 self.m_panel2 = wx.Panel( self.m_notebook1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
2397 fgSizer3 = wx.FlexGridSizer( 0, 2, 0, 0 )
2398 fgSizer3.SetFlexibleDirection( wx.BOTH )
2399 fgSizer3.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
2401 self.m_staticText4 = wx.StaticText( self.m_panel2, wx.ID_ANY, _(u"Put text in lowercase").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2402 self.m_staticText4.Wrap( -1 )
2403 fgSizer3.Add( self.m_staticText4, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2405 self.check_lower = wx.CheckBox( self.m_panel2, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
2406 self.check_lower.SetValue(True)
2407 fgSizer3.Add( self.check_lower, 0, wx.ALL, 5 )
2409 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 )
2410 self.m_staticText5.Wrap( -1 )
2411 fgSizer3.Add( self.m_staticText5, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2413 fgSizer4 = wx.FlexGridSizer( 0, 2, 0, 0 )
2414 fgSizer4.SetFlexibleDirection( wx.BOTH )
2415 fgSizer4.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
2417 self.check_charact = wx.CheckBox( self.m_panel2, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
2418 self.check_charact.SetValue(True)
2419 fgSizer4.Add( self.check_charact, 0, wx.ALL, 5 )
2421 self.txt_charact = wx.TextCtrl( self.m_panel2, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
2422 self.txt_charact.SetMinSize( wx.Size( 400,-1 ) )
2424 fgSizer4.Add( self.txt_charact, 0, wx.ALL|wx.EXPAND, 5 )
2427 fgSizer3.Add( fgSizer4, 1, wx.ALIGN_CENTER_VERTICAL|wx.EXPAND, 5 )
2429 self.m_staticText14 = wx.StaticText( self.m_panel2, wx.ID_ANY, _(u"Replace apostrophe by space").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2430 self.m_staticText14.Wrap( -1 )
2431 fgSizer3.Add( self.m_staticText14, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2433 self.check_apos = wx.CheckBox( self.m_panel2, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
2434 self.check_apos.SetValue(True)
2435 fgSizer3.Add( self.check_apos, 0, wx.ALL, 5 )
2437 self.m_staticText15 = wx.StaticText( self.m_panel2, wx.ID_ANY, _(u"Replace dash by space").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2438 self.m_staticText15.Wrap( -1 )
2439 fgSizer3.Add( self.m_staticText15, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2441 self.check_tirets = wx.CheckBox( self.m_panel2, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
2442 self.check_tirets.SetValue(True)
2443 fgSizer3.Add( self.check_tirets, 0, wx.ALL, 5 )
2445 self.m_staticText17 = wx.StaticText( self.m_panel2, wx.ID_ANY, _(u"Keep punctuation").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2446 self.m_staticText17.Wrap( -1 )
2447 fgSizer3.Add( self.m_staticText17, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2449 self.check_ponct = wx.CheckBox( self.m_panel2, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
2450 fgSizer3.Add( self.check_ponct, 0, wx.ALL, 5 )
2452 self.m_staticText16 = wx.StaticText( self.m_panel2, wx.ID_ANY, _(u"No space between two forms").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2453 self.m_staticText16.Wrap( -1 )
2454 fgSizer3.Add( self.m_staticText16, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2456 self.check_tolist = wx.CheckBox( self.m_panel2, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
2457 fgSizer3.Add( self.check_tolist, 0, wx.ALL, 5 )
2460 self.m_panel2.SetSizer( fgSizer3 )
2461 self.m_panel2.Layout()
2462 fgSizer3.Fit( self.m_panel2 )
2463 self.m_notebook1.AddPage( self.m_panel2, _(u"Cleaning").decode('utf8'), False )
2465 bSizer1.Add( self.m_notebook1, 1, wx.EXPAND |wx.ALL, 5 )
2467 m_sdbSizer1 = wx.StdDialogButtonSizer()
2468 self.m_sdbSizer1OK = wx.Button( self, wx.ID_OK )
2469 m_sdbSizer1.AddButton( self.m_sdbSizer1OK )
2470 self.m_sdbSizer1Cancel = wx.Button( self, wx.ID_CANCEL )
2471 m_sdbSizer1.AddButton( self.m_sdbSizer1Cancel )
2472 m_sdbSizer1.Realize();
2474 bSizer1.Add( m_sdbSizer1, 0, wx.EXPAND, 5 )
2478 self.Bind(wx.EVT_BUTTON, self.OnChangeDir, self.m_button1)
2479 self.lang_choices.Bind( wx.EVT_CHOICE, self.OnChangeLangage )
2480 self.radio_other_dict.Bind( wx.EVT_RADIOBUTTON, self.changedictchoice )
2482 self.setparametres(parametres)
2483 self.SetSizer( bSizer1 )
2487 self.Centre( wx.BOTH )
2489 def OnChangeDir(self, evt) :
2490 dlg = wx.DirDialog(self.parent, _(u"Choose a folder").decode('utf8'), style = wx.DD_DEFAULT_STYLE)
2491 if dlg.ShowModal() == wx.ID_OK :
2492 self.repout_choices.SetValue(dlg.GetPath())
2494 def __del__( self ):
2497 def setparametres(self, parametres) :
2498 if locale.getpreferredencoding().lower() == 'mac-roman' :
2499 enc = self.encodages.index('macroman')
2502 enc = self.encodages.index(locale.getpreferredencoding().lower())
2504 enc = self.encodages.index('utf-8')
2505 self.encodage_choices.SetSelection(enc)
2506 self.lang_choices.SetSelection(0)
2507 self.repout_choices.SetValue(parametres['pathout'])
2508 self.corpusname.SetValue(parametres['corpus_name'])
2509 self.ucimark_choices.SetSelection(parametres['ucimark'])
2510 self.check_expressions.SetValue(parametres['expressions'])
2511 self.check_makeuce.SetValue(parametres['douce'])
2512 self.uce_mode.SetSelection(parametres['ucemethod'])
2513 self.uce_size.SetValue(parametres['ucesize'])
2514 self.check_lower.SetValue(parametres['lower'])
2515 #self.check_charact.SetValue(parametres['charact'])
2516 self.txt_charact.SetValue(parametres['keep_caract'])
2517 self.check_apos.SetValue(parametres['apos'])
2518 self.check_tirets.SetValue(parametres['tiret'])
2519 self.check_tolist.SetValue(parametres['tolist'])
2520 self.check_ponct.SetValue(parametres['keep_ponct'])
2522 def doparametres(self) :
2524 parametres['encoding'] = encodages[self.encodage_choices.GetSelection()][0]
2525 parametres['lang'] = self.langues[self.lang_choices.GetSelection()]
2526 parametres['pathout'] = self.repout_choices.GetValue()
2527 parametres['corpus_name'] = self.corpusname.GetValue()
2528 parametres['ucimark'] = self.ucimark_choices.GetSelection()
2529 parametres['expressions'] = self.check_expressions.GetValue()
2530 parametres['douce'] = self.check_makeuce.GetValue()
2531 parametres['ucemethod'] = self.uce_mode.GetSelection()
2532 parametres['ucesize'] = self.uce_size.GetValue()
2533 parametres['lower'] = self.check_lower.GetValue()
2534 parametres['charact'] = self.check_charact.GetValue()
2535 parametres['keep_caract'] = self.txt_charact.GetValue()
2536 parametres['apos'] = self.check_apos.GetValue()
2537 parametres['tiret'] = self.check_tirets.GetValue()
2538 parametres['tolist'] = self.check_tolist.GetValue()
2539 parametres['keep_ponct'] = self.check_ponct.GetValue()
2540 for val in parametres :
2541 if isinstance(parametres[val], bool) :
2542 if parametres[val] :
2548 def OnChangeLangage(self, evt):
2551 def changedictchoice(self, evt):
2555 class ConcordList(wx.HtmlListBox):
2556 def __init__(self, parent, concord):
2557 self.concord = concord
2558 #self.script_status = dict()
2559 wx.HtmlListBox.__init__(self, parent, -1, size = (900, 600))
2560 self.SetItemCount(len(concord))
2561 #self.Bind(wx.EVT_LISTBOX, self.RefreshMe)
2562 #self.Bind(wx.EVT_LISTBOX_DCLICK, self.Download)
2564 def OnGetItem(self, index):
2565 return self.concord[index] #+ '<br>'
2567 class message(wx.Frame):
2568 def __init__(self, parent, items, title, size, save = True, uceids = None):
2569 wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = title, pos = wx.DefaultPosition, size = size, style = wx.DEFAULT_FRAME_STYLE )
2571 self.uceids = uceids
2572 self.ira = wx.GetApp().GetTopWindow()
2573 self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
2576 #self.HtmlPage=wx.html.HtmlWindow(self, -1)
2577 self.HtmlPage = ConcordList(self, items)
2578 #self.HtmlPage.SetMinSize( size )
2579 #if "gtk2" in wx.PlatformInfo:
2580 # self.HtmlPage.SetStandardFonts()
2581 #self.HtmlPage.SetFonts('Courier','Courier')
2583 self.button_1 = wx.Button(self, wx.ID_CANCEL)
2585 self.Bind(wx.EVT_BUTTON, self.OnCloseMe, self.button_1)
2587 self.button_2 = wx.Button(self, wx.ID_SAVE)
2588 self.Bind(wx.EVT_BUTTON, self.OnSavePage, self.button_2)
2589 if self.uceids is not None :
2590 self.butsub = wx.Button(self, -1, _(u"Build sub corpus").decode('utf8'))
2591 self.Bind(wx.EVT_BUTTON, self.OnSub, self.butsub)
2592 self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)
2595 def __do_layout(self):
2596 sizer_2 = wx.BoxSizer(wx.VERTICAL)
2597 sizer_2.Add(self.HtmlPage, 1, wx.EXPAND|wx.ADJUST_MINSIZE, 0)
2598 #m_sdbSizer1 = wx.StdDialogButtonSizer()
2599 m_sdbSizer1 = wx.BoxSizer(wx.HORIZONTAL)
2600 m_sdbSizer1.Add( self.button_1 , 0, wx.RIGHT | wx.EXPAND)
2602 m_sdbSizer1.Add( self.button_2 , 0, wx.RIGHT | wx.EXPAND)
2603 if self.uceids is not None :
2604 m_sdbSizer1.Add( self.butsub , 0, wx.RIGHT | wx.EXPAND)
2605 #m_sdbSizer1.Realize()
2606 sizer_2.Add(m_sdbSizer1, 0, wx.RIGHT | wx.EXPAND, 5)
2607 self.SetSizer(sizer_2)
2611 def OnSavePage(self, evt) :
2612 dlg = wx.FileDialog(
2613 self, message=_(u"Save as ...").decode('utf8'), defaultDir=os.getcwd(),
2614 defaultFile="concordancier.html", wildcard="html|*.html", style=wx.SAVE | wx.OVERWRITE_PROMPT
2616 dlg.SetFilterIndex(2)
2617 dlg.CenterOnParent()
2618 if dlg.ShowModal() == wx.ID_OK:
2619 path = dlg.GetPath()
2620 with open(path, 'w') as f :
2623 def OnCloseMe(self, event):
2626 def OnCloseWindow(self, event):
2629 def OnSub(self ,evt):
2630 parametres = {'fromuceids' : True, 'uceids' : self.uceids}
2631 self.ira.OnSubText(None, parametres)
2635 class ExtractDialog ( wx.Dialog ):
2637 def __init__( self, parent, option ):
2638 wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = wx.EmptyString, pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.DEFAULT_DIALOG_STYLE )
2640 self.option = option
2642 self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
2644 fgSizer1 = wx.FlexGridSizer( 0, 2, 0, 0 )
2645 fgSizer1.SetFlexibleDirection( wx.BOTH )
2646 fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
2648 self.m_staticText1 = wx.StaticText( self, wx.ID_ANY, _(u"corpus").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2649 self.m_staticText1.Wrap( -1 )
2650 fgSizer1.Add( self.m_staticText1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
2652 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 )
2653 self.corpusfile.SetMinSize( wx.Size( 500,-1 ) )
2655 fgSizer1.Add( self.corpusfile, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL|wx.EXPAND, 5 )
2657 self.m_staticText2 = wx.StaticText( self, wx.ID_ANY, _(u"Characters set").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2658 self.m_staticText2.Wrap( -1 )
2659 fgSizer1.Add( self.m_staticText2, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2661 encodageChoices = [' - '.join(encodage) for encodage in encodages]
2662 self.encodage = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, encodageChoices, 0 )
2663 self.encodage.SetSelection( 0 )
2664 self.encodage.SetMinSize( wx.Size( 200,-1 ) )
2666 fgSizer1.Add( self.encodage, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL|wx.EXPAND, 5 )
2668 if option == 'splitvar' :
2669 self.m_staticText3 = wx.StaticText( self, wx.ID_ANY, _(u"Variables (with the * but without the _)").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2670 self.m_staticText3.Wrap( -1 )
2671 fgSizer1.Add( self.m_staticText3, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2673 self.txtvar = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
2674 self.txtvar.SetMinSize( wx.Size( 200,-1 ) )
2676 fgSizer1.Add( self.txtvar, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL|wx.EXPAND, 5 )
2678 if option == 'mods' :
2679 self.m_staticText4 = wx.StaticText( self, wx.ID_ANY, _(u"Modalities (one by line, with the *)").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2680 self.m_staticText4.Wrap( -1 )
2681 fgSizer1.Add( self.m_staticText4, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2683 self.txtmods = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.TE_MULTILINE )
2684 self.txtmods.SetMinSize( wx.Size( 200,150 ) )
2686 fgSizer1.Add( self.txtmods, 0, wx.ALL|wx.EXPAND, 5 )
2688 self.m_staticText5 = wx.StaticText( self, wx.ID_ANY, _(u"Extraction type").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2689 self.m_staticText5.Wrap( -1 )
2690 fgSizer1.Add( self.m_staticText5, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2692 extractformatChoices = [ _(u"Only one file").decode('utf8'), _(u"One file by modality").decode('utf8') ]
2693 self.extractformat = wx.RadioBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, extractformatChoices, 1, wx.RA_SPECIFY_COLS )
2694 self.extractformat.SetSelection( 0 )
2695 fgSizer1.Add( self.extractformat, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2697 if option == 'them' :
2698 self.m_staticText4 = wx.StaticText( self, wx.ID_ANY, _(u"thematics (one by line, with the -*)").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2699 self.m_staticText4.Wrap( -1 )
2700 fgSizer1.Add( self.m_staticText4, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2702 self.txtmods = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.TE_MULTILINE )
2703 self.txtmods.SetMinSize( wx.Size( 200,150 ) )
2705 fgSizer1.Add( self.txtmods, 0, wx.ALL|wx.EXPAND, 5 )
2707 #self.m_staticText5 = wx.StaticText( self, wx.ID_ANY, _(u"Extraction type").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2708 #self.m_staticText5.Wrap( -1 )
2709 #fgSizer1.Add( self.m_staticText5, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2711 #extractformatChoices = [ _(u"Only one file").decode('utf8'), _(u"One file by thematic").decode('utf8') ]
2712 #self.extractformat = wx.RadioBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, extractformatChoices, 1, wx.RA_SPECIFY_COLS )
2713 #self.extractformat.SetSelection( 0 )
2714 #fgSizer1.Add( self.extractformat, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2717 fgSizer1.AddSpacer( ( 0, 0), 1, wx.EXPAND, 5 )
2719 m_sdbSizer1 = wx.StdDialogButtonSizer()
2720 self.m_sdbSizer1OK = wx.Button( self, wx.ID_OK )
2721 m_sdbSizer1.AddButton( self.m_sdbSizer1OK )
2722 self.m_sdbSizer1Cancel = wx.Button( self, wx.ID_CANCEL )
2723 m_sdbSizer1.AddButton( self.m_sdbSizer1Cancel )
2724 m_sdbSizer1.Realize()
2726 fgSizer1.Add( m_sdbSizer1, 1, wx.EXPAND, 5 )
2729 self.SetSizer( fgSizer1 )
2731 fgSizer1.Fit( self )
2733 self.Centre( wx.BOTH )
2735 def make_param(self) :
2737 le = [enc[0].lower() for enc in encodages]
2738 parametres['filein'] = self.corpusfile.GetPath()
2739 encodage = le[self.encodage.GetSelection()]
2740 parametres['encodein'] = encodage
2741 if self.option == 'splitvar' :
2742 parametres['var'] = self.txtvar.GetValue()
2743 if self.option == 'mods' :
2744 parametres['mods'] = self.txtmods.GetValue().splitlines()
2745 if self.extractformat.GetSelection() == 0 :
2746 parametres['onefile'] = True
2748 parametres['onefile'] = False
2749 if self.option == 'them' :
2750 parametres['them'] = self.txtmods.GetValue().splitlines()
2751 # if self.extractformat.GetSelection() == 0 :
2752 # parametres['onefile'] = True
2754 # parametres['onefile'] = False
2755 parametres['encodeout'] = le[self.encodage.GetSelection()]
2758 def __del__( self ):
2761 class FreqDialog(wx.Dialog):
2762 def __init__(self, parent, ID, listcol, title, size) :
2763 wx.Dialog.__init__(self, parent, ID, title, size=size, pos=wx.DefaultPosition,style=wx.DEFAULT_DIALOG_STYLE | wx.CANCEL | wx.OK )
2764 pre = wx.PreDialog()
2765 pre.SetExtraStyle(wx.DIALOG_EX_CONTEXTHELP)
2766 pre.Create(parent, ID, title, wx.DefaultPosition, size, wx.DEFAULT_DIALOG_STYLE | wx.CANCEL | wx.OK)
2767 self.PostCreate(pre)
2768 self.parent = parent
2769 sizer = wx.BoxSizer(wx.VERTICAL)
2770 #self.content = parent.content
2771 self.header = listcol
2773 #for i in self.header:
2775 # if len(forme) > 60 :
2776 # LABELLIST.append(i[0:60])
2778 # LABELLIST.append(i)
2779 self.list_box_1 = wx.ListBox(self, -1, choices=self.header, style=wx.LB_EXTENDED | wx.LB_HSCROLL)
2780 sizer.Add(self.list_box_1, 0, 5)
2782 btnsizer = wx.BoxSizer(wx.HORIZONTAL)
2784 btn = wx.Button(self, wx.ID_CANCEL)
2787 btn = wx.Button(self, wx.ID_OK)
2791 sizer.Add(btnsizer, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_CENTER_HORIZONTAL, 5)
2792 self.SetSizer(sizer)
2794 self.SetTitle(_(u"Selection").decode('utf8'))
2798 class ProtoDial ( wx.Dialog ):
2800 def __init__( self, parent, headers ):
2801 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 )
2803 self.SetSizeHintsSz( wx.Size( -1,-1 ), wx.DefaultSize )
2805 bSizer1 = wx.BoxSizer( wx.VERTICAL )
2807 fgSizer1 = wx.FlexGridSizer( 0, 2, 0, 0 )
2808 fgSizer1.SetFlexibleDirection( wx.BOTH )
2809 fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
2811 self.m_staticText1 = wx.StaticText( self, wx.ID_ANY, _(u"Variables").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2812 self.m_staticText1.Wrap( -1 )
2813 fgSizer1.Add( self.m_staticText1, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALL, 5 )
2815 self.m_staticText2 = wx.StaticText( self, wx.ID_ANY, _(u"Ranks").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2816 self.m_staticText2.Wrap( -1 )
2817 fgSizer1.Add( self.m_staticText2, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALL, 5 )
2819 variablesChoices = headers
2820 self.variables = wx.ListBox( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, variablesChoices, wx.LB_HSCROLL|wx.LB_MULTIPLE )
2821 self.variables.SetMinSize( wx.Size( 350,-1 ) )
2823 fgSizer1.Add( self.variables, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL|wx.EXPAND, 5 )
2825 rangsChoices = headers
2826 self.rangs = wx.ListBox( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, rangsChoices, wx.LB_HSCROLL|wx.LB_MULTIPLE )
2827 self.rangs.SetMinSize( wx.Size( 350,-1 ) )
2829 fgSizer1.Add( self.rangs, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL|wx.EXPAND, 5 )
2832 bSizer1.Add( fgSizer1, 1, wx.ALIGN_CENTER_HORIZONTAL, 5 )
2834 fgSizer3 = wx.FlexGridSizer( 0, 2, 0, 0 )
2835 fgSizer3.SetFlexibleDirection( wx.BOTH )
2836 fgSizer3.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
2838 self.m_staticText3 = wx.StaticText( self, wx.ID_ANY, _(u"Limit frequency").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2839 self.m_staticText3.Wrap( -1 )
2840 fgSizer3.Add( self.m_staticText3, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2842 bSizer2 = wx.BoxSizer( wx.HORIZONTAL )
2844 choix_freqChoices = [ _(u"automatic (mean)").decode('utf8'), _(u"manual").decode('utf8') ]
2845 self.choix_freq = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, choix_freqChoices, 0 )
2846 self.choix_freq.SetSelection( 0 )
2847 bSizer2.Add( self.choix_freq, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2849 self.freqlim = wx.TextCtrl( self, wx.ID_ANY, u"0", wx.DefaultPosition, wx.DefaultSize, wx.TE_CENTRE )
2850 self.freqlim.Enable( False )
2851 self.freqlim.SetMinSize( wx.Size( 100,-1 ) )
2853 bSizer2.Add( self.freqlim, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2856 fgSizer3.Add( bSizer2, 1, wx.EXPAND, 5 )
2858 self.m_staticText4 = wx.StaticText( self, wx.ID_ANY, _(u"Limit rank").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2859 self.m_staticText4.Wrap( -1 )
2860 fgSizer3.Add( self.m_staticText4, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2862 bSizer21 = wx.BoxSizer( wx.HORIZONTAL )
2864 choix_rangChoices = [ _(u"automatic (mean)").decode('utf8'), _(u"manual").decode('utf8')]
2865 self.choix_rang = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, choix_rangChoices, 0 )
2866 self.choix_rang.SetSelection( 0 )
2867 bSizer21.Add( self.choix_rang, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2869 self.ranglim = wx.TextCtrl( self, wx.ID_ANY, u"0", wx.DefaultPosition, wx.DefaultSize, wx.TE_CENTRE )
2870 self.ranglim.Enable( False )
2871 self.ranglim.SetMinSize( wx.Size( 100,-1 ) )
2873 bSizer21.Add( self.ranglim, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2876 fgSizer3.Add( bSizer21, 1, wx.EXPAND, 5 )
2878 self.m_staticText5 = wx.StaticText( self, wx.ID_ANY, _(u"Minimum frequency").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
2879 self.m_staticText5.Wrap( -1 )
2880 fgSizer3.Add( self.m_staticText5, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2882 self.m_textCtrl4 = wx.TextCtrl( self, wx.ID_ANY, u"2", wx.DefaultPosition, wx.DefaultSize, wx.TE_CENTRE )
2883 fgSizer3.Add( self.m_textCtrl4, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALL, 5 )
2885 self.m_staticText6 = wx.StaticText( self, wx.ID_ANY, u"Type de représentation", wx.DefaultPosition, wx.DefaultSize, 0 )
2886 self.m_staticText6.Wrap( -1 )
2887 fgSizer3.Add( self.m_staticText6, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2889 m_choice3Choices = [ u"Classical - List", u"Classical - Cloud", u"Plan" ]
2890 self.typegraph = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, m_choice3Choices, 0 )
2891 self.typegraph.SetSelection( 0 )
2892 fgSizer3.Add( self.typegraph, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALL, 5 )
2894 bSizer1.Add( fgSizer3, 0, wx.ALIGN_CENTER_HORIZONTAL, 5 )
2896 m_sdbSizer1 = wx.StdDialogButtonSizer()
2897 self.m_sdbSizer1OK = wx.Button( self, wx.ID_OK )
2898 m_sdbSizer1.AddButton( self.m_sdbSizer1OK )
2899 self.m_sdbSizer1Cancel = wx.Button( self, wx.ID_CANCEL )
2900 m_sdbSizer1.AddButton( self.m_sdbSizer1Cancel )
2901 m_sdbSizer1.Realize();
2903 bSizer1.Add( m_sdbSizer1, 0, wx.EXPAND, 5 )
2905 self.SetSizer( bSizer1 )
2909 self.Centre( wx.BOTH )
2912 self.choix_freq.Bind( wx.EVT_CHOICE, self.UpdateText )
2913 self.choix_rang.Bind( wx.EVT_CHOICE, self.UpdateText )
2915 def __del__( self ):
2919 # Virtual event handlers, overide them in your derived class
2920 def UpdateText( self, event ):
2923 class SimpleDialog ( wx.Dialog ):
2925 def __init__( self, parent ):
2926 wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = wx.EmptyString, pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.DEFAULT_DIALOG_STYLE )
2928 self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
2930 bSizer1 = wx.BoxSizer( wx.VERTICAL )
2932 self.m_panel1 = wx.Panel( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
2933 bSizer2 = wx.BoxSizer( wx.VERTICAL )
2935 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 )
2936 self.m_staticText1.Wrap( -1 )
2937 bSizer2.Add( self.m_staticText1, 0, wx.ALL, 5 )
2939 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 )
2940 bSizer2.Add( self.link, 0, wx.ALL, 5 )
2943 self.m_panel1.SetSizer( bSizer2 )
2944 self.m_panel1.Layout()
2945 bSizer2.Fit( self.m_panel1 )
2946 bSizer1.Add( self.m_panel1, 1, wx.EXPAND |wx.ALL, 5 )
2948 m_sdbSizer1 = wx.StdDialogButtonSizer()
2949 self.m_sdbSizer1OK = wx.Button( self, wx.ID_OK )
2950 m_sdbSizer1.AddButton( self.m_sdbSizer1OK )
2951 m_sdbSizer1.Realize();
2953 bSizer1.Add( m_sdbSizer1, 0, wx.EXPAND, 5 )
2956 self.SetSizer( bSizer1 )
2960 self.Centre( wx.BOTH )
2962 def __del__( self ):
2966 class SubTextFromMetaDial ( wx.Dialog ):
2968 def __init__( self, parent, parametres ):
2969 wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = u"Subcorpus from metadata", pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.DEFAULT_DIALOG_STYLE )
2971 self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
2973 bSizer1 = wx.BoxSizer( wx.VERTICAL )
2975 fgSizer1 = wx.FlexGridSizer( 0, 2, 0, 0 )
2976 fgSizer1.SetFlexibleDirection( wx.BOTH )
2977 fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
2979 self.m_staticText1 = wx.StaticText( self, wx.ID_ANY, u"SubCorpus Name", wx.DefaultPosition, wx.DefaultSize, 0 )
2980 self.m_staticText1.Wrap( -1 )
2981 fgSizer1.Add( self.m_staticText1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2983 self.subcorpusname = wx.TextCtrl( self, wx.ID_ANY, parametres['corpus_name'], wx.DefaultPosition, wx.Size( 300,-1 ), 0 )
2984 fgSizer1.Add( self.subcorpusname, 0, wx.ALL, 5 )
2986 self.m_staticText2 = wx.StaticText( self, wx.ID_ANY, u"Select one or more metadata", wx.DefaultPosition, wx.DefaultSize, 0 )
2987 self.m_staticText2.Wrap( -1 )
2988 fgSizer1.Add( self.m_staticText2, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
2990 m_listBox1Choices = parametres['meta']
2991 self.m_listBox1 = wx.ListBox( self, wx.ID_ANY, wx.DefaultPosition, wx.Size( -1,-1 ), m_listBox1Choices, wx.LB_HSCROLL|wx.LB_MULTIPLE )
2992 self.m_listBox1.SetMinSize( wx.Size( -1,200 ) )
2993 self.m_listBox1.SetMaxSize( wx.Size( -1,500 ) )
2995 fgSizer1.Add( self.m_listBox1, 0, wx.ALL|wx.EXPAND, 5 )
2998 bSizer1.Add( fgSizer1, 1, wx.EXPAND, 5 )
3000 m_sdbSizer1 = wx.StdDialogButtonSizer()
3001 self.m_sdbSizer1OK = wx.Button( self, wx.ID_OK )
3002 m_sdbSizer1.AddButton( self.m_sdbSizer1OK )
3003 self.m_sdbSizer1Cancel = wx.Button( self, wx.ID_CANCEL )
3004 m_sdbSizer1.AddButton( self.m_sdbSizer1Cancel )
3005 m_sdbSizer1.Realize();
3007 bSizer1.Add( m_sdbSizer1, 0, wx.EXPAND, 5 )
3010 self.SetSizer( bSizer1 )
3014 self.Centre( wx.BOTH )
3016 def __del__( self ):
3019 class BarGraphDialog ( wx.Dialog ):
3021 def __init__( self, parent, width, height ):
3022 wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = u"Preferences", pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.DEFAULT_DIALOG_STYLE )
3024 self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
3026 bSizer1 = wx.BoxSizer( wx.VERTICAL )
3028 bSizer2 = wx.BoxSizer( wx.HORIZONTAL )
3030 self.m_staticText1 = wx.StaticText( self, wx.ID_ANY, u"Size", wx.DefaultPosition, wx.DefaultSize, 0 )
3031 self.m_staticText1.Wrap( -1 )
3032 bSizer2.Add( self.m_staticText1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
3034 sizeradioChoices = [ u"automatic", u"manual" ]
3035 self.sizeradio = wx.RadioBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, sizeradioChoices, 1, wx.RA_SPECIFY_COLS )
3036 self.sizeradio.SetSelection( 0 )
3037 bSizer2.Add( self.sizeradio, 0, wx.ALIGN_TOP|wx.ALL, 5 )
3039 fgSizer1 = wx.FlexGridSizer( 0, 2, 0, 0 )
3040 fgSizer1.SetFlexibleDirection( wx.BOTH )
3041 fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
3043 self.m_staticText2 = wx.StaticText( self, wx.ID_ANY, u"width", wx.DefaultPosition, wx.DefaultSize, 0 )
3044 self.m_staticText2.Wrap( -1 )
3045 fgSizer1.Add( self.m_staticText2, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
3047 self.widthsp = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 0, 1000000, 600 )
3048 fgSizer1.Add( self.widthsp, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
3050 self.m_staticText3 = wx.StaticText( self, wx.ID_ANY, u"height", wx.DefaultPosition, wx.DefaultSize, 0 )
3051 self.m_staticText3.Wrap( -1 )
3052 fgSizer1.Add( self.m_staticText3, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
3054 self.heightsp = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 1, 10000000, 400 )
3055 fgSizer1.Add( self.heightsp, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
3058 bSizer2.Add( fgSizer1, 1, wx.EXPAND, 5 )
3061 bSizer1.Add( bSizer2, 1, wx.EXPAND, 5 )
3063 bSizer3 = wx.BoxSizer( wx.HORIZONTAL )
3065 self.m_staticText4 = wx.StaticText( self, wx.ID_ANY, u"Image format", wx.DefaultPosition, wx.DefaultSize, 0 )
3066 self.m_staticText4.Wrap( -1 )
3067 bSizer3.Add( self.m_staticText4, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
3069 formatChoices = [ u"png", u"svg" ]
3070 self.format = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, formatChoices, 0 )
3071 self.format.SetSelection( 0 )
3072 bSizer3.Add( self.format, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
3075 bSizer1.Add( bSizer3, 1, wx.EXPAND, 5 )
3077 m_sdbSizer1 = wx.StdDialogButtonSizer()
3078 self.m_sdbSizer1OK = wx.Button( self, wx.ID_OK )
3079 m_sdbSizer1.AddButton( self.m_sdbSizer1OK )
3080 self.m_sdbSizer1Cancel = wx.Button( self, wx.ID_CANCEL )
3081 m_sdbSizer1.AddButton( self.m_sdbSizer1Cancel )
3082 m_sdbSizer1.Realize();
3084 bSizer1.Add( m_sdbSizer1, 0, wx.EXPAND, 5 )
3087 self.SetSizer( bSizer1 )
3091 self.Centre( wx.BOTH )
3094 self.sizeradio.Bind( wx.EVT_RADIOBOX, self.OnSizeRadio )
3096 self.widthsp.SetValue(width)
3097 self.heightsp.SetValue(height)
3098 self.widthsp.Enable(False)
3099 self.heightsp.Enable(False)
3100 self.m_sdbSizer1OK.SetFocus()
3102 def __del__( self ):
3106 # Virtual event handlers, overide them in your derived class
3107 def OnSizeRadio( self, event ):
3108 if self.sizeradio.GetSelection() == 0 :
3109 self.widthsp.Enable(False)
3110 self.heightsp.Enable(False)
3112 self.widthsp.Enable(True)
3113 self.heightsp.Enable(True)
3116 class MessageImage(wx.Frame):
3117 def __init__(self, parent, parametres, title, size):
3118 wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = title, pos = wx.DefaultPosition, size = size, style = wx.DEFAULT_FRAME_STYLE )
3119 self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
3120 self.parametres = parametres
3121 self.imageFile = self.parametres['tmpgraph']
3122 if parametres['svg'] == 'TRUE' :
3123 self.imagename = u"image.svg"
3125 self.imagename = u"iamge.png"
3126 self.HtmlPage = wx.html.HtmlWindow(self, -1)
3127 self.HtmlPage.SetMinSize(size)
3128 if "gtk2" in wx.PlatformInfo:
3129 self.HtmlPage.SetStandardFonts()
3130 self.HtmlPage.SetFonts('Courier', 'Courier')
3132 self.button_1 = wx.Button(self, wx.ID_CANCEL)
3133 self.button_2 = wx.Button(self, wx.ID_SAVE)
3134 self.Bind(wx.EVT_BUTTON, self.OnCloseMe, self.button_1)
3135 self.Bind(wx.EVT_BUTTON, self.OnSaveImage, self.button_2)
3138 def do_layout(self):
3139 self.sizer_1 = wx.BoxSizer(wx.VERTICAL)
3140 self.sizer_2 = wx.BoxSizer(wx.HORIZONTAL)
3141 self.sizer_1.Add(self.HtmlPage, 2, wx.EXPAND, 0)
3143 self.m_sdbSizer1 = wx.StdDialogButtonSizer()
3144 self.m_sdbSizer1.AddButton( self.button_2 )
3145 self.m_sdbSizer1.AddButton( self.button_1 )
3146 self.m_sdbSizer1.Realize()
3147 self.sizer_1.Add(self.m_sdbSizer1, 0, wx.EXPAND, 5)
3148 self.SetSizer(self.sizer_1)
3150 self.sizer_1.Fit( self )
3152 def OnCloseMe(self, event):
3155 def OnSaveImage(self, event) :
3156 dlg = wx.FileDialog(
3157 self, message="Enregistrer sous...", defaultDir=os.getcwd(),
3158 defaultFile= self.imagename, wildcard=self.parametres['wildcard'], style=wx.SAVE | wx.OVERWRITE_PROMPT
3160 dlg.SetFilterIndex(2)
3161 dlg.CenterOnParent()
3162 if dlg.ShowModal() == wx.ID_OK:
3163 path = dlg.GetPath()
3164 copyfile(self.imageFile, path)
3167 def __init__(self, ira, table, colnames, rownames, tree = False):
3169 width = 100 + (10*len(rownames)) + (100 * len(colnames))
3170 height = len(rownames) * 15
3175 height = (35 * len(colnames)) + (15 * len(rownames))
3176 dial = BarGraphDialog(ira, width, height)
3177 val = dial.ShowModal()
3178 if val == wx.ID_OK :
3179 tmpgraph = tempfile.mktemp(dir=ira.TEMPDIR)
3180 if dial.format.GetSelection() == 0 :
3182 wildcard = "png|*.png"
3185 wildcard = "svg|*.svg"
3186 parametres = {'width' : dial.widthsp.GetValue(),
3187 'height': dial.heightsp.GetValue(),
3188 'colnames' : colnames,
3189 'rownames' : rownames,
3190 'tmpgraph' : tmpgraph,
3191 'rgraph' : ira.RscriptsPath['Rgraph'],
3193 'wildcard' : wildcard}
3195 parametres['tree'] = tree
3196 txt = barplot(table, parametres)
3197 tmpscript = tempfile.mktemp(dir=ira.TEMPDIR)
3198 with open(tmpscript,'w') as f :
3200 exec_rcode(ira.RPath, tmpscript, wait = True)
3201 win = MessageImage(ira, parametres, u"Graphique", size=(700, 500))
3203 txt = "<img src='%s'>" % tmpgraph
3205 txt = """Copiez ce lien dans votre navigateur : <br>
3206 <a href="%s">%s</a>""" % (tmpgraph, tmpgraph)
3207 win.HtmlPage.SetPage(txt)