1 # -*- coding: utf-8 -*-
2 #Author: Pierre Ratinaud
3 #Copyright (c) 2008-2020 Pierre Ratinaud
4 #modification pour python 3 : Laurent Mérat, 6x7 - mai 2020
7 #------------------------------------
8 # import des modules python
9 #------------------------------------
16 #------------------------------------
17 # import des modules wx
18 #------------------------------------
20 import wx.lib.agw.hyperlink as hl
22 #------------------------------------
23 # import des fichiers du projet
24 #------------------------------------
25 from dialog import FileOptionDialog, SelectColDial, OptLexi, PrefSimpleFile
27 from vitemspicker import VItemsPicker, EVT_IP_SELECTION_CHANGED, IP_SORT_CHOICES, IP_SORT_SELECTED, IP_REMOVE_FROM_CHOICES
28 from functions import treat_var_mod, print_liste, exec_rcode, check_Rresult, DoConf, read_list_file, indices_simi
29 from webexport import WebExport
30 from PrintRScript import PrintSimiScript
36 def OnOpen(self, type):
38 wildcard = "Fichiers supportés|*.ods;*.xls;*.csv;*.txt|Openoffice Calc|*.ods|Excel 97/2000/XP/2003|*.xls|Fichier csv|*.csv|Fichier texte|*.txt|Tous les fichiers|*"
40 wildcard = "Fichier texte|*.txt|Tous les fichiers|*"
41 elif type == "Analyse":
42 wildcard = "Fichier analyse/Corpus|*.ira;*.cira"
43 defaultDir = self.PathPath.get('PATHS', 'lastpath')
44 if defaultDir.strip() == '':
45 defaultDir = self.UserConfigPath.replace('.iramuteq','')
47 self, message=_("Choose a file"), defaultDir=defaultDir,
48 defaultFile="", wildcard=wildcard, style=wx.FD_OPEN | wx.FD_CHANGE_DIR)
50 if dlg.ShowModal() == wx.ID_OK :
51 fileName = dlg.GetFilename()
54 self.PathPath.set('PATHS', 'lastpath', os.path.dirname(path[0]))
63 elif type == "Analyse":
66 def getfileextension(file) :
67 return os.path.splitext(file)[1]
69 def get_table_param(self, filename) :
70 if getfileextension(filename) == '.csv':
71 dlg = FileOptionDialog(self, -1, _("File format"), sep=True, size=(350, 200),
72 style=wx.DEFAULT_DIALOG_STYLE)
76 self.tableau.parametres['colsep'] = dlg.colsep[dlg.choice3.GetSelection()]
77 self.tableau.parametres['txtsep'] = dlg.txtsep[dlg.choice4.GetSelection()]
78 if self.tableau.parametres['colsep'] == 'tabulation' :
79 self.tableau.parametres['colsep'] = '\t'
80 self.tableau.parametres['filetype'] = 'csv'
81 self.tableau.parametres['encodage'] = dlg.le[dlg.list_encodages.GetSelection()]
82 elif getfileextension(filename) == '.xls' :
83 dlg = FileOptionDialog(self, -1, _("File format"), sep=False, sheet = True, size=(350, 200),
84 style=wx.DEFAULT_DIALOG_STYLE)
88 self.tableau.parametres['colsep'] = ';'
89 self.tableau.parametres['txtsep'] = '\"'
90 self.tableau.parametres['encodage'] = sys.getdefaultencoding()
91 self.tableau.parametres['sheetnb'] = dlg.spin1.GetValue()
92 self.tableau.parametres['filetype'] = 'xls'
93 elif getfileextension(filename) == '.ods':
94 dlg = FileOptionDialog(self, -1, _("File format"), sep=False, size=(350, 200),
95 style=wx.DEFAULT_DIALOG_STYLE)
99 self.tableau.parametres['colsep'] = ';'
100 self.tableau.parametres['txtsep'] = '\"'
101 self.tableau.parametres['filetype'] = 'ods'
105 if dlg.radio_box_1.GetSelection() == 0:
106 self.tableau.firstrowiscolnames = True
108 self.tableau.firstrowiscolnames = False
109 if dlg.radio_box_2.GetSelection() == 0:
110 self.tableau.firstcolisrownames = True
112 self.tableau.firstcolisrownames = False
117 if '_mgr' in dir(ira) :
118 if not ira._mgr.GetPane('Text').IsShown() :
119 if ira.nb.GetPageCount() >= 1:
120 return ira.nb.GetPage(ira.nb.GetSelection())
128 def getCorpus(page) :
129 if 'corpus' in page.__dict__:
130 return copy(page.corpus)
135 def __init__(self, parent, dictcol, actives, pathout, selected = None, dlg = False) :
138 dial = SelectColDial(self.ira)
139 listcol = ListForSpec(dial, self, dictcol, ['eff'])
140 dial.bSizer2.Add( listcol, 2, wx.ALL|wx.EXPAND, 5 )
141 dial.m_sdbSizer2.AddButton( dial.m_sdbSizer2OK )
142 dial.m_sdbSizer2.AddButton( dial.butok)
143 dial.m_sdbSizer2.Realize()
144 dial.bSizer2.Add( dial.m_sdbSizer2, 0, wx.EXPAND, 5 )
146 if selected is None :
147 for row in range(listcol.GetItemCount()):
150 orderlex = dict([[listcol.getColumnText(i,0),i] for i in range(0,listcol.GetItemCount())])
151 for row in selected :
152 listcol.Select(orderlex[actives[row]])
153 dial.CenterOnParent()
154 val = dial.ShowModal()
156 last = listcol.GetFirstSelected()
157 lastl = [listcol.GetFirstSelected()]
158 indexes = [listcol.getColumnText(listcol.GetFirstSelected(),0)]
159 while listcol.GetNextSelected(last) != -1:
160 last = listcol.GetNextSelected(last)
162 indexes.append(listcol.getColumnText(last,0))
164 column = [actives.index(val) for val in indexes]
166 with open(pathout, 'w' ,encoding='utf8') as f :
167 f.write('\n'.join([repr(val) for val in column]))
173 if selected is None :
174 selected = [i for i in range(0, len(actives))]
175 with open(pathout, 'w', encoding='utf8') as f :
176 f.write('\n'.join([repr(i) for i in selected]))
179 class PrefSimi ( wx.Dialog ):
181 def __init__( self, parent, ID, paramsimi, indices, wordlist = None, selected = None, actives = None):
182 wx.Dialog.__init__ ( self, None, id = wx.ID_ANY, title = _("Settings"), pos = wx.DefaultPosition, size = wx.Size( -1,-1 ), style = wx.DEFAULT_DIALOG_STYLE )
185 self.paramsimi=paramsimi
186 self.indices = indices
188 self.SetSizeHints( wx.DefaultSize, wx.DefaultSize )
190 bSizer16 = wx.BoxSizer( wx.HORIZONTAL )
191 if wordlist is not None :
192 self.listcol = ListForSpec(self, self, wordlist, ['eff'])
193 self.listcol.SetMinSize( wx.Size( 270,-1 ) )
194 listsizer = wx.BoxSizer( wx.VERTICAL )
195 countsizer = wx.BoxSizer( wx.HORIZONTAL )
196 self.butcount = wx.Button(self, -1, _("count"))
197 self.textcount = wx.TextCtrl(self, -1, "", wx.DefaultPosition, wx.Size( 100,-1 ), wx.TE_READONLY )
198 countsizer.Add(self.butcount, 0, wx.ALL, 5)
199 countsizer.Add(self.textcount, 0, wx.ALL, 5 )
200 listsizer.Add(countsizer, 0, wx.ALL, 5)
201 listsizer.Add(self.listcol, 2, wx.ALL|wx.EXPAND, 5 )
202 #bSizer16.Add( self.listcol, 0, wx.ALL|wx.EXPAND, 5 )
203 bSizer16.Add( listsizer, 0, wx.ALL|wx.EXPAND, 5)
204 if selected is None :
205 for row in range(self.listcol.GetItemCount()):
206 self.listcol.Select(row)
208 self.orderlex = dict([[self.listcol.getColumnText(i,0),i] for i in range(0,self.listcol.GetItemCount())])
209 for row in selected :
210 self.listcol.Select(self.orderlex[actives[row]])
213 fgSizer10 = wx.FlexGridSizer( 2, 1, 0, 0 )
214 fgSizer10.SetFlexibleDirection( wx.BOTH )
215 fgSizer10.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
217 self.m_notebook1 = wx.Notebook( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, 0 )
218 self.m_panel2 = wx.Panel( self.m_notebook1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
219 bSizer18 = wx.BoxSizer( wx.VERTICAL )
221 fgSizer3 = wx.FlexGridSizer( 0, 2, 0, 0 )
222 fgSizer3.SetFlexibleDirection( wx.BOTH )
223 fgSizer3.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
225 if not self.paramsimi['first'] :
227 self.m_staticText271 = wx.StaticText( self.m_panel2, wx.ID_ANY, _("Use previous coordinates"), wx.DefaultPosition, wx.DefaultSize, 0 )
228 self.m_staticText271.Wrap( -1 )
229 fgSizer3.Add( self.m_staticText271, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
231 self.check_coord = wx.CheckBox( self.m_panel2, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
232 fgSizer3.Add( self.check_coord, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
234 self.m_staticline36 = wx.StaticLine( self.m_panel2, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
235 fgSizer3.Add( self.m_staticline36, 0, wx.EXPAND, 5 )
237 self.m_staticline37 = wx.StaticLine( self.m_panel2, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
238 fgSizer3.Add( self.m_staticline37, 0, wx.EXPAND, 5 )
240 self.m_staticText3 = wx.StaticText( self.m_panel2, wx.ID_ANY, _("Score"), wx.DefaultPosition, wx.DefaultSize, 0 )
241 self.m_staticText3.Wrap( -1 )
242 fgSizer3.Add( self.m_staticText3, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
245 self.choice1 = wx.Choice( self.m_panel2, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, self.indices, 0 )
246 self.choice1.SetSelection( 0 )
247 fgSizer3.Add( self.choice1, 0, wx.ALL, 5 )
249 self.m_staticline293 = wx.StaticLine( self.m_panel2, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
250 fgSizer3.Add( self.m_staticline293, 0, wx.EXPAND, 5 )
252 self.m_staticline292 = wx.StaticLine( self.m_panel2, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
253 fgSizer3.Add( self.m_staticline292, 0, wx.EXPAND, 5 )
255 self.m_staticText4 = wx.StaticText( self.m_panel2, wx.ID_ANY, _("Layout"), wx.DefaultPosition, wx.DefaultSize, 0 )
256 self.m_staticText4.Wrap( -1 )
257 fgSizer3.Add( self.m_staticText4, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
259 choice2Choices = [ "random", "cercle", "fruchterman reingold", "kamada kawai", "graphopt" ]
260 if 'word' in self.paramsimi :
261 choice2Choices += ["spirale", 'spirale3D']
262 self.choice2 = wx.Choice( self.m_panel2, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, choice2Choices, 0 )
263 self.choice2.SetSelection( 0 )
264 fgSizer3.Add( self.choice2, 0, wx.ALL, 5 )
266 self.m_staticline294 = wx.StaticLine( self.m_panel2, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
267 fgSizer3.Add( self.m_staticline294, 0, wx.EXPAND, 5 )
269 self.m_staticline295 = wx.StaticLine( self.m_panel2, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
270 fgSizer3.Add( self.m_staticline295, 0, wx.EXPAND, 5 )
272 self.m_staticText5 = wx.StaticText( self.m_panel2, wx.ID_ANY, _("Graphic type"), wx.DefaultPosition, wx.DefaultSize, 0 )
273 self.m_staticText5.Wrap( -1 )
274 fgSizer3.Add( self.m_staticText5, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
276 choice3Choices = [ "dynamique", "statique", "3D", 'web2D', "web3D" ]
277 self.choice3 = wx.Choice( self.m_panel2, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, choice3Choices, 0 )
278 self.choice3.SetSelection( 0 )
280 label_format = wx.StaticText(self.m_panel2, -1, _("Picture format"))
281 self.choix_format = wx.Choice(self.m_panel2, -1, (100,50), choices = ['png', 'svg'])
282 self.choix_format.SetSelection( 0 )
283 hsizer = wx.BoxSizer(wx.HORIZONTAL)
284 hsizer.Add(self.choice3, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
285 hsizer.Add(label_format, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
286 hsizer.Add(self.choix_format, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
287 fgSizer3.Add( hsizer, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
289 self.m_staticline296 = wx.StaticLine( self.m_panel2, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
290 fgSizer3.Add( self.m_staticline296, 0, wx.EXPAND, 5 )
292 self.m_staticline297 = wx.StaticLine( self.m_panel2, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
293 fgSizer3.Add( self.m_staticline297, 0, wx.EXPAND, 5 )
295 self.m_staticText8 = wx.StaticText( self.m_panel2, wx.ID_ANY, _("Maximum tree"), wx.DefaultPosition, wx.DefaultSize, 0 )
296 self.m_staticText8.Wrap( -1 )
297 fgSizer3.Add( self.m_staticText8, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
299 self.check1 = wx.CheckBox( self.m_panel2, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
300 fgSizer3.Add( self.check1, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
302 self.m_staticline298 = wx.StaticLine( self.m_panel2, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
303 fgSizer3.Add( self.m_staticline298, 0, wx.EXPAND, 5 )
305 self.m_staticline299 = wx.StaticLine( self.m_panel2, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
306 fgSizer3.Add( self.m_staticline299, 0, wx.EXPAND, 5 )
308 self.m_staticText91 = wx.StaticText( self.m_panel2, wx.ID_ANY, _("Edges threshold"), wx.DefaultPosition, wx.DefaultSize, 0 )
309 self.m_staticText91.Wrap( -1 )
310 fgSizer3.Add( self.m_staticText91, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
312 bSizer21 = wx.BoxSizer( wx.HORIZONTAL )
314 self.check_seuil = wx.CheckBox( self.m_panel2, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
315 bSizer21.Add( self.check_seuil, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
317 self.spin_seuil = wx.SpinCtrl( self.m_panel2, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 1, 10000, 1 )
318 bSizer21.Add( self.spin_seuil, 0, wx.ALL, 5 )
321 fgSizer3.Add( bSizer21, 1, wx.EXPAND, 5 )
323 self.m_staticline2910 = wx.StaticLine( self.m_panel2, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
324 fgSizer3.Add( self.m_staticline2910, 0, wx.EXPAND, 5 )
326 self.m_staticline2911 = wx.StaticLine( self.m_panel2, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
327 fgSizer3.Add( self.m_staticline2911, 0, wx.EXPAND, 5 )
329 self.m_staticText19 = wx.StaticText( self.m_panel2, wx.ID_ANY, _("Text on vertex"), wx.DefaultPosition, wx.DefaultSize, 0 )
330 self.m_staticText19.Wrap( -1 )
331 fgSizer3.Add( self.m_staticText19, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
333 self.check_vlab = wx.CheckBox( self.m_panel2, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
334 fgSizer3.Add( self.check_vlab, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
336 self.m_staticline2912 = wx.StaticLine( self.m_panel2, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
337 fgSizer3.Add( self.m_staticline2912, 0, wx.EXPAND, 5 )
339 self.m_staticline2913 = wx.StaticLine( self.m_panel2, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
340 fgSizer3.Add( self.m_staticline2913, 0, wx.EXPAND, 5 )
342 self.m_staticText20 = wx.StaticText( self.m_panel2, wx.ID_ANY, _("Score on edges"), wx.DefaultPosition, wx.DefaultSize, 0 )
343 self.m_staticText20.Wrap( -1 )
344 fgSizer3.Add( self.m_staticText20, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
346 self.check_elab = wx.CheckBox( self.m_panel2, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
347 fgSizer3.Add( self.check_elab, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
349 self.m_staticline39 = wx.StaticLine( self.m_panel2, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
350 fgSizer3.Add( self.m_staticline39, 0, wx.EXPAND |wx.ALL, 5 )
352 self.m_staticline40 = wx.StaticLine( self.m_panel2, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
353 fgSizer3.Add( self.m_staticline40, 0, wx.EXPAND |wx.ALL, 5 )
355 self.m_staticText321 = wx.StaticText( self.m_panel2, wx.ID_ANY, _("Edge curved"), wx.DefaultPosition, wx.DefaultSize, 0 )
356 self.m_staticText321.Wrap( -1 )
357 fgSizer3.Add( self.m_staticText321, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
359 self.check_curved = wx.CheckBox( self.m_panel2, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
360 fgSizer3.Add( self.check_curved, 0, wx.ALL, 5 )
362 self.m_staticline2914 = wx.StaticLine( self.m_panel2, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
363 fgSizer3.Add( self.m_staticline2914, 0, wx.EXPAND, 5 )
365 self.m_staticline2915 = wx.StaticLine( self.m_panel2, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
366 fgSizer3.Add( self.m_staticline2915, 0, wx.EXPAND, 5 )
368 self.m_staticText27 = wx.StaticText( self.m_panel2, wx.ID_ANY, _("Text size"), wx.DefaultPosition, wx.DefaultSize, 0 )
369 self.m_staticText27.Wrap( -1 )
370 fgSizer3.Add( self.m_staticText27, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
372 self.spin_cex = wx.SpinCtrl( self.m_panel2, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 0, 100, 10 )
373 fgSizer3.Add( self.spin_cex, 0, wx.ALL, 5 )
375 self.m_staticline2916 = wx.StaticLine( self.m_panel2, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
376 fgSizer3.Add( self.m_staticline2916, 0, wx.EXPAND, 5 )
378 self.m_staticline2917 = wx.StaticLine( self.m_panel2, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
379 fgSizer3.Add( self.m_staticline2917, 0, wx.EXPAND, 5 )
381 bsizer34 = wx.BoxSizer(wx.HORIZONTAL)
383 comtext = wx.StaticText( self.m_panel2, wx.ID_ANY, _("Communities"), wx.DefaultPosition, wx.DefaultSize, 0 )
385 bsizer34.Add(comtext, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
387 self.comcheck = wx.CheckBox(self.m_panel2, -1)
388 bsizer34.Add(self.comcheck, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
390 fgSizer3.Add(bsizer34 , 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
392 sizer54 = wx.BoxSizer(wx.HORIZONTAL)
393 self.comlist = ['edge.betweenness.community','fastgreedy.community','label.propagation.community','leading.eigenvector.community','multilevel.community','optimal.community', 'spinglass.community', 'walktrap.community']
394 self.choix_com = wx.Choice( self.m_panel2, wx.ID_ANY, choices = self.comlist)
395 self.choix_com.SetSelection( 0 )
396 self.halo = wx.CheckBox(self.m_panel2, wx.ID_ANY, 'halo')
397 sizer54.Add(self.choix_com , 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
398 sizer54.Add(self.halo , 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
399 fgSizer3.Add( sizer54, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
401 if 'bystar' in self.paramsimi :
402 self.m_staticText40 = wx.StaticText( self.m_panel2, wx.ID_ANY, _("Select a variable"), wx.DefaultPosition, wx.DefaultSize, 0 )
403 self.m_staticText40.Wrap( -1 )
404 fgSizer3.Add( self.m_staticText40, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
406 self.check_bystar = wx.CheckBox( self.m_panel2, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
407 fgSizer3.Add( self.check_bystar, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
409 self.m_staticline3200 = wx.StaticLine( self.m_panel2, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
410 fgSizer3.Add( self.m_staticline3200, 0, wx.EXPAND, 5 )
411 self.m_staticline3201 = wx.StaticLine( self.m_panel2, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
412 fgSizer3.Add( self.m_staticline3201, 0, wx.EXPAND, 5 )
415 bSizer18.Add( fgSizer3, 0, wx.EXPAND, 5 )
418 self.m_panel2.SetSizer( bSizer18 )
419 self.m_panel2.Layout()
420 bSizer18.Fit( self.m_panel2 )
421 self.m_notebook1.AddPage( self.m_panel2, _("Graph settings"), True )
422 self.m_panel3 = wx.Panel( self.m_notebook1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
423 fgSizer5 = wx.FlexGridSizer( 0, 3, 0, 0 )
424 fgSizer5.SetFlexibleDirection( wx.BOTH )
425 fgSizer5.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
427 fgSizer51 = wx.FlexGridSizer( 0, 2, 0, 0 )
428 fgSizer51.SetFlexibleDirection( wx.BOTH )
429 fgSizer51.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
431 self.m_staticText6 = wx.StaticText( self.m_panel3, wx.ID_ANY, _("Picture size"), wx.DefaultPosition, wx.DefaultSize, 0 )
432 self.m_staticText6.Wrap( -1 )
433 fgSizer51.Add( self.m_staticText6, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
435 fgSizer31 = wx.FlexGridSizer( 0, 2, 0, 0 )
436 fgSizer31.SetFlexibleDirection( wx.BOTH )
437 fgSizer31.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
439 self.m_staticText9 = wx.StaticText( self.m_panel3, wx.ID_ANY, _("height"), wx.DefaultPosition, wx.DefaultSize, 0 )
440 self.m_staticText9.Wrap( -1 )
441 fgSizer31.Add( self.m_staticText9, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
443 self.spin_height = wx.SpinCtrl( self.m_panel3, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 10, 100000, 800 )
444 fgSizer31.Add( self.spin_height, 0, wx.ALL, 5 )
446 self.m_staticText10 = wx.StaticText( self.m_panel3, wx.ID_ANY, _("width"), wx.DefaultPosition, wx.DefaultSize, 0 )
447 self.m_staticText10.Wrap( -1 )
448 fgSizer31.Add( self.m_staticText10, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
450 self.spin_width = wx.SpinCtrl( self.m_panel3, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 10, 100000, 800 )
451 fgSizer31.Add( self.spin_width, 0, wx.ALL, 5 )
454 fgSizer51.Add( fgSizer31, 1, wx.EXPAND, 5 )
456 self.m_staticline3 = wx.StaticLine( self.m_panel3, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
457 fgSizer51.Add( self.m_staticline3, 0, wx.EXPAND, 5 )
459 self.m_staticline4 = wx.StaticLine( self.m_panel3, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
460 fgSizer51.Add( self.m_staticline4, 0, wx.EXPAND, 5 )
462 self.m_staticText101 = wx.StaticText( self.m_panel3, wx.ID_ANY, _("Vertex size proportional to frequency"), wx.DefaultPosition, wx.DefaultSize, 0 )
463 self.m_staticText101.Wrap( -1 )
464 fgSizer51.Add( self.m_staticText101, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
466 bSizer7 = wx.BoxSizer( wx.HORIZONTAL )
468 bSizer9 = wx.BoxSizer( wx.VERTICAL )
470 self.check2 = wx.CheckBox( self.m_panel3, wx.ID_ANY, "eff.", wx.DefaultPosition, wx.DefaultSize, 0 )
471 bSizer9.Add( self.check2, 0, wx.ALL, 5 )
473 self.checki = wx.CheckBox( self.m_panel3, wx.ID_ANY, "chi2", wx.DefaultPosition, wx.DefaultSize, 0 )
474 bSizer9.Add( self.checki, 0, wx.ALL, 5 )
477 bSizer7.Add( bSizer9, 0, wx.ALIGN_CENTER_VERTICAL, 5 )
479 fgSizer7 = wx.FlexGridSizer( 0, 2, 0, 0 )
480 fgSizer7.SetFlexibleDirection( wx.BOTH )
481 fgSizer7.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
483 self.m_staticText11 = wx.StaticText( self.m_panel3, wx.ID_ANY, "min", wx.DefaultPosition, wx.DefaultSize, 0 )
484 self.m_staticText11.Wrap( -1 )
485 fgSizer7.Add( self.m_staticText11, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
487 self.spin_tvmin = wx.SpinCtrl( self.m_panel3, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 0, 100, 0 )
488 fgSizer7.Add( self.spin_tvmin, 0, wx.ALL, 5 )
490 self.m_staticText12 = wx.StaticText( self.m_panel3, wx.ID_ANY, "max", wx.DefaultPosition, wx.DefaultSize, 0 )
491 self.m_staticText12.Wrap( -1 )
492 fgSizer7.Add( self.m_staticText12, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
494 self.spin_tvmax = wx.SpinCtrl( self.m_panel3, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 0, 100, 0 )
495 fgSizer7.Add( self.spin_tvmax, 0, wx.ALL, 5 )
498 bSizer7.Add( fgSizer7, 1, wx.EXPAND, 5 )
501 fgSizer51.Add( bSizer7, 1, wx.EXPAND, 5 )
503 self.m_staticline31 = wx.StaticLine( self.m_panel3, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
504 fgSizer51.Add( self.m_staticline31, 0, wx.EXPAND, 5 )
506 self.m_staticline32 = wx.StaticLine( self.m_panel3, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
507 fgSizer51.Add( self.m_staticline32, 0, wx.EXPAND, 5 )
509 self.m_staticText1011 = wx.StaticText( self.m_panel3, wx.ID_ANY, _("Vertex text size proportional to frequency"), wx.DefaultPosition, wx.DefaultSize, 0 )
510 self.m_staticText1011.Wrap( -1 )
511 fgSizer51.Add( self.m_staticText1011, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
513 bSizer71 = wx.BoxSizer( wx.HORIZONTAL )
515 bSizer8 = wx.BoxSizer( wx.VERTICAL )
517 self.check_vcex = wx.CheckBox( self.m_panel3, wx.ID_ANY, "eff.", wx.DefaultPosition, wx.DefaultSize, 0 )
518 bSizer8.Add( self.check_vcex, 0, wx.ALL, 5 )
520 self.checkit = wx.CheckBox( self.m_panel3, wx.ID_ANY, "chi2", wx.DefaultPosition, wx.DefaultSize, 0 )
521 bSizer8.Add( self.checkit, 0, wx.ALL, 5 )
524 bSizer71.Add( bSizer8, 0, wx.ALIGN_CENTER_VERTICAL, 5 )
526 fgSizer71 = wx.FlexGridSizer( 0, 2, 0, 0 )
527 fgSizer71.SetFlexibleDirection( wx.BOTH )
528 fgSizer71.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
530 self.m_staticText111 = wx.StaticText( self.m_panel3, wx.ID_ANY, "min", wx.DefaultPosition, wx.DefaultSize, 0 )
531 self.m_staticText111.Wrap( -1 )
532 fgSizer71.Add( self.m_staticText111, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
534 self.spin_vcexmin = wx.SpinCtrl( self.m_panel3, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 0, 100, 0 )
535 fgSizer71.Add( self.spin_vcexmin, 0, wx.ALL, 5 )
537 self.m_staticText121 = wx.StaticText( self.m_panel3, wx.ID_ANY, "max", wx.DefaultPosition, wx.DefaultSize, 0 )
538 self.m_staticText121.Wrap( -1 )
539 fgSizer71.Add( self.m_staticText121, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
541 self.spin_vcexmax = wx.SpinCtrl( self.m_panel3, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 0, 100, 0 )
542 fgSizer71.Add( self.spin_vcexmax, 0, wx.ALL, 5 )
545 bSizer71.Add( fgSizer71, 1, wx.EXPAND, 5 )
548 fgSizer51.Add( bSizer71, 1, wx.EXPAND, 5 )
550 self.m_staticline321 = wx.StaticLine( self.m_panel3, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
551 fgSizer51.Add( self.m_staticline321, 0, wx.EXPAND, 5 )
553 self.m_staticline322 = wx.StaticLine( self.m_panel3, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
554 fgSizer51.Add( self.m_staticline322, 0, wx.EXPAND, 5 )
556 self.m_staticText10111 = wx.StaticText( self.m_panel3, wx.ID_ANY, _("Edges width proportional to score"), wx.DefaultPosition, wx.DefaultSize, 0 )
557 self.m_staticText10111.Wrap( -1 )
558 fgSizer51.Add( self.m_staticText10111, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
560 bSizer711 = wx.BoxSizer( wx.HORIZONTAL )
562 self.check3 = wx.CheckBox( self.m_panel3, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
563 bSizer711.Add( self.check3, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
565 fgSizer711 = wx.FlexGridSizer( 0, 2, 0, 0 )
566 fgSizer711.SetFlexibleDirection( wx.BOTH )
567 fgSizer711.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
569 self.m_staticText1111 = wx.StaticText( self.m_panel3, wx.ID_ANY, "min", wx.DefaultPosition, wx.DefaultSize, 0 )
570 self.m_staticText1111.Wrap( -1 )
571 fgSizer711.Add( self.m_staticText1111, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
573 self.spin_temin = wx.SpinCtrl( self.m_panel3, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 0, 100, 0 )
574 fgSizer711.Add( self.spin_temin, 0, wx.ALL, 5 )
576 self.m_staticText1211 = wx.StaticText( self.m_panel3, wx.ID_ANY, "max", wx.DefaultPosition, wx.DefaultSize, 0 )
577 self.m_staticText1211.Wrap( -1 )
578 fgSizer711.Add( self.m_staticText1211, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
580 self.spin_temax = wx.SpinCtrl( self.m_panel3, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 0, 100, 0 )
581 fgSizer711.Add( self.spin_temax, 0, wx.ALL, 5 )
584 bSizer711.Add( fgSizer711, 1, wx.EXPAND, 5 )
587 fgSizer51.Add( bSizer711, 1, wx.EXPAND, 5 )
589 self.m_staticline33 = wx.StaticLine( self.m_panel3, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
590 fgSizer51.Add( self.m_staticline33, 0, wx.EXPAND, 5 )
592 self.m_staticline34 = wx.StaticLine( self.m_panel3, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
593 fgSizer51.Add( self.m_staticline34, 0, wx.EXPAND, 5 )
595 self.m_staticText28 = wx.StaticText( self.m_panel3, wx.ID_ANY, _("Gray scale on text proportional to frequency (0=black, 1=white)"), wx.DefaultPosition, wx.DefaultSize, 0 )
596 self.m_staticText28.Wrap( -1 )
597 fgSizer51.Add( self.m_staticText28, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
599 bSizer10 = wx.BoxSizer( wx.HORIZONTAL )
601 self.m_checkBox14 = wx.CheckBox( self.m_panel3, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
602 bSizer10.Add( self.m_checkBox14, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
604 bSizer11 = wx.BoxSizer( wx.VERTICAL )
606 bSizer12 = wx.BoxSizer( wx.HORIZONTAL )
608 self.m_staticText31 = wx.StaticText( self.m_panel3, wx.ID_ANY, "min", wx.DefaultPosition, wx.DefaultSize, 0 )
609 self.m_staticText31.Wrap( -1 )
610 bSizer12.Add( self.m_staticText31, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
612 self.m_spinCtrl14 = wx.SpinCtrl( self.m_panel3, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 0, 100, 0 )
613 bSizer12.Add( self.m_spinCtrl14, 0, wx.ALL, 5 )
616 bSizer11.Add( bSizer12, 1, wx.EXPAND, 5 )
618 bSizer13 = wx.BoxSizer( wx.HORIZONTAL )
620 self.m_staticText32 = wx.StaticText( self.m_panel3, wx.ID_ANY, "max", wx.DefaultPosition, wx.DefaultSize, 0 )
621 self.m_staticText32.Wrap( -1 )
622 bSizer13.Add( self.m_staticText32, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
624 self.m_spinCtrl15 = wx.SpinCtrl( self.m_panel3, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 0, 100, 10 )
625 bSizer13.Add( self.m_spinCtrl15, 0, wx.ALL, 5 )
628 bSizer11.Add( bSizer13, 1, wx.EXPAND, 5 )
631 bSizer10.Add( bSizer11, 1, wx.EXPAND, 5 )
634 fgSizer51.Add( bSizer10, 1, wx.ALIGN_CENTER_VERTICAL|wx.EXPAND, 5 )
636 self.m_staticline3311 = wx.StaticLine( self.m_panel3, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
637 fgSizer51.Add( self.m_staticline3311, 0, wx.EXPAND |wx.ALL, 5 )
639 self.m_staticline33111 = wx.StaticLine( self.m_panel3, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
640 fgSizer51.Add( self.m_staticline33111, 0, wx.EXPAND |wx.ALL, 5 )
642 bSizer5 = wx.BoxSizer( wx.HORIZONTAL )
644 self.m_staticText21 = wx.StaticText( self.m_panel3, wx.ID_ANY, _("Vertex color"), wx.DefaultPosition, wx.DefaultSize, 0 )
645 self.m_staticText21.Wrap( -1 )
646 bSizer5.Add( self.m_staticText21, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
648 self.cols = wx.ColourPickerCtrl( self.m_panel3, wx.ID_ANY, wx.Colour( 255, 0, 0 ), wx.DefaultPosition, wx.DefaultSize, wx.CLRP_DEFAULT_STYLE )
649 bSizer5.Add( self.cols, 0, wx.ALL, 5 )
652 fgSizer51.Add( bSizer5, 1, wx.EXPAND, 5 )
654 bSizer6 = wx.BoxSizer( wx.HORIZONTAL )
656 self.m_staticText22 = wx.StaticText( self.m_panel3, wx.ID_ANY, _("Edges color"), wx.DefaultPosition, wx.DefaultSize, 0 )
657 self.m_staticText22.Wrap( -1 )
658 bSizer6.Add( self.m_staticText22, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
660 self.cola = wx.ColourPickerCtrl( self.m_panel3, wx.ID_ANY, wx.Colour( 208, 208, 208 ), wx.DefaultPosition, wx.DefaultSize, wx.CLRP_DEFAULT_STYLE )
661 bSizer6.Add( self.cola, 0, wx.ALL, 5 )
664 fgSizer51.Add( bSizer6, 1, wx.EXPAND, 5 )
666 self.m_staticline331 = wx.StaticLine( self.m_panel3, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
667 fgSizer51.Add( self.m_staticline331, 0, wx.EXPAND, 5 )
669 self.m_staticline332 = wx.StaticLine( self.m_panel3, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
670 fgSizer51.Add( self.m_staticline332, 0, wx.EXPAND, 5 )
672 self.m_staticText23 = wx.StaticText( self.m_panel3, wx.ID_ANY, _("Vertex size"), wx.DefaultPosition, wx.DefaultSize, 0 )
673 self.m_staticText23.Wrap( -1 )
674 fgSizer51.Add( self.m_staticText23, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
676 bSizer72 = wx.BoxSizer( wx.HORIZONTAL )
678 self.check_s_size = wx.CheckBox( self.m_panel3, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
679 bSizer72.Add( self.check_s_size, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
681 self.spin_tv = wx.SpinCtrl( self.m_panel3, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 0, 100, 10 )
682 bSizer72.Add( self.spin_tv, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
685 fgSizer51.Add( bSizer72, 1, wx.EXPAND, 5 )
687 self.m_staticline333 = wx.StaticLine( self.m_panel3, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
688 fgSizer51.Add( self.m_staticline333, 0, wx.EXPAND, 5 )
690 self.m_staticline334 = wx.StaticLine( self.m_panel3, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
691 fgSizer51.Add( self.m_staticline334, 0, wx.EXPAND, 5 )
693 self.m_staticText24 = wx.StaticText( self.m_panel3, wx.ID_ANY, _("Spheres transparency"), wx.DefaultPosition, wx.DefaultSize, 0 )
694 self.m_staticText24.Wrap( -1 )
695 fgSizer51.Add( self.m_staticText24, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
697 self.slider_sphere = wx.Slider( self.m_panel3, wx.ID_ANY, 10, 0, 100, wx.DefaultPosition, wx.DefaultSize, wx.SL_HORIZONTAL|wx.SL_LABELS )
698 fgSizer51.Add( self.slider_sphere, 0, wx.ALL|wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 5 )
700 self.m_staticline335 = wx.StaticLine( self.m_panel3, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
701 fgSizer51.Add( self.m_staticline335, 0, wx.EXPAND, 5 )
703 self.m_staticline336 = wx.StaticLine( self.m_panel3, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
704 fgSizer51.Add( self.m_staticline336, 0, wx.EXPAND, 5 )
706 self.m_staticText25 = wx.StaticText( self.m_panel3, wx.ID_ANY, _("Make a movie"), wx.DefaultPosition, wx.DefaultSize, 0 )
707 self.m_staticText25.Wrap( -1 )
708 fgSizer51.Add( self.m_staticText25, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
710 self.film = wx.CheckBox( self.m_panel3, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
711 fgSizer51.Add( self.film, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
713 self.m_staticline2918 = wx.StaticLine( self.m_panel3, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
714 fgSizer51.Add( self.m_staticline2918, 0, wx.EXPAND, 5 )
716 self.m_staticline2919 = wx.StaticLine( self.m_panel3, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
717 fgSizer51.Add( self.m_staticline2919, 0, wx.EXPAND, 5 )
720 fgSizer51.AddStretchSpacer(wx.EXPAND)
723 fgSizer5.Add( fgSizer51, 1, wx.EXPAND, 5 )
726 self.m_panel3.SetSizer( fgSizer5 )
727 self.m_panel3.Layout()
728 fgSizer5.Fit( self.m_panel3 )
729 self.m_notebook1.AddPage( self.m_panel3, _("Graphical settings"), False )
731 fgSizer10.Add( self.m_notebook1, 1, wx.EXPAND |wx.ALL, 5 )
733 m_sdbSizer2 = wx.StdDialogButtonSizer()
734 self.m_sdbSizer2OK = wx.Button( self, wx.ID_OK )
735 m_sdbSizer2.AddButton( self.m_sdbSizer2OK )
736 self.m_sdbSizer2Cancel = wx.Button( self, wx.ID_CANCEL )
737 m_sdbSizer2.AddButton( self.m_sdbSizer2Cancel )
738 m_sdbSizer2.Realize();
740 fgSizer10.Add( m_sdbSizer2, 1, wx.EXPAND, 5 )
743 bSizer16.Add( fgSizer10, 1, wx.EXPAND, 5 )
746 self.SetSizer( bSizer16 )
750 self.Centre( wx.BOTH )
751 self.__set_properties()
754 if not self.paramsimi['first'] :
755 self.check_coord.Bind( wx.EVT_CHECKBOX, self.OnKeepCoords )
756 self.choice3.Bind( wx.EVT_CHOICE, self.OnChangeType )
757 self.check2.Bind( wx.EVT_CHECKBOX, self.OnCheck2 )
758 if 'cexfromchi' in self.paramsimi :
759 self.checkit.Bind( wx.EVT_CHECKBOX, self.OnCheckit )
760 if 'sfromchi' in self.paramsimi :
761 self.checki.Bind( wx.EVT_CHECKBOX, self.OnChecki )
762 self.check_vcex.Bind( wx.EVT_CHECKBOX, self.OnCheck_vcex )
763 self.check_s_size.Bind( wx.EVT_CHECKBOX, self.OnCheck_s_size )
764 self.listcol.Bind( wx.EVT_LIST_ITEM_SELECTED, self.ChangeCount)
765 self.listcol.Bind( wx.EVT_LIST_ITEM_DESELECTED, self.ChangeCount)
766 self.butcount.Bind( wx.EVT_BUTTON, self.ChangeCount)
767 self.ChangeCount(wx.EVT_BUTTON)
770 def __set_properties(self):
771 self.choice1.SetSelection(self.paramsimi['coeff'])
772 self.choice2.SetSelection(self.paramsimi['layout'])
773 self.choice3.SetSelection(self.paramsimi['type_graph'])
774 if self.paramsimi['type_graph'] not in [2,3] :
775 self.film.Enable(False)
776 self.slider_sphere.Enable(False)
778 self.film.Enable(True)
779 self.slider_sphere.Enable(True)
780 self.check1.SetValue(self.paramsimi['arbremax'])
781 self.check_vlab.SetValue(self.paramsimi['label_v'])
782 self.check_elab.SetValue(self.paramsimi['label_e'])
783 self.check2.SetValue(self.paramsimi['tvprop'])
784 self.spin_tv.SetValue(self.paramsimi['coeff_tv_nb'])
785 self.check_s_size.SetValue(self.paramsimi['coeff_tv'])
786 self.spin_tvmin.SetValue(self.paramsimi['tvmin'])
787 self.spin_tvmax.SetValue(self.paramsimi['tvmax'])
788 self.check3.SetValue(self.paramsimi['coeff_te'])
789 self.spin_temin.SetValue(self.paramsimi['coeff_temin'])
790 self.spin_temax.SetValue(self.paramsimi['coeff_temax'])
791 self.check_vcex.SetValue(self.paramsimi['vcex'])
792 self.spin_vcexmin.SetValue(self.paramsimi['vcexmin'])
793 self.spin_vcexmax.SetValue(self.paramsimi['vcexmax'])
794 self.spin_cex.SetValue(self.paramsimi['cex'])
795 self.check_seuil.SetValue(self.paramsimi['seuil_ok'])
796 self.spin_seuil.SetValue(self.paramsimi['seuil'])
797 self.cols.SetColour(self.paramsimi['cols'])
798 self.cola.SetColour(self.paramsimi['cola'])
799 self.spin_width.SetValue(self.paramsimi['width'])
800 self.spin_height.SetValue(self.paramsimi['height'])
801 if 'cexfromchi' in self.paramsimi :
802 self.checkit.SetValue(self.paramsimi['cexfromchi'])
803 if 'sfromchi' in self.paramsimi :
804 self.checki.SetValue(self.paramsimi['sfromchi'])
805 if not self.paramsimi['first'] :
806 self.check_coord.SetValue(self.paramsimi['keep_coord'])
807 self.OnKeepCoords(wx.EVT_CHECKBOX)
808 if self.paramsimi.get('bystar', False) :
809 self.check_bystar.SetValue(True)
810 self.stars = self.paramsimi['stars']
811 self.slider_sphere.SetValue(self.paramsimi['alpha'])
812 self.film.SetValue(self.paramsimi['film'])
813 self.comcheck.SetValue(self.paramsimi['com'])
814 self.choix_com.SetSelection(self.paramsimi['communities'])
815 self.halo.SetValue(self.paramsimi['halo'])
816 self.check_curved.SetValue(self.paramsimi.get('edgecurved', True))
817 if self.paramsimi.get('word', False) and self.paramsimi['first'] :
818 self.choice2.SetSelection(5)
820 def ChangeCount(self, evt) :
821 self.textcount.SetValue('%i' % self.listcol.GetSelectedItemCount())
823 def OnCheck_s_size(self, evt):
824 if self.check_s_size.GetValue() :
825 if 'cexfromchi' in self.paramsimi :
826 self.checki.SetValue(False)
827 self.check2.SetValue(False)
828 self.spin_tvmin.Enable(False)
829 self.spin_tvmax.Enable(False)
830 self.spin_tv.Enable(True)
832 self.check2.SetValue(True)
833 self.spin_tvmin.Enable(True)
834 self.spin_tvmax.Enable(True)
835 self.spin_tv.Enable(False)
837 def OnCheck2(self, evt):
838 if self.check2.GetValue():
839 self.check_s_size.SetValue(False)
840 if 'cexfromchi' in self.paramsimi :
841 self.checki.SetValue(False)
842 self.spin_tvmin.Enable(True)
843 self.spin_tvmax.Enable(True)
844 self.spin_tv.Enable(False)
846 self.check_s_size.SetValue(True)
847 self.spin_tvmin.Enable(False)
848 self.spin_tvmax.Enable(False)
849 self.spin_tv.Enable(True)
851 def OnChecki(self, evt):
852 if 'sfromchi' in self.paramsimi :
853 if self.checki.GetValue() :
854 self.check_s_size.SetValue(False)
855 self.check2.SetValue(False)
856 self.spin_tvmin.Enable(True)
857 self.spin_tvmax.Enable(True)
858 self.spin_tv.Enable(False)
860 self.check_s_size.SetValue(True)
861 #self.check2.SetValue(True)
862 self.spin_tvmin.Enable(False)
863 self.spin_tvmax.Enable(False)
864 self.spin_tv.Enable(True)
866 def OnCheckit(self,evt) :
867 if 'cexfromchi' in self.paramsimi :
868 if self.checkit.GetValue() :
869 if self.check_vcex.GetValue() :
870 self.check_vcex.SetValue(False)
872 def OnCheck_vcex(self, evt):
873 if self.check_vcex.GetValue() :
874 if 'checkit' in dir(self) :
875 if self.checkit.GetValue() :
876 self.checkit.SetValue(False)
878 def OnChangeType(self, event) :
879 if event.GetInt() != 1 :
880 self.spin_width.Enable(False)
881 self.spin_height.Enable(False)
883 self.spin_width.Enable(True)
884 self.spin_height.Enable(True)
885 if event.GetInt() not in [2,3] :
886 self.film.Enable(False)
887 self.slider_sphere.Enable(False)
889 self.film.Enable(True)
890 self.slider_sphere.Enable(True)
892 def OnKeepCoords(self, event):
893 if self.check_coord.GetValue() :
894 self.choice1.SetSelection(self.paramsimi['coeff'])
895 self.choice2.SetSelection(self.paramsimi['layout'])
896 self.check_seuil.SetValue(self.paramsimi['seuil_ok'])
897 self.spin_seuil.SetValue(self.paramsimi['seuil'])
898 self.choice1.Disable()
899 self.choice2.Disable()
900 self.check_seuil.Disable()
901 self.spin_seuil.Disable()
902 #self.check_colch.SetValue(False)
903 #self.check_colch.Disable()
905 self.choice1.Enable(True)
906 self.choice2.Enable(True)
907 self.check_seuil.Enable(True)
908 self.spin_seuil.Enable(True)
909 #self.check_colch.Enable(True)
913 def __init__(self, parent, source, parametres, pathout, actives, indices_simi, wordlist = None, selected = None) :
914 self.parametres = parametres
916 self.dial = PrefSimi(parent, -1, self.parametres, indices_simi, wordlist = wordlist, selected = selected, actives = actives)
917 self.dial.CenterOnParent()
918 self.val = self.dial.ShowModal()
919 if self.val == wx.ID_OK :
920 if 'bystar' in self.parametres :
921 if self.dial.check_bystar.GetValue() :
922 variables = treat_var_mod(self.parametres['stars'])
923 vardial = OptLexi(parent, force_chi = True)
924 vardial.listet = self.parametres['stars']
925 vardial.variables = [v for v in variables]
926 for et in vardial.variables :
927 vardial.list_box_1.Append(et)
928 nval = vardial.ShowModal()
929 if nval == wx.ID_OK :
930 if vardial.choice.GetSelection() == 1 :
931 listet = [vardial.listet[i] for i in vardial.list_box_1.GetSelections()]
933 listet = variables[vardial.variables[vardial.list_box_1.GetSelections()[0]]]
936 self.etline = source.corpus.make_etline(listet)
937 self.parametres['selectedstars'] = listet
938 self.parametres['listet'] = self.etline
944 last = self.dial.listcol.GetFirstSelected()
945 lastl = [self.dial.listcol.GetFirstSelected()]
946 indexes = [self.dial.listcol.getColumnText(self.dial.listcol.GetFirstSelected(),0)]
947 while self.dial.listcol.GetNextSelected(last) != -1:
948 last = self.dial.listcol.GetNextSelected(last)
950 indexes.append(self.dial.listcol.getColumnText(last,0))
951 column = [actives.index(val) for val in indexes]
953 with open(pathout, 'w', encoding='utf8') as f :
954 f.write('\n'.join([repr(val) for val in column]))
960 def make_param(self) :
961 #self.select = self.dial.check_colch.GetValue()
962 if self.parametres.get('first', True) :
965 keep_coord = self.dial.check_coord.GetValue()
966 param = {'coeff' : self.dial.choice1.GetSelection(),
967 'layout' : self.dial.choice2.GetSelection(),
968 'type_graph' : self.dial.choice3.GetSelection(),
969 'arbremax' : self.dial.check1.GetValue(),
970 'coeff_tv' : self.dial.check_s_size.GetValue(),
971 'coeff_tv_nb' : self.dial.spin_tv.GetValue(),
972 'tvprop' : self.dial.check2.GetValue(),
973 'tvmin' : self.dial.spin_tvmin.GetValue(),
974 'tvmax' : self.dial.spin_tvmax.GetValue(),
975 'coeff_te' : self.dial.check3.GetValue(),
976 'coeff_temin' : self.dial.spin_temin.GetValue(),
977 'coeff_temax' : self.dial.spin_temax.GetValue(),
978 'label_e' : self.dial.check_elab.GetValue(),
979 'label_v' : self.dial.check_vlab.GetValue(),
980 'vcex' : self.dial.check_vcex.GetValue(),
981 'vcexmin' : self.dial.spin_vcexmin.GetValue(),
982 'vcexmax' : self.dial.spin_vcexmax.GetValue(),
983 'cex' : self.dial.spin_cex.GetValue(),
984 'seuil_ok' : self.dial.check_seuil.GetValue(),
985 'seuil' : self.dial.spin_seuil.GetValue(),
986 'cols' : self.dial.cols.GetColour(),
987 'cola' : self.dial.cola.GetColour(),
988 'width' : self.dial.spin_width.GetValue(),
989 'height' : self.dial.spin_height.GetValue(),
991 'keep_coord' : keep_coord,
992 'alpha' : self.dial.slider_sphere.GetValue(),
993 'film' : self.dial.film.GetValue(),
994 'svg' : self.dial.choix_format.GetSelection(),
995 'com' :self.dial.comcheck.GetValue(),
996 'communities' : self.dial.choix_com.GetSelection(),
997 'halo' : self.dial.halo.GetValue(),
998 'edgecurved' : self.dial.check_curved.GetValue(),
1000 if 'cexfromchi' in self.parametres :
1001 param['cexfromchi'] = self.dial.checkit.GetValue()
1002 if 'sfromchi' in self.parametres :
1003 param['sfromchi'] = self.dial.checki.GetValue()
1004 if 'vlabcolor' in self.parametres :
1005 param['vlabcolor'] = self.parametres['vlabcolor']
1006 if 'check_bystar' in dir(self.dial) :
1007 param['bystar'] = self.dial.check_bystar.GetValue()
1008 param['stars'] = self.parametres.get('stars', 0)
1009 self.parametres.update(param)
1011 class CreateTgenDialog ( wx.Frame ):
1013 def __init__( self, parent, lemlist, tgen = None, tgens = None ):
1014 wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = _('Tgen Creator'), pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.DEFAULT_FRAME_STYLE|wx.TAB_TRAVERSAL|wx.FRAME_FLOAT_ON_PARENT|wx.STAY_ON_TOP )
1015 self.ira = wx.GetApp().GetTopWindow()
1016 self.SetIcon(self.ira._icon)
1019 self.parent = parent
1021 self.SetSizeHints( wx.DefaultSize, wx.DefaultSize )
1023 bSizer2 = wx.BoxSizer( wx.VERTICAL )
1025 namepan = wx.Panel(self, -1)
1027 fgSizer3 = wx.FlexGridSizer( 0, 2, 0, 0 )
1028 fgSizer3.SetFlexibleDirection( wx.BOTH )
1029 fgSizer3.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
1031 self.m_staticText3 = wx.StaticText( namepan, wx.ID_ANY, _("Name"), wx.DefaultPosition, wx.DefaultSize, 0 )
1032 self.m_staticText3.Wrap( -1 )
1034 fgSizer3.Add( self.m_staticText3, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
1036 self.m_textCtrl1 = wx.TextCtrl( namepan, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
1037 self.m_textCtrl1.SetMinSize( wx.Size( 250,-1 ) )
1039 fgSizer3.Add( self.m_textCtrl1, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1041 namepan.SetSizer( fgSizer3 )
1043 bSizer2.Add( namepan, 1, wx.EXPAND, 5 )
1045 self.ip = VItemsPicker(self,-1, lemlist, _('Forms'), _('Selection'))
1046 self.ip._source.SetMinSize( wx.Size( 350, 400 ) )
1048 bSizer2.Add( self.ip, 0, wx.ALL, 5 )
1050 butpanel = wx.Panel(self, -1)
1052 m_sdbSizer3 = wx.StdDialogButtonSizer()
1053 self.m_sdbSizer3OK = wx.Button( butpanel, wx.ID_OK )
1054 m_sdbSizer3.AddButton( self.m_sdbSizer3OK )
1055 self.m_sdbSizer3Cancel = wx.Button( butpanel, wx.ID_CANCEL )
1056 m_sdbSizer3.AddButton( self.m_sdbSizer3Cancel )
1057 m_sdbSizer3.Realize();
1059 butpanel.SetSizer( m_sdbSizer3 )
1061 bSizer2.Add( butpanel, 1, wx.EXPAND, 5 )
1064 self.SetSizer( bSizer2 )
1068 self.Centre( wx.BOTH )
1070 self.m_textCtrl1.Bind( wx.EVT_TEXT, self.OnTextEnter )
1071 self.ip.Bind(EVT_IP_SELECTION_CHANGED, self.OnSelectionChange)
1072 self.m_sdbSizer3OK.Bind(wx.EVT_BUTTON, self.OnClose)
1073 self.m_sdbSizer3Cancel.Bind(wx.EVT_BUTTON, self.OnCancel)
1075 #self.ip.SetItems(lemlist)
1076 self.m_sdbSizer3OK.Enable(False)
1078 if tgen is not None :
1079 self.m_textCtrl1.SetValue(tgen)
1080 self.ip._destData = dict([[i,[word,'']] for i, word in enumerate(tgens[tgen])])
1081 self.ip._SetDestItems()
1082 #self.ip.SetSelections(tgens[tgen])
1083 self.m_sdbSizer3OK.Enable(True)
1088 def __del__( self ):
1091 def OnTextEnter(self, evt):
1092 if self.m_textCtrl1.GetValue() != '' and self.m_textCtrl1.GetValue() not in self.tgens and self.ip.GetSelections() != []:
1093 self.m_sdbSizer3OK.Enable(True)
1095 self.m_sdbSizer3OK.Enable(False)
1096 if self.m_textCtrl1.GetValue() != '' and self.ip.GetSelections() and self.edit:
1097 self.m_sdbSizer3OK.Enable(True)
1099 def OnSelectionChange(self, evt):
1100 if self.ip.GetSelections() != [] and self.m_textCtrl1.GetValue() != '' and self.m_textCtrl1.GetValue() not in self.tgens :
1101 self.m_sdbSizer3OK.Enable(True)
1103 self.m_sdbSizer3OK.Enable(False)
1104 if self.m_textCtrl1.GetValue() != '' and self.ip.GetSelections() and self.edit:
1105 self.m_sdbSizer3OK.Enable(True)
1107 def OnClose(self, evt):
1110 def OnCancel(self, evt):
1113 class TGenFrame ( wx.Frame ):
1115 def __init__( self, parent, corpus, Tgen ):
1116 wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = "Tgen", pos = wx.DefaultPosition, size = wx.Size( -1, -1 ), style = wx.CLOSE_BOX|wx.DEFAULT_FRAME_STYLE|wx.TAB_TRAVERSAL|wx.STAY_ON_TOP )
1117 self.ira = wx.GetApp().GetTopWindow()
1118 self.SetIcon(self.ira._icon)
1120 self.parent = parent
1121 self.corpus = corpus
1122 self.activetgen = None
1123 self.panel = wx.Panel(self, wx.ID_ANY)
1125 #self.SetSizeHints( wx.DefaultSize, wx.DefaultSize )
1127 panelsizer = wx.BoxSizer( wx.VERTICAL )
1129 bSizer1 = wx.BoxSizer( wx.VERTICAL )
1131 fgSizer1 = wx.FlexGridSizer( 0, 2, 0, 0 )
1132 fgSizer1.SetFlexibleDirection( wx.BOTH )
1133 fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
1135 self.m_staticText1 = wx.StaticText( self.panel, wx.ID_ANY, "Tgen", wx.DefaultPosition, wx.DefaultSize, 0 )
1136 self.m_staticText1.Wrap( -1 )
1137 fgSizer1.Add( self.m_staticText1, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1139 self.m_staticText2 = wx.StaticText( self.panel, wx.ID_ANY, _("Content"), wx.DefaultPosition, wx.DefaultSize, 0 )
1140 self.m_staticText2.Wrap( -1 )
1141 fgSizer1.Add( self.m_staticText2, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1143 tgensChoices = list(Tgen.tgen.keys())
1144 self.tgens = wx.ListBox( self.panel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, tgensChoices, 0 )
1145 self.tgens.SetMinSize( wx.Size( 250,350 ) )
1147 fgSizer1.Add( self.tgens, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1149 tgencontentChoices = []
1150 self.tgencontent = wx.ListBox( self.panel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, tgencontentChoices, 0|wx.VSCROLL )
1151 self.tgencontent.SetMinSize( wx.Size( 250,350 ) )
1153 fgSizer1.Add( self.tgencontent, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1155 fgSizer2 = wx.FlexGridSizer( 0, 2, 0, 0 )
1156 fgSizer2.SetFlexibleDirection( wx.BOTH )
1157 fgSizer2.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
1159 self.but_new = wx.Button( self.panel, wx.ID_ANY, _("New..."), wx.DefaultPosition, wx.DefaultSize, 0 )
1160 fgSizer2.Add( self.but_new, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1162 self.but_del = wx.Button( self.panel, wx.ID_ANY, _("Delete"), wx.DefaultPosition, wx.DefaultSize, 0 )
1163 fgSizer2.Add( self.but_del, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1166 fgSizer1.Add( fgSizer2, 0, wx.EXPAND, 0 )
1168 fgSizer3 = wx.FlexGridSizer( 0, 2, 0, 0 )
1169 fgSizer3.SetFlexibleDirection( wx.BOTH )
1170 fgSizer3.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
1171 self.but_edit = wx.Button( self.panel, wx.ID_ANY, _("Edit"), wx.DefaultPosition, wx.DefaultSize, 0 )
1172 fgSizer3.Add( self.but_edit, 1, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1174 self.but_compute = wx.Button( self.panel, wx.ID_ANY, _("Compute"), wx.DefaultPosition, wx.DefaultSize, 0 )
1175 fgSizer3.Add( self.but_compute, 1, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1177 fgSizer1.Add( fgSizer3, 0, wx.EXPAND, 0 )
1179 bSizer1.Add( fgSizer1, 1, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1182 m_sdbSizer2 = wx.StdDialogButtonSizer()
1183 self.m_sdbSizer2OK = wx.Button( self.panel, wx.ID_OK )
1184 m_sdbSizer2.AddButton( self.m_sdbSizer2OK )
1185 #self.m_sdbSizer2Cancel = wx.Button( self, wx.ID_CANCEL )
1186 #m_sdbSizer2.AddButton( self.m_sdbSizer2Cancel )
1187 m_sdbSizer2.Realize();
1189 bSizer1.Add( m_sdbSizer2, 0, wx.EXPAND, 5 )
1191 #panelsizer.Add(bSizer1, 0, wx.EXPAND, 5 )
1193 #panel.SetSizer( panelsizer )
1194 self.panel.SetSizer( bSizer1 )
1198 self.Centre( wx.BOTH )
1201 self.tgens.Bind( wx.EVT_LISTBOX, self.GetContent )
1202 self.but_new.Bind( wx.EVT_BUTTON, self.OnNewTgen )
1203 self.but_del.Bind( wx.EVT_BUTTON, self.OnDeleteTgen )
1204 self.but_edit.Bind( wx.EVT_BUTTON, self.OnEditTgen )
1205 self.but_compute.Bind(wx.EVT_BUTTON, self.OnCompute)
1206 self.m_sdbSizer2OK.Bind( wx.EVT_BUTTON, self.OnOK )
1208 def __del__( self ):
1211 def GetContent( self, event ):
1212 tgen = event.GetString()
1214 self.tgencontent.Clear()
1215 for word in self.Tgen[tgen] :
1216 self.tgencontent.Append(word)
1218 def OnNewTgen( self, event, tgen = None ):
1220 self.dial = CreateTgenDialog(self, dict([[i, [lem, self.corpus.lems[lem].freq, self.corpus.lems[lem].gram]] for i, lem in enumerate(self.corpus.lems.keys())]), tgens = self.Tgen.tgen)
1222 self.dial = CreateTgenDialog(self, dict([[i, [lem, self.corpus.lems[lem].freq, self.corpus.lems[lem].gram]] for i, lem in enumerate(self.corpus.lems.keys())]), tgen = tgen, tgens = self.Tgen.tgen)
1223 self.dial.ip._source.selected = dict(list(zip(self.Tgen.tgen[tgen], self.Tgen.tgen[tgen])))
1224 self.activetgen = tgen
1226 self.dial.Bind(wx.EVT_CLOSE, self.OnDialClose)
1228 def OnDeleteTgen( self, event ):
1229 if self.tgens.GetSelection() != -1 :
1230 tgens = self.tgens.GetItems()
1231 del self.Tgen.tgen[tgens[self.tgens.GetSelection()]]
1234 self.tgencontent.Clear()
1235 for val in self.Tgen.tgen :
1236 self.tgens.Append(val)
1239 def OnEditTgen( self, event ):
1240 if self.tgens.GetSelection() != -1 :
1241 tgens = self.tgens.GetItems()
1242 tgen = tgens[self.tgens.GetSelection()]
1243 self.activetgen = tgen
1244 self.dial = CreateTgenDialog(self, dict([[i, [lem, self.corpus.lems[lem].freq, self.corpus.lems[lem].gram]] for i, lem in enumerate(self.corpus.lems.keys())]), tgen = tgen, tgens = self.Tgen.tgen)
1245 self.dial.Bind(wx.EVT_CLOSE, self.OnDialClose)
1246 self.dial.m_textCtrl1.Enable(False)
1247 self.dial.ip._source.selected = dict(list(zip(self.Tgen.tgen[tgen], self.Tgen.tgen[tgen])))
1251 def OnCompute(self, evt):
1252 ira = wx.GetApp().GetTopWindow()
1253 ira.tree.OnTgenCompute(evt)
1255 def OnOK(self, evt):
1258 def OnDialClose(self, evt):
1260 del self.Tgen.tgen[self.activetgen]
1262 self.tgencontent.Clear()
1263 for val in self.Tgen.tgen :
1264 self.tgens.Append(val)
1265 self.Tgen.tgen[self.dial.m_textCtrl1.GetValue()] = self.dial.ip.GetSelections()
1267 self.tgens.Append(self.dial.m_textCtrl1.GetValue())
1271 class ExportMetaTable :
1272 def __init__(self, parent, corpus):
1274 dial = PrefSimpleFile(self, self.ira, **{'mask' : '*.csv', 'title': _("metadata table")})
1275 dial.fbb.SetValue(corpus.pathout['metadata.csv'])
1276 dial.CenterOnParent()
1277 res = dial.ShowModal()
1278 if res == wx.ID_OK :
1279 fileout = dial.fbb.GetValue()
1281 corpus.export_meta_table(fileout)
1282 dlg = wx.MessageDialog(self.ira, _("Done !"), _("Export metadata"), wx.OK | wx.ICON_INFORMATION)
1283 dlg.CenterOnParent()
1290 def redosimi(self, evt) :
1291 with open(self.pathout['selected.csv'],'r', encoding='utf8') as f :
1293 selected = [int(val) for val in selected.splitlines()]
1294 if self.actives is None :
1295 with open(self.pathout['actives.csv'], 'r', encoding='utf8') as f :
1296 self.actives = f.read()
1297 self.actives = self.actives.splitlines()#[act for act in self.actives.splitlines()]
1298 if os.path.exists(self.pathout['actives_nb.csv']) :
1299 with open(self.pathout['actives_nb.csv'], 'r', encoding='utf8') as f :
1301 act_nb = act_nb.splitlines()
1302 dictcol = dict([[i, [self.actives[i], int(act_nb[i])]] for i, val in enumerate(self.actives)])
1304 dictcol = dict([[i, [act, self.corpus.getlemeff(act)]] for i, act in enumerate(self.actives)])
1305 #res = SelectColumn(self.ira, dictcol, self.actives, self.pathout['selected.csv'], selected = selected, dlg = True)
1307 if evt is not None :
1308 prep = PrepSimi(self.ira, self, self.parametres,self.pathout['selected.csv'], self.actives, indices_simi, wordlist = dictcol, selected = selected)
1310 class EmptyBase(object): pass
1313 prep.parametres = self.parametres
1314 order_actives = [[i, act, self.corpus.getlemeff(act)] for i, act in enumerate(self.actives)]
1315 order_actives = sorted(order_actives, key=itemgetter(2), reverse = True)
1316 with open(self.pathout['selected.csv'], 'w', encoding='utf8') as f :
1317 f.write('\n'.join([repr(order_actives[val][0]) for val in self.parametres['selected']]))
1318 if prep.val == wx.ID_OK or evt is None:
1319 self.parametres = prep.parametres
1321 script = PrintSimiScript(self)
1322 script.make_script()
1323 pid = exec_rcode(self.ira.RPath, script.scriptout, wait = True)
1324 check_Rresult(self.ira, pid)
1325 if self.parametres['type_graph'] in [1,3] :
1326 if self.parametres['svg'] :
1327 filename, ext = os.path.splitext(script.filename)
1328 fileout = filename + '.svg'
1329 elif self.parametres['type_graph'] == 3 :
1330 fileout = script.filename
1331 parametres = {'gexffile' : fileout,
1332 'dirout' : os.path.dirname(fileout),
1333 'titre': 'Le titre',
1334 #'nodemin': self.param['txt_min'],
1335 #'nodemax': self.param['txt_max'],
1336 #'bargraphw' : 60*int(self.param['clnb']),
1338 web = WebExport(self.ira, parametres)
1339 fileout = web.exportsimi()
1341 fileout = script.filename
1342 if os.path.exists(self.pathout['liste_graph']):
1343 graph_simi = read_list_file(self.pathout['liste_graph'])
1344 graph_simi.append([os.path.basename(fileout), script.txtgraph])
1346 graph_simi = [[os.path.basename(fileout), script.txtgraph]]
1347 self.fileout = fileout
1348 print_liste(self.pathout['liste_graph'], graph_simi)
1349 DoConf().makeoptions([self.parametres['type']], [self.parametres], self.pathout['Analyse.ira'])
1350 if evt is not None :
1351 if self.parametres['type_graph'] in [1,3] :
1352 if self.parametres['svg'] or self.parametres['type_graph'] == 3 :
1353 self.graphpan.sizer_3.Add(hl.HyperLinkCtrl(self.graphpan.panel_1, -1, fileout, URL = fileout), 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
1355 self.graphpan.sizer_3.Add(wx.StaticBitmap(self.graphpan.panel_1, -1, wx.Bitmap(fileout, wx.BITMAP_TYPE_ANY)), 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
1356 self.graphpan.sizer_3.Add(wx.StaticText(self.graphpan.panel_1,-1, script.txtgraph), 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
1357 self.graphpan.sizer_3.Fit(self.graphpan.panel_1)
1358 self.graphpan.Layout()
1359 self.graphpan.panel_1.Scroll(0,self.graphpan.panel_1.GetScrollRange(wx.VERTICAL))