proto
[iramuteq] / guifunct.py
1 # -*- coding: utf-8 -*-
2 #Author: Pierre Ratinaud
3 #Copyright (c) 2008-2011 Pierre Ratinaud
4 #License: GNU/GPL
5
6 import wx
7 import os
8 import sys
9 from copy import copy
10 import dialog
11 from listlex import *
12 from vitemspicker import VItemsPicker, EVT_IP_SELECTION_CHANGED, IP_SORT_CHOICES, IP_SORT_SELECTED, IP_REMOVE_FROM_CHOICES
13 from functions import treat_var_mod
14
15
16 def OnOpen(self, type):
17         if type == "Data":
18             wildcard = u"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|*"
19         elif type == "Texte":
20             wildcard = "Fichier texte|*.txt|Tous les fichiers|*"
21         elif type == "Analyse":
22             wildcard = "Fichier analyse/Corpus|*.ira;*.cira"
23         defaultDir = self.PathPath.get('PATHS', 'lastpath')
24         if defaultDir.strip() == '':
25             defaultDir = self.UserConfigPath.replace('.iramuteq','')
26         dlg = wx.FileDialog(
27         self, message=_(u"Choose a file").decode('utf8'), defaultDir=defaultDir,
28         defaultFile="", wildcard=wildcard, style=wx.OPEN | wx.CHANGE_DIR)
29         dlg.CenterOnParent()
30         if dlg.ShowModal() == wx.ID_OK :
31             fileName = dlg.GetFilename()
32             path = dlg.GetPaths()
33             dlg.Destroy()
34             self.PathPath.set('PATHS', 'lastpath', os.path.dirname(path[0]))
35             self.type = type
36             return fileName, path
37         else:
38             dlg.Destroy()
39             if type == "Data":
40                 return False, [False]
41             elif type == "Texte":
42                 return False, [False]
43             elif type == "Analyse":
44                 return [False]
45
46 def getfileextension(file) :
47     return os.path.splitext(file)[1]
48
49 def get_table_param(self, filename) :
50     if getfileextension(filename) == '.csv':
51         dlg = dialog.FileOptionDialog(self, -1, _(u"File format").decode('utf8'), sep=True, size=(350, 200),
52                      style=wx.DEFAULT_DIALOG_STYLE)
53         dlg.CenterOnParent()
54         val = dlg.ShowModal()
55         if val == wx.ID_OK:
56             self.tableau.parametres['colsep'] = dlg.colsep[dlg.choice3.GetSelection()]
57             self.tableau.parametres['txtsep'] = dlg.txtsep[dlg.choice4.GetSelection()]
58             if self.tableau.parametres['colsep'] == 'tabulation' :
59                 self.tableau.parametres['colsep'] = '\t'
60             self.tableau.parametres['filetype'] = 'csv'
61     elif  getfileextension(filename) == '.xls' :
62         dlg = dialog.FileOptionDialog(self, -1, _(u"File format").decode('utf8'), sep=False, sheet = True, size=(350, 200),
63                      style=wx.DEFAULT_DIALOG_STYLE)
64         dlg.CenterOnParent()
65         val = dlg.ShowModal()
66         if val == wx.ID_OK:    
67             self.tableau.parametres['colsep'] = ';'
68             self.tableau.parametres['txtsep'] = '\"'
69             self.tableau.parametres['encodage'] = sys.getdefaultencoding()
70             self.tableau.parametres['sheetnb'] = dlg.spin1.GetValue()
71             self.tableau.parametres['filetype'] = 'xls'
72     elif getfileextension(filename) == '.ods':
73         dlg = dialog.FileOptionDialog(self, -1, _(u"File format").decode('utf8'), sep=False, size=(350, 200),
74                      style=wx.DEFAULT_DIALOG_STYLE)
75         dlg.CenterOnParent()
76         val = dlg.ShowModal()
77         if val == wx.ID_OK:          
78             self.tableau.parametres['colsep'] = ';'
79             self.tableau.parametres['txtsep'] = '\"'
80             self.tableau.parametres['filetype'] = 'ods'
81     else :
82         val = False
83     if val == wx.ID_OK:       
84         if dlg.radio_box_1.GetSelection() == 0:
85             self.tableau.firstrowiscolnames = True
86         else:
87             self.tableau.firstrowiscolnames = False
88         if dlg.radio_box_2.GetSelection() == 0:
89             self.tableau.firstcolisrownames = True
90         else:
91             self.tableau.firstcolisrownames = False
92     dlg.Destroy()
93     return val
94
95 def getPage(ira) :
96     if '_mgr' in dir(ira) :
97         if not ira._mgr.GetPane('Text').IsShown() :
98             if ira.nb.GetPageCount() >= 1:
99                 return ira.nb.GetPage(ira.nb.GetSelection())
100             else :
101                 return None
102         else :
103             return None
104     else :
105         return None
106
107 def getCorpus(page) :
108     if 'corpus' in page.__dict__:
109         return copy(page.corpus)
110     else :
111         return None
112             
113 class SelectColumn :
114     def __init__(self, parent, dictcol, actives, pathout, selected = None, dlg = False) :
115         self.ira = parent
116         if dlg :
117             dial = dialog.SelectColDial(self.ira)
118             listcol = ListForSpec(dial, self, dictcol, ['eff'])
119             dial.bSizer2.Add( listcol, 2, wx.ALL|wx.EXPAND, 5 )
120             dial.m_sdbSizer2.AddButton( dial.m_sdbSizer2OK )
121             dial.m_sdbSizer2.AddButton( dial.butok)
122             dial.m_sdbSizer2.Realize()
123             dial.bSizer2.Add( dial.m_sdbSizer2, 0, wx.EXPAND, 5 )
124             dial.Layout()
125             if selected is None :
126                 for row in xrange(listcol.GetItemCount()):
127                     listcol.Select(row)
128             else :
129                 orderlex = dict([[listcol.getColumnText(i,0),i] for i in range(0,listcol.GetItemCount())])
130                 for row in selected :
131                     listcol.Select(orderlex[actives[row]])
132             dial.CenterOnParent()
133             val = dial.ShowModal()        
134             if val == wx.ID_OK :
135                 last = listcol.GetFirstSelected()
136                 lastl = [listcol.GetFirstSelected()]
137                 indexes = [listcol.getColumnText(listcol.GetFirstSelected(),0)]
138                 while listcol.GetNextSelected(last) != -1:
139                     last = listcol.GetNextSelected(last)
140                     lastl.append(last)
141                     indexes.append(listcol.getColumnText(last,0))
142                 dial.Destroy()
143                 column = [actives.index(val) for val in indexes]
144                 column.sort()
145                 with open(pathout, 'w') as f :
146                     f.write('\n'.join([`val` for val in column]))
147                 self.ok = True
148             else :
149                 self.ok = False
150         else :
151             if selected is None :
152                 selected = [i for i in range(0, len(actives))]
153             with open(pathout, 'w') as f :
154                 f.write('\n'.join([`i` for i in selected]))
155
156
157 class PrefSimi ( wx.Dialog ):
158     
159     def __init__( self, parent, ID, paramsimi, indices, wordlist = None, selected = None, actives = None):
160         wx.Dialog.__init__ ( self, None, id = wx.ID_ANY, title = _(u"Settings").decode('utf8'), pos = wx.DefaultPosition, size = wx.Size( -1,-1 ), style = wx.DEFAULT_DIALOG_STYLE )
161         self.parent = parent
162         self.ira = parent
163         self.paramsimi=paramsimi
164         self.indices = indices
165
166         self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
167         
168         bSizer16 = wx.BoxSizer( wx.HORIZONTAL )
169         if wordlist is not None :
170             self.listcol = ListForSpec(self, self, wordlist, ['eff'])
171             self.listcol.SetMinSize( wx.Size( 270,-1 ) )
172             bSizer16.Add( self.listcol, 0, wx.ALL|wx.EXPAND, 5 )
173             if selected is None :
174                 for row in xrange(self.listcol.GetItemCount()):
175                     self.listcol.Select(row)
176             else :
177                 self.orderlex = dict([[self.listcol.getColumnText(i,0),i] for i in range(0,self.listcol.GetItemCount())])
178                 for row in selected :
179                     self.listcol.Select(self.orderlex[actives[row]])
180         
181
182         fgSizer10 = wx.FlexGridSizer( 2, 1, 0, 0 )
183         fgSizer10.SetFlexibleDirection( wx.BOTH )
184         fgSizer10.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
185         
186         self.m_notebook1 = wx.Notebook( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, 0 )
187         self.m_panel2 = wx.Panel( self.m_notebook1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
188         bSizer18 = wx.BoxSizer( wx.VERTICAL )
189         
190         fgSizer3 = wx.FlexGridSizer( 0, 2, 0, 0 )
191         fgSizer3.SetFlexibleDirection( wx.BOTH )
192         fgSizer3.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
193         
194         if not self.paramsimi['first'] :
195
196             self.m_staticText271 = wx.StaticText( self.m_panel2, wx.ID_ANY, _(u"Use previous coordinates").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
197             self.m_staticText271.Wrap( -1 )
198             fgSizer3.Add( self.m_staticText271, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
199             
200             self.check_coord = wx.CheckBox( self.m_panel2, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
201             fgSizer3.Add( self.check_coord, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
202             
203             self.m_staticline36 = wx.StaticLine( self.m_panel2, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
204             fgSizer3.Add( self.m_staticline36, 0, wx.EXPAND, 5 )
205             
206             self.m_staticline37 = wx.StaticLine( self.m_panel2, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
207             fgSizer3.Add( self.m_staticline37, 0, wx.EXPAND, 5 )
208         
209         self.m_staticText3 = wx.StaticText( self.m_panel2, wx.ID_ANY, _(u"Score").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
210         self.m_staticText3.Wrap( -1 )
211         fgSizer3.Add( self.m_staticText3, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
212         
213         choice1Choices = []
214         self.choice1 = wx.Choice( self.m_panel2, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, self.indices, 0 )
215         self.choice1.SetSelection( 0 )
216         fgSizer3.Add( self.choice1, 0, wx.ALL, 5 )
217         
218         self.m_staticline293 = wx.StaticLine( self.m_panel2, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
219         fgSizer3.Add( self.m_staticline293, 0, wx.EXPAND, 5 )
220         
221         self.m_staticline292 = wx.StaticLine( self.m_panel2, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
222         fgSizer3.Add( self.m_staticline292, 0, wx.EXPAND, 5 )
223         
224         self.m_staticText4 = wx.StaticText( self.m_panel2, wx.ID_ANY, _(u"Layout").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
225         self.m_staticText4.Wrap( -1 )
226         fgSizer3.Add( self.m_staticText4, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
227         
228         choice2Choices = [ u"random", u"cercle", u"fruchterman reingold", u"kamada kawai", u"graphopt" ]
229         self.choice2 = wx.Choice( self.m_panel2, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, choice2Choices, 0 )
230         self.choice2.SetSelection( 0 )
231         fgSizer3.Add( self.choice2, 0, wx.ALL, 5 )
232         
233         self.m_staticline294 = wx.StaticLine( self.m_panel2, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
234         fgSizer3.Add( self.m_staticline294, 0, wx.EXPAND, 5 )
235         
236         self.m_staticline295 = wx.StaticLine( self.m_panel2, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
237         fgSizer3.Add( self.m_staticline295, 0, wx.EXPAND, 5 )
238         
239         self.m_staticText5 = wx.StaticText( self.m_panel2, wx.ID_ANY, _(u"Graphic type").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
240         self.m_staticText5.Wrap( -1 )
241         fgSizer3.Add( self.m_staticText5, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
242         
243         choice3Choices = [ u"dynamique", u"statique", u"3D", u'web2D', u"web3D" ]
244         self.choice3 = wx.Choice( self.m_panel2, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, choice3Choices, 0 )
245         self.choice3.SetSelection( 0 )
246
247         label_format = wx.StaticText(self.m_panel2, -1, _(u"Picture format").decode('utf8'))
248         self.choix_format =  wx.Choice(self.m_panel2, -1, (100,50), choices = ['png', 'svg'])
249         self.choix_format.SetSelection( 0 )
250         hsizer = wx.BoxSizer(wx.HORIZONTAL)
251         hsizer.Add(self.choice3, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
252         hsizer.Add(label_format, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
253         hsizer.Add(self.choix_format, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
254         fgSizer3.Add( hsizer, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
255         
256         self.m_staticline296 = wx.StaticLine( self.m_panel2, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
257         fgSizer3.Add( self.m_staticline296, 0, wx.EXPAND, 5 )
258         
259         self.m_staticline297 = wx.StaticLine( self.m_panel2, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
260         fgSizer3.Add( self.m_staticline297, 0, wx.EXPAND, 5 )
261         
262         self.m_staticText8 = wx.StaticText( self.m_panel2, wx.ID_ANY, _(u"Maximum tree").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
263         self.m_staticText8.Wrap( -1 )
264         fgSizer3.Add( self.m_staticText8, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
265         
266         self.check1 = wx.CheckBox( self.m_panel2, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
267         fgSizer3.Add( self.check1, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
268         
269         self.m_staticline298 = wx.StaticLine( self.m_panel2, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
270         fgSizer3.Add( self.m_staticline298, 0, wx.EXPAND, 5 )
271         
272         self.m_staticline299 = wx.StaticLine( self.m_panel2, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
273         fgSizer3.Add( self.m_staticline299, 0, wx.EXPAND, 5 )
274         
275         self.m_staticText91 = wx.StaticText( self.m_panel2, wx.ID_ANY, _(u"Edges threshold").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
276         self.m_staticText91.Wrap( -1 )
277         fgSizer3.Add( self.m_staticText91, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
278         
279         bSizer21 = wx.BoxSizer( wx.HORIZONTAL )
280         
281         self.check_seuil = wx.CheckBox( self.m_panel2, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
282         bSizer21.Add( self.check_seuil, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
283         
284         self.spin_seuil = wx.SpinCtrl( self.m_panel2, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 1, 10000, 1 )
285         bSizer21.Add( self.spin_seuil, 0, wx.ALL, 5 )
286         
287         
288         fgSizer3.Add( bSizer21, 1, wx.EXPAND, 5 )
289         
290         self.m_staticline2910 = wx.StaticLine( self.m_panel2, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
291         fgSizer3.Add( self.m_staticline2910, 0, wx.EXPAND, 5 )
292         
293         self.m_staticline2911 = wx.StaticLine( self.m_panel2, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
294         fgSizer3.Add( self.m_staticline2911, 0, wx.EXPAND, 5 )
295         
296         self.m_staticText19 = wx.StaticText( self.m_panel2, wx.ID_ANY, _(u"Text on vertex").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
297         self.m_staticText19.Wrap( -1 )
298         fgSizer3.Add( self.m_staticText19, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
299         
300         self.check_vlab = wx.CheckBox( self.m_panel2, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
301         fgSizer3.Add( self.check_vlab, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
302         
303         self.m_staticline2912 = wx.StaticLine( self.m_panel2, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
304         fgSizer3.Add( self.m_staticline2912, 0, wx.EXPAND, 5 )
305         
306         self.m_staticline2913 = wx.StaticLine( self.m_panel2, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
307         fgSizer3.Add( self.m_staticline2913, 0, wx.EXPAND, 5 )
308         
309         self.m_staticText20 = wx.StaticText( self.m_panel2, wx.ID_ANY, _(u"Score on edges").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
310         self.m_staticText20.Wrap( -1 )
311         fgSizer3.Add( self.m_staticText20, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
312         
313         self.check_elab = wx.CheckBox( self.m_panel2, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
314         fgSizer3.Add( self.check_elab, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
315         
316         self.m_staticline2914 = wx.StaticLine( self.m_panel2, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
317         fgSizer3.Add( self.m_staticline2914, 0, wx.EXPAND, 5 )
318         
319         self.m_staticline2915 = wx.StaticLine( self.m_panel2, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
320         fgSizer3.Add( self.m_staticline2915, 0, wx.EXPAND, 5 )
321         
322         self.m_staticText27 = wx.StaticText( self.m_panel2, wx.ID_ANY, _(u"Text size").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
323         self.m_staticText27.Wrap( -1 )
324         fgSizer3.Add( self.m_staticText27, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
325         
326         self.spin_cex = wx.SpinCtrl( self.m_panel2, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 0, 100, 10 )
327         fgSizer3.Add( self.spin_cex, 0, wx.ALL, 5 )
328         
329         self.m_staticline2916 = wx.StaticLine( self.m_panel2, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
330         fgSizer3.Add( self.m_staticline2916, 0, wx.EXPAND, 5 )
331         
332         self.m_staticline2917 = wx.StaticLine( self.m_panel2, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
333         fgSizer3.Add( self.m_staticline2917, 0, wx.EXPAND, 5 )
334         
335         bsizer34 = wx.BoxSizer(wx.HORIZONTAL)
336         
337         comtext =  wx.StaticText( self.m_panel2, wx.ID_ANY, _(u"Communities").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
338         comtext.Wrap( -1 )
339         bsizer34.Add(comtext, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
340
341         self.comcheck = wx.CheckBox(self.m_panel2, -1)
342         bsizer34.Add(self.comcheck, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
343
344         fgSizer3.Add(bsizer34 , 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
345
346         sizer54 = wx.BoxSizer(wx.HORIZONTAL)
347         self.comlist = ['edge.betweenness.community','fastgreedy.community','label.propagation.community','leading.eigenvector.community','multilevel.community','optimal.community', 'spinglass.community', 'walktrap.community']
348         self.choix_com = wx.Choice( self.m_panel2, wx.ID_ANY, choices = self.comlist)
349         self.choix_com.SetSelection( 0 )
350         self.halo = wx.CheckBox(self.m_panel2, wx.ID_ANY, u'halo')
351         sizer54.Add(self.choix_com , 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
352         sizer54.Add(self.halo , 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
353         fgSizer3.Add( sizer54, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
354
355         if 'bystar' in self.paramsimi :
356             self.m_staticText40 = wx.StaticText( self.m_panel2, wx.ID_ANY, _(u"Select a variable").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
357             self.m_staticText40.Wrap( -1 )
358             fgSizer3.Add( self.m_staticText40, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
359             
360             self.check_bystar = wx.CheckBox( self.m_panel2, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
361             fgSizer3.Add( self.check_bystar, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
362             
363             self.m_staticline3200 = wx.StaticLine( self.m_panel2, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
364             fgSizer3.Add( self.m_staticline3200, 0, wx.EXPAND, 5 )
365             self.m_staticline3201 = wx.StaticLine( self.m_panel2, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
366             fgSizer3.Add( self.m_staticline3201, 0, wx.EXPAND, 5 )
367
368         
369         bSizer18.Add( fgSizer3, 0, wx.EXPAND, 5 )
370         
371         
372         self.m_panel2.SetSizer( bSizer18 )
373         self.m_panel2.Layout()
374         bSizer18.Fit( self.m_panel2 )
375         self.m_notebook1.AddPage( self.m_panel2, _(u"Graph settings").decode('utf8'), True )
376         self.m_panel3 = wx.Panel( self.m_notebook1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
377         fgSizer5 = wx.FlexGridSizer( 0, 3, 0, 0 )
378         fgSizer5.SetFlexibleDirection( wx.BOTH )
379         fgSizer5.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
380         
381         fgSizer51 = wx.FlexGridSizer( 0, 2, 0, 0 )
382         fgSizer51.SetFlexibleDirection( wx.BOTH )
383         fgSizer51.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
384         
385         self.m_staticText6 = wx.StaticText( self.m_panel3, wx.ID_ANY, _(u"Picture size").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
386         self.m_staticText6.Wrap( -1 )
387         fgSizer51.Add( self.m_staticText6, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
388         
389         fgSizer31 = wx.FlexGridSizer( 0, 2, 0, 0 )
390         fgSizer31.SetFlexibleDirection( wx.BOTH )
391         fgSizer31.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
392         
393         self.m_staticText9 = wx.StaticText( self.m_panel3, wx.ID_ANY, _(u"height").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
394         self.m_staticText9.Wrap( -1 )
395         fgSizer31.Add( self.m_staticText9, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
396         
397         self.spin_height = wx.SpinCtrl( self.m_panel3, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 10, 100000, 800 )
398         fgSizer31.Add( self.spin_height, 0, wx.ALL, 5 )
399         
400         self.m_staticText10 = wx.StaticText( self.m_panel3, wx.ID_ANY, _(u"width").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
401         self.m_staticText10.Wrap( -1 )
402         fgSizer31.Add( self.m_staticText10, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
403         
404         self.spin_width = wx.SpinCtrl( self.m_panel3, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 10, 100000, 800 )
405         fgSizer31.Add( self.spin_width, 0, wx.ALL, 5 )
406         
407         
408         fgSizer51.Add( fgSizer31, 1, wx.EXPAND, 5 )
409         
410         self.m_staticline3 = wx.StaticLine( self.m_panel3, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
411         fgSizer51.Add( self.m_staticline3, 0, wx.EXPAND, 5 )
412         
413         self.m_staticline4 = wx.StaticLine( self.m_panel3, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
414         fgSizer51.Add( self.m_staticline4, 0, wx.EXPAND, 5 )
415         
416         self.m_staticText101 = wx.StaticText( self.m_panel3, wx.ID_ANY, _(u"Vertex size proportional to frequency").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
417         self.m_staticText101.Wrap( -1 )
418         fgSizer51.Add( self.m_staticText101, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
419         
420         bSizer7 = wx.BoxSizer( wx.HORIZONTAL )
421         
422         bSizer9 = wx.BoxSizer( wx.VERTICAL )
423         
424         self.check2 = wx.CheckBox( self.m_panel3, wx.ID_ANY, u"eff.", wx.DefaultPosition, wx.DefaultSize, 0 )
425         bSizer9.Add( self.check2, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
426         
427         self.checki = wx.CheckBox( self.m_panel3, wx.ID_ANY, u"chi2", wx.DefaultPosition, wx.DefaultSize, 0 )
428         bSizer9.Add( self.checki, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
429         
430         
431         bSizer7.Add( bSizer9, 0, wx.ALIGN_CENTER_VERTICAL, 5 )
432         
433         fgSizer7 = wx.FlexGridSizer( 0, 2, 0, 0 )
434         fgSizer7.SetFlexibleDirection( wx.BOTH )
435         fgSizer7.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
436         
437         self.m_staticText11 = wx.StaticText( self.m_panel3, wx.ID_ANY, u"min", wx.DefaultPosition, wx.DefaultSize, 0 )
438         self.m_staticText11.Wrap( -1 )
439         fgSizer7.Add( self.m_staticText11, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
440         
441         self.spin_tvmin = wx.SpinCtrl( self.m_panel3, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 0, 100, 0 )
442         fgSizer7.Add( self.spin_tvmin, 0, wx.ALL, 5 )
443         
444         self.m_staticText12 = wx.StaticText( self.m_panel3, wx.ID_ANY, u"max", wx.DefaultPosition, wx.DefaultSize, 0 )
445         self.m_staticText12.Wrap( -1 )
446         fgSizer7.Add( self.m_staticText12, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
447         
448         self.spin_tvmax = wx.SpinCtrl( self.m_panel3, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 0, 100, 0 )
449         fgSizer7.Add( self.spin_tvmax, 0, wx.ALL, 5 )
450         
451         
452         bSizer7.Add( fgSizer7, 1, wx.EXPAND, 5 )
453         
454         
455         fgSizer51.Add( bSizer7, 1, wx.EXPAND, 5 )
456         
457         self.m_staticline31 = wx.StaticLine( self.m_panel3, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
458         fgSizer51.Add( self.m_staticline31, 0, wx.EXPAND, 5 )
459         
460         self.m_staticline32 = wx.StaticLine( self.m_panel3, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
461         fgSizer51.Add( self.m_staticline32, 0, wx.EXPAND, 5 )
462         
463         self.m_staticText1011 = wx.StaticText( self.m_panel3, wx.ID_ANY, _(u"Vertex text size proportional to frequency").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
464         self.m_staticText1011.Wrap( -1 )
465         fgSizer51.Add( self.m_staticText1011, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
466         
467         bSizer71 = wx.BoxSizer( wx.HORIZONTAL )
468         
469         bSizer8 = wx.BoxSizer( wx.VERTICAL )
470         
471         self.check_vcex = wx.CheckBox( self.m_panel3, wx.ID_ANY, u"eff.", wx.DefaultPosition, wx.DefaultSize, 0 )
472         bSizer8.Add( self.check_vcex, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
473         
474         self.checkit = wx.CheckBox( self.m_panel3, wx.ID_ANY, u"chi2", wx.DefaultPosition, wx.DefaultSize, 0 )
475         bSizer8.Add( self.checkit, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
476         
477         
478         bSizer71.Add( bSizer8, 0, wx.ALIGN_CENTER_VERTICAL, 5 )
479         
480         fgSizer71 = wx.FlexGridSizer( 0, 2, 0, 0 )
481         fgSizer71.SetFlexibleDirection( wx.BOTH )
482         fgSizer71.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
483         
484         self.m_staticText111 = wx.StaticText( self.m_panel3, wx.ID_ANY, u"min", wx.DefaultPosition, wx.DefaultSize, 0 )
485         self.m_staticText111.Wrap( -1 )
486         fgSizer71.Add( self.m_staticText111, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
487         
488         self.spin_vcexmin = wx.SpinCtrl( self.m_panel3, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 0, 100, 0 )
489         fgSizer71.Add( self.spin_vcexmin, 0, wx.ALL, 5 )
490         
491         self.m_staticText121 = wx.StaticText( self.m_panel3, wx.ID_ANY, u"max", wx.DefaultPosition, wx.DefaultSize, 0 )
492         self.m_staticText121.Wrap( -1 )
493         fgSizer71.Add( self.m_staticText121, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
494         
495         self.spin_vcexmax = wx.SpinCtrl( self.m_panel3, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 0, 100, 0 )
496         fgSizer71.Add( self.spin_vcexmax, 0, wx.ALL, 5 )
497         
498         
499         bSizer71.Add( fgSizer71, 1, wx.EXPAND, 5 )
500         
501         
502         fgSizer51.Add( bSizer71, 1, wx.EXPAND, 5 )
503         
504         self.m_staticline321 = wx.StaticLine( self.m_panel3, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
505         fgSizer51.Add( self.m_staticline321, 0, wx.EXPAND, 5 )
506         
507         self.m_staticline322 = wx.StaticLine( self.m_panel3, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
508         fgSizer51.Add( self.m_staticline322, 0, wx.EXPAND, 5 )
509         
510         self.m_staticText10111 = wx.StaticText( self.m_panel3, wx.ID_ANY, _(u"Edges width proportional to score").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
511         self.m_staticText10111.Wrap( -1 )
512         fgSizer51.Add( self.m_staticText10111, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
513         
514         bSizer711 = wx.BoxSizer( wx.HORIZONTAL )
515         
516         self.check3 = wx.CheckBox( self.m_panel3, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
517         bSizer711.Add( self.check3, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
518         
519         fgSizer711 = wx.FlexGridSizer( 0, 2, 0, 0 )
520         fgSizer711.SetFlexibleDirection( wx.BOTH )
521         fgSizer711.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
522         
523         self.m_staticText1111 = wx.StaticText( self.m_panel3, wx.ID_ANY, u"min", wx.DefaultPosition, wx.DefaultSize, 0 )
524         self.m_staticText1111.Wrap( -1 )
525         fgSizer711.Add( self.m_staticText1111, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
526         
527         self.spin_temin = wx.SpinCtrl( self.m_panel3, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 0, 100, 0 )
528         fgSizer711.Add( self.spin_temin, 0, wx.ALL, 5 )
529         
530         self.m_staticText1211 = wx.StaticText( self.m_panel3, wx.ID_ANY, u"max", wx.DefaultPosition, wx.DefaultSize, 0 )
531         self.m_staticText1211.Wrap( -1 )
532         fgSizer711.Add( self.m_staticText1211, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
533         
534         self.spin_temax = wx.SpinCtrl( self.m_panel3, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 0, 100, 0 )
535         fgSizer711.Add( self.spin_temax, 0, wx.ALL, 5 )
536         
537         
538         bSizer711.Add( fgSizer711, 1, wx.EXPAND, 5 )
539         
540         
541         fgSizer51.Add( bSizer711, 1, wx.EXPAND, 5 )
542         
543         self.m_staticline33 = wx.StaticLine( self.m_panel3, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
544         fgSizer51.Add( self.m_staticline33, 0, wx.EXPAND, 5 )
545         
546         self.m_staticline34 = wx.StaticLine( self.m_panel3, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
547         fgSizer51.Add( self.m_staticline34, 0, wx.EXPAND, 5 )
548         
549         self.m_staticText28 = wx.StaticText( self.m_panel3, wx.ID_ANY, _(u"Gray scale on text proportional to frequency (0=black, 1=white)").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
550         self.m_staticText28.Wrap( -1 )
551         fgSizer51.Add( self.m_staticText28, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
552         
553         bSizer10 = wx.BoxSizer( wx.HORIZONTAL )
554         
555         self.m_checkBox14 = wx.CheckBox( self.m_panel3, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
556         bSizer10.Add( self.m_checkBox14, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
557         
558         bSizer11 = wx.BoxSizer( wx.VERTICAL )
559         
560         bSizer12 = wx.BoxSizer( wx.HORIZONTAL )
561         
562         self.m_staticText31 = wx.StaticText( self.m_panel3, wx.ID_ANY, u"min", wx.DefaultPosition, wx.DefaultSize, 0 )
563         self.m_staticText31.Wrap( -1 )
564         bSizer12.Add( self.m_staticText31, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
565         
566         self.m_spinCtrl14 = wx.SpinCtrl( self.m_panel3, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 0, 100, 0 )
567         bSizer12.Add( self.m_spinCtrl14, 0, wx.ALL, 5 )
568         
569         
570         bSizer11.Add( bSizer12, 1, wx.EXPAND, 5 )
571         
572         bSizer13 = wx.BoxSizer( wx.HORIZONTAL )
573         
574         self.m_staticText32 = wx.StaticText( self.m_panel3, wx.ID_ANY, u"max", wx.DefaultPosition, wx.DefaultSize, 0 )
575         self.m_staticText32.Wrap( -1 )
576         bSizer13.Add( self.m_staticText32, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
577         
578         self.m_spinCtrl15 = wx.SpinCtrl( self.m_panel3, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 0, 100, 10 )
579         bSizer13.Add( self.m_spinCtrl15, 0, wx.ALL, 5 )
580         
581         
582         bSizer11.Add( bSizer13, 1, wx.EXPAND, 5 )
583         
584         
585         bSizer10.Add( bSizer11, 1, wx.EXPAND, 5 )
586         
587         
588         fgSizer51.Add( bSizer10, 1, wx.ALIGN_CENTER_VERTICAL|wx.EXPAND, 5 )
589         
590         self.m_staticline3311 = wx.StaticLine( self.m_panel3, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
591         fgSizer51.Add( self.m_staticline3311, 0, wx.EXPAND |wx.ALL, 5 )
592         
593         self.m_staticline33111 = wx.StaticLine( self.m_panel3, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
594         fgSizer51.Add( self.m_staticline33111, 0, wx.EXPAND |wx.ALL, 5 )
595         
596         bSizer5 = wx.BoxSizer( wx.HORIZONTAL )
597         
598         self.m_staticText21 = wx.StaticText( self.m_panel3, wx.ID_ANY, _(u"Vertex color").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
599         self.m_staticText21.Wrap( -1 )
600         bSizer5.Add( self.m_staticText21, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
601         
602         self.cols = wx.ColourPickerCtrl( self.m_panel3, wx.ID_ANY, wx.Colour( 255, 0, 0 ), wx.DefaultPosition, wx.Size( 10,10 ), wx.CLRP_DEFAULT_STYLE )
603         bSizer5.Add( self.cols, 0, wx.ALL, 5 )
604         
605         
606         fgSizer51.Add( bSizer5, 1, wx.EXPAND, 5 )
607         
608         bSizer6 = wx.BoxSizer( wx.HORIZONTAL )
609         
610         self.m_staticText22 = wx.StaticText( self.m_panel3, wx.ID_ANY, _(u"Edges color").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
611         self.m_staticText22.Wrap( -1 )
612         bSizer6.Add( self.m_staticText22, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
613         
614         self.cola = wx.ColourPickerCtrl( self.m_panel3, wx.ID_ANY, wx.Colour( 208, 208, 208 ), wx.DefaultPosition, wx.DefaultSize, wx.CLRP_DEFAULT_STYLE )
615         bSizer6.Add( self.cola, 0, wx.ALL, 5 )
616         
617         
618         fgSizer51.Add( bSizer6, 1, wx.EXPAND, 5 )
619         
620         self.m_staticline331 = wx.StaticLine( self.m_panel3, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
621         fgSizer51.Add( self.m_staticline331, 0, wx.EXPAND, 5 )
622         
623         self.m_staticline332 = wx.StaticLine( self.m_panel3, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
624         fgSizer51.Add( self.m_staticline332, 0, wx.EXPAND, 5 )
625         
626         self.m_staticText23 = wx.StaticText( self.m_panel3, wx.ID_ANY, _(u"Vertex size").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
627         self.m_staticText23.Wrap( -1 )
628         fgSizer51.Add( self.m_staticText23, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
629         
630         bSizer72 = wx.BoxSizer( wx.HORIZONTAL )
631         
632         self.check_s_size = wx.CheckBox( self.m_panel3, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
633         bSizer72.Add( self.check_s_size, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
634         
635         self.spin_tv = wx.SpinCtrl( self.m_panel3, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 0, 100, 10 )
636         bSizer72.Add( self.spin_tv, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
637         
638         
639         fgSizer51.Add( bSizer72, 1, wx.EXPAND, 5 )
640         
641         self.m_staticline333 = wx.StaticLine( self.m_panel3, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
642         fgSizer51.Add( self.m_staticline333, 0, wx.EXPAND, 5 )
643         
644         self.m_staticline334 = wx.StaticLine( self.m_panel3, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
645         fgSizer51.Add( self.m_staticline334, 0, wx.EXPAND, 5 )
646         
647         self.m_staticText24 = wx.StaticText( self.m_panel3, wx.ID_ANY, _(u"Spheres transparency").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
648         self.m_staticText24.Wrap( -1 )
649         fgSizer51.Add( self.m_staticText24, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
650         
651         self.slider_sphere = wx.Slider( self.m_panel3, wx.ID_ANY, 10, 0, 100, wx.DefaultPosition, wx.DefaultSize, wx.SL_HORIZONTAL|wx.SL_LABELS )
652         fgSizer51.Add( self.slider_sphere, 0, wx.ALL|wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 5 )
653         
654         self.m_staticline335 = wx.StaticLine( self.m_panel3, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
655         fgSizer51.Add( self.m_staticline335, 0, wx.EXPAND, 5 )
656         
657         self.m_staticline336 = wx.StaticLine( self.m_panel3, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
658         fgSizer51.Add( self.m_staticline336, 0, wx.EXPAND, 5 )
659         
660         self.m_staticText25 = wx.StaticText( self.m_panel3, wx.ID_ANY, _(u"Make a movie").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
661         self.m_staticText25.Wrap( -1 )
662         fgSizer51.Add( self.m_staticText25, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
663         
664         self.film = wx.CheckBox( self.m_panel3, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
665         fgSizer51.Add( self.film, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
666         
667         self.m_staticline2918 = wx.StaticLine( self.m_panel3, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
668         fgSizer51.Add( self.m_staticline2918, 0, wx.EXPAND, 5 )
669         
670         self.m_staticline2919 = wx.StaticLine( self.m_panel3, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
671         fgSizer51.Add( self.m_staticline2919, 0, wx.EXPAND, 5 )
672         
673         
674         fgSizer51.AddSpacer( ( 0, 0), 1, wx.EXPAND, 5 )
675         
676         
677         fgSizer5.Add( fgSizer51, 1, wx.EXPAND, 5 )
678         
679         
680         self.m_panel3.SetSizer( fgSizer5 )
681         self.m_panel3.Layout()
682         fgSizer5.Fit( self.m_panel3 )
683         self.m_notebook1.AddPage( self.m_panel3, _(u"Graphical settings").decode('utf8'), False )
684         
685         fgSizer10.Add( self.m_notebook1, 1, wx.EXPAND |wx.ALL, 5 )
686         
687         m_sdbSizer2 = wx.StdDialogButtonSizer()
688         self.m_sdbSizer2OK = wx.Button( self, wx.ID_OK )
689         m_sdbSizer2.AddButton( self.m_sdbSizer2OK )
690         self.m_sdbSizer2Cancel = wx.Button( self, wx.ID_CANCEL )
691         m_sdbSizer2.AddButton( self.m_sdbSizer2Cancel )
692         m_sdbSizer2.Realize();
693         
694         fgSizer10.Add( m_sdbSizer2, 1, wx.EXPAND, 5 )
695         
696         
697         bSizer16.Add( fgSizer10, 1, wx.EXPAND, 5 )
698         
699         
700         self.SetSizer( bSizer16 )
701         self.Layout()
702         bSizer16.Fit( self )
703         
704         self.Centre( wx.BOTH )
705         self.__set_properties()
706  
707         # Connect Events
708        # if not self.paramsimi['first'] :
709        #     self.check_coord.Bind( wx.EVT_CHECKBOX, self.OnKeepCoords )
710        # self.choice3.Bind( wx.EVT_CHOICE, self.OnChangeType )
711        # self.check2.Bind( wx.EVT_CHECKBOX, self.OnCheck2 )
712        # self.checki.Bind( wx.EVT_CHECKBOX, self.OnChecki )
713        # self.check_vcex.Bind( wx.EVT_CHECKBOX, self.OnCheck_vcex )
714        # self.checkit.Bind( wx.EVT_CHECKBOX, self.OnCheckit )
715        # self.check_s_size.Bind( wx.EVT_CHECKBOX, self.OnCheck_s_size )
716         
717         # Connect Events
718         if not self.paramsimi['first'] :
719             self.check_coord.Bind( wx.EVT_CHECKBOX, self.OnKeepCoords )
720         self.choice3.Bind( wx.EVT_CHOICE, self.OnChangeType )
721         self.check2.Bind( wx.EVT_CHECKBOX, self.OnCheck2 )
722         if 'cexfromchi' in self.paramsimi :
723             self.checkit.Bind( wx.EVT_CHECKBOX, self.OnCheckit )
724         if 'sfromchi' in self.paramsimi :
725             self.checki.Bind( wx.EVT_CHECKBOX, self.OnChecki )
726         self.check_vcex.Bind( wx.EVT_CHECKBOX, self.OnCheck_vcex )
727         self.check_s_size.Bind( wx.EVT_CHECKBOX, self.OnCheck_s_size )
728
729     def __set_properties(self):
730         self.choice1.SetSelection(self.paramsimi['coeff'])
731         self.choice2.SetSelection(self.paramsimi['layout'])
732         self.choice3.SetSelection(self.paramsimi['type_graph'])
733         if self.paramsimi['type_graph'] not in  [2,3] :
734             self.film.Enable(False)
735             self.slider_sphere.Enable(False)
736         else :
737             self.film.Enable(True)
738             self.slider_sphere.Enable(True)
739         self.check1.SetValue(self.paramsimi['arbremax'])
740         self.check_vlab.SetValue(self.paramsimi['label_v'])
741         self.check_elab.SetValue(self.paramsimi['label_e'])
742         self.check2.SetValue(self.paramsimi['tvprop'])
743         self.spin_tv.SetValue(self.paramsimi['coeff_tv_nb'])
744         self.check_s_size.SetValue(self.paramsimi['coeff_tv'])
745         self.spin_tvmin.SetValue(self.paramsimi['tvmin'])
746         self.spin_tvmax.SetValue(self.paramsimi['tvmax'])
747         self.check3.SetValue(self.paramsimi['coeff_te'])
748         self.spin_temin.SetValue(self.paramsimi['coeff_temin'])
749         self.spin_temax.SetValue(self.paramsimi['coeff_temax'])
750         self.check_vcex.SetValue(self.paramsimi['vcex'])
751         self.spin_vcexmin.SetValue(self.paramsimi['vcexmin'])
752         self.spin_vcexmax.SetValue(self.paramsimi['vcexmax'])
753         self.spin_cex.SetValue(self.paramsimi['cex'])
754         self.check_seuil.SetValue(self.paramsimi['seuil_ok'])
755         self.spin_seuil.SetValue(self.paramsimi['seuil'])
756         self.cols.SetColour(self.paramsimi['cols'])
757         self.cola.SetColour(self.paramsimi['cola'])
758         self.spin_width.SetValue(self.paramsimi['width'])
759         self.spin_height.SetValue(self.paramsimi['height'])
760         if 'cexfromchi' in self.paramsimi :
761             self.checkit.SetValue(self.paramsimi['cexfromchi'])
762         if 'sfromchi' in self.paramsimi :
763             self.checki.SetValue(self.paramsimi['sfromchi'])
764         if not self.paramsimi['first'] :
765             self.check_coord.SetValue(self.paramsimi['keep_coord'])
766             self.OnKeepCoords(wx.EVT_CHECKBOX)
767         if self.paramsimi.get('bystar', False) :
768             self.check_bystar.SetValue(True)
769             self.stars = self.paramsimi['stars']
770         self.slider_sphere.SetValue(self.paramsimi['alpha'])
771         self.film.SetValue(self.paramsimi['film'])
772         self.comcheck.SetValue(self.paramsimi['com'])
773         self.choix_com.SetSelection(self.paramsimi['communities'])
774         self.halo.SetValue(self.paramsimi['halo'])
775
776     def OnCheck_s_size(self, evt):
777         if self.check_s_size.GetValue() :
778             if 'cexfromchi' in self.paramsimi :
779                 self.checki.SetValue(False)
780             self.check2.SetValue(False)
781             self.spin_tvmin.Enable(False)
782             self.spin_tvmax.Enable(False)
783             self.spin_tv.Enable(True)
784         else :
785             self.check2.SetValue(True)
786             self.spin_tvmin.Enable(True)
787             self.spin_tvmax.Enable(True)
788             self.spin_tv.Enable(False)
789
790     def OnCheck2(self, evt):
791         if self.check2.GetValue():
792             self.check_s_size.SetValue(False)
793             if 'cexfromchi' in self.paramsimi :
794                 self.checki.SetValue(False)
795             self.spin_tvmin.Enable(True)
796             self.spin_tvmax.Enable(True)
797             self.spin_tv.Enable(False)
798         else :
799             self.check_s_size.SetValue(True)
800             self.spin_tvmin.Enable(False)
801             self.spin_tvmax.Enable(False)
802             self.spin_tv.Enable(True)
803
804     def OnChecki(self, evt):
805         if 'sfromchi' in self.paramsimi :
806             if self.checki.GetValue() :
807                 self.check_s_size.SetValue(False)
808                 self.check2.SetValue(False)
809                 self.spin_tvmin.Enable(True)
810                 self.spin_tvmax.Enable(True)
811                 self.spin_tv.Enable(False)
812             else :
813                 self.check_s_size.SetValue(True)
814                 #self.check2.SetValue(True)
815                 self.spin_tvmin.Enable(False)
816                 self.spin_tvmax.Enable(False)
817                 self.spin_tv.Enable(True)
818
819     def OnCheckit(self,evt) :
820         if 'cexfromchi' in self.paramsimi :
821             if self.checkit.GetValue() :
822                 if self.check_vcex.GetValue() :
823                     self.check_vcex.SetValue(False)
824
825     def OnCheck_vcex(self, evt):
826         if self.check_vcex.GetValue() :
827             if 'checkit' in dir(self) :
828                 if self.checkit.GetValue() :
829                     self.checkit.SetValue(False)
830     
831     def OnChangeType(self, event) :
832         if event.GetInt() != 1 :
833             self.spin_width.Enable(False)
834             self.spin_height.Enable(False)
835         else :
836             self.spin_width.Enable(True)
837             self.spin_height.Enable(True)
838         if event.GetInt() not in [2,3] :
839             self.film.Enable(False)
840             self.slider_sphere.Enable(False)
841         else :
842             self.film.Enable(True)
843             self.slider_sphere.Enable(True)
844
845     def OnKeepCoords(self, event):
846         if self.check_coord.GetValue() :
847             self.choice1.SetSelection(self.paramsimi['coeff'])
848             self.choice2.SetSelection(self.paramsimi['layout'])
849             self.check_seuil.SetValue(self.paramsimi['seuil_ok'])
850             self.spin_seuil.SetValue(self.paramsimi['seuil'])
851             self.choice1.Disable()
852             self.choice2.Disable()
853             self.check_seuil.Disable()
854             self.spin_seuil.Disable()
855             #self.check_colch.SetValue(False)
856             #self.check_colch.Disable()
857         else :
858             self.choice1.Enable(True)
859             self.choice2.Enable(True)
860             self.check_seuil.Enable(True)
861             self.spin_seuil.Enable(True)
862             #self.check_colch.Enable(True)
863
864
865 class PrepSimi :
866     def __init__(self, parent, source, parametres, pathout, actives, indices_simi, wordlist = None, selected = None) :    
867         self.parametres = parametres
868         self.etline = []
869         self.dial = PrefSimi(parent, -1, self.parametres, indices_simi, wordlist = wordlist, selected = selected, actives = actives) 
870         self.dial.CenterOnParent()
871         self.val = self.dial.ShowModal()
872         if self.val == wx.ID_OK :
873             if 'bystar' in self.parametres :
874                 if self.dial.check_bystar.GetValue() :
875                     variables = treat_var_mod(self.parametres['stars'])
876                     vardial = dialog.OptLexi(parent, force_chi = True) 
877                     vardial.listet = self.parametres['stars']
878                     vardial.variables = [v for v in variables]
879                     for et in vardial.variables :
880                         vardial.list_box_1.Append(et)
881                     nval = vardial.ShowModal()
882                     if nval == wx.ID_OK :
883                         if vardial.choice.GetSelection() == 1 :
884                             listet = [vardial.listet[i] for i in vardial.list_box_1.GetSelections()]
885                         else :
886                             listet = variables[vardial.variables[vardial.list_box_1.GetSelections()[0]]]
887                         self.dial.Destroy()
888                         vardial.Destroy()
889                         self.etline = source.corpus.make_etline(listet)
890                         self.parametres['selectedstars'] = listet
891                         self.parametres['listet'] = self.etline
892                     else:
893                         vardial.Destroy()
894             last = self.dial.listcol.GetFirstSelected()
895             lastl = [self.dial.listcol.GetFirstSelected()]
896             indexes = [self.dial.listcol.getColumnText(self.dial.listcol.GetFirstSelected(),0)]
897             while self.dial.listcol.GetNextSelected(last) != -1:
898                 last = self.dial.listcol.GetNextSelected(last)
899                 lastl.append(last)
900                 indexes.append(self.dial.listcol.getColumnText(last,0))
901             column = [actives.index(val) for val in indexes]
902             column.sort()
903             with open(pathout, 'w') as f :
904                 f.write('\n'.join([`val` for val in column]))
905             self.make_param()
906             self.dial.Destroy()
907         else :
908             self.dial.Destroy()
909
910     def make_param(self) :
911         #self.select = self.dial.check_colch.GetValue()
912         if self.parametres.get('first', True) :
913             keep_coord = False
914         else :
915             keep_coord = self.dial.check_coord.GetValue()
916         param = {'coeff' : self.dial.choice1.GetSelection(),
917                           'layout' : self.dial.choice2.GetSelection(),
918                           'type_graph' : self.dial.choice3.GetSelection(),
919                           'arbremax' : self.dial.check1.GetValue(),
920                           'coeff_tv' : self.dial.check_s_size.GetValue(),
921                           'coeff_tv_nb' : self.dial.spin_tv.GetValue(),
922                           'tvprop' : self.dial.check2.GetValue(),
923                           'tvmin' : self.dial.spin_tvmin.GetValue(),
924                           'tvmax' : self.dial.spin_tvmax.GetValue(),
925                           'coeff_te' : self.dial.check3.GetValue(),
926                           'coeff_temin' : self.dial.spin_temin.GetValue(),
927                           'coeff_temax' : self.dial.spin_temax.GetValue(),
928                           'label_e' : self.dial.check_elab.GetValue(),
929                           'label_v' : self.dial.check_vlab.GetValue(),
930                           'vcex' : self.dial.check_vcex.GetValue(),
931                           'vcexmin' : self.dial.spin_vcexmin.GetValue(),
932                           'vcexmax' : self.dial.spin_vcexmax.GetValue(),
933                           'cex' : self.dial.spin_cex.GetValue(),
934                           'seuil_ok' : self.dial.check_seuil.GetValue(),
935                           'seuil' : self.dial.spin_seuil.GetValue(),
936                           'cols' : self.dial.cols.GetColour(),
937                           'cola' : self.dial.cola.GetColour(),
938                           'width' : self.dial.spin_width.GetValue(),
939                           'height' : self.dial.spin_height.GetValue(),
940                           'first' : False,
941                           'keep_coord' : keep_coord,
942                           'alpha' : self.dial.slider_sphere.GetValue(),
943                           'film' : self.dial.film.GetValue(),
944                           'svg' : self.dial.choix_format.GetSelection(),
945                           'com'  :self.dial.comcheck.GetValue(),
946                           'communities' : self.dial.choix_com.GetSelection(),
947                           'halo' : self.dial.halo.GetValue(),
948                           }
949         if 'cexfromchi' in self.parametres :
950             param['cexfromchi'] = self.dial.checkit.GetValue()
951         if 'sfromchi' in self.parametres :
952             param['sfromchi'] = self.dial.checki.GetValue()
953             print param
954         if 'vlabcolor' in self.parametres :
955             param['vlabcolor'] = self.parametres['vlabcolor']
956         if 'check_bystar' in dir(self.dial) :
957             param['bystar'] = self.dial.check_bystar.GetValue()
958             param['stars'] = self.parametres['stars']
959         self.parametres.update(param)
960
961 class CreateTgenDialog ( wx.Frame ):
962     
963     def __init__( self, parent, lemlist, tgen = None, tgens = None ):
964         wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = u'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 )
965         
966         self.tgens = tgens
967         self.edit = False
968         self.parent = parent
969         self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
970         
971         bSizer2 = wx.BoxSizer( wx.VERTICAL )
972         
973         fgSizer3 = wx.FlexGridSizer( 0, 2, 0, 0 )
974         fgSizer3.SetFlexibleDirection( wx.BOTH )
975         fgSizer3.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
976         
977         self.m_staticText3 = wx.StaticText( self, wx.ID_ANY, u"Name", wx.DefaultPosition, wx.DefaultSize, 0 )
978         self.m_staticText3.Wrap( -1 )
979         fgSizer3.Add( self.m_staticText3, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
980         
981         self.m_textCtrl1 = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
982         self.m_textCtrl1.SetMinSize( wx.Size( 250,-1 ) )
983
984         
985         fgSizer3.Add( self.m_textCtrl1, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
986         
987         
988         bSizer2.Add( fgSizer3, 1, wx.ALIGN_CENTER_HORIZONTAL, 5 )
989         
990         self.ip = VItemsPicker(self,-1, lemlist,'Forms', 'Selected')
991         self.ip._source.SetMinSize( wx.Size( 250, 400 ) )
992         
993         bSizer2.Add( self.ip, 0, wx.ALL, 5 )
994         
995         m_sdbSizer3 = wx.StdDialogButtonSizer()
996         self.m_sdbSizer3OK = wx.Button( self, wx.ID_OK )
997         m_sdbSizer3.AddButton( self.m_sdbSizer3OK )
998         self.m_sdbSizer3Cancel = wx.Button( self, wx.ID_CANCEL )
999         m_sdbSizer3.AddButton( self.m_sdbSizer3Cancel )
1000         m_sdbSizer3.Realize();
1001         
1002         bSizer2.Add( m_sdbSizer3, 1, wx.EXPAND, 5 )
1003         
1004         
1005         self.SetSizer( bSizer2 )
1006         self.Layout()
1007         bSizer2.Fit( self )
1008         
1009         self.Centre( wx.BOTH )
1010         
1011         self.m_textCtrl1.Bind( wx.EVT_TEXT, self.OnTextEnter )
1012         self.ip.Bind(EVT_IP_SELECTION_CHANGED, self.OnSelectionChange)
1013         self.m_sdbSizer3OK.Bind(wx.EVT_BUTTON, self.OnClose)
1014         self.m_sdbSizer3Cancel.Bind(wx.EVT_BUTTON, self.OnCancel)
1015         
1016         #self.ip.SetItems(lemlist)
1017         self.m_sdbSizer3OK.Enable(False)
1018         
1019         if tgen is not None :
1020             self.m_textCtrl1.SetValue(tgen)
1021             self.ip._destData = dict([[i,[word,'']] for i, word in enumerate(tgens[tgen])])
1022             self.ip._SetDestItems()
1023             #self.ip.SetSelections(tgens[tgen])
1024             self.m_sdbSizer3OK.Enable(True)
1025             self.edit = True
1026         else :
1027             self.edit = False
1028     
1029     def __del__( self ):
1030         pass
1031     
1032     def OnTextEnter(self, evt):
1033         if self.m_textCtrl1.GetValue() != '' and self.m_textCtrl1.GetValue() not in self.tgens and self.ip.GetSelections() != []:
1034             self.m_sdbSizer3OK.Enable(True)
1035         else :
1036             self.m_sdbSizer3OK.Enable(False)
1037         if self.m_textCtrl1.GetValue() != '' and self.ip.GetSelections() and self.edit:
1038             self.m_sdbSizer3OK.Enable(True)
1039     
1040     def OnSelectionChange(self, evt):
1041         if self.ip.GetSelections() != [] and self.m_textCtrl1.GetValue() != '' and self.m_textCtrl1.GetValue() not in self.tgens :
1042             self.m_sdbSizer3OK.Enable(True)
1043         else :
1044             self.m_sdbSizer3OK.Enable(False)
1045         if self.m_textCtrl1.GetValue() != '' and self.ip.GetSelections() and self.edit:
1046             self.m_sdbSizer3OK.Enable(True)
1047     
1048     def OnClose(self, evt):
1049         self.Close()
1050     
1051     def OnCancel(self, evt):
1052         self.Destroy()
1053
1054 class TGenFrame ( wx.Frame ):
1055     
1056     def __init__( self, parent, corpus, Tgen ):
1057         wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = u"Tgen", pos = wx.DefaultPosition, size = wx.Size( 600,434 ), style = wx.DEFAULT_FRAME_STYLE|wx.TAB_TRAVERSAL|wx.FRAME_FLOAT_ON_PARENT|wx.STAY_ON_TOP )
1058         
1059         self.Tgen = Tgen
1060         self.parent = parent
1061         self.corpus = corpus
1062         self.activetgen = None
1063         
1064         self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
1065         
1066         bSizer1 = wx.BoxSizer( wx.VERTICAL )
1067         
1068         fgSizer1 = wx.FlexGridSizer( 0, 2, 0, 0 )
1069         fgSizer1.SetFlexibleDirection( wx.BOTH )
1070         fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
1071         
1072         self.m_staticText1 = wx.StaticText( self, wx.ID_ANY, u"Tgen", wx.DefaultPosition, wx.DefaultSize, 0 )
1073         self.m_staticText1.Wrap( -1 )
1074         fgSizer1.Add( self.m_staticText1, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1075         
1076         self.m_staticText2 = wx.StaticText( self, wx.ID_ANY, u"Content", wx.DefaultPosition, wx.DefaultSize, 0 )
1077         self.m_staticText2.Wrap( -1 )
1078         fgSizer1.Add( self.m_staticText2, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1079         
1080         tgensChoices = Tgen.tgen.keys()
1081         self.tgens = wx.ListBox( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, tgensChoices, 0 )
1082         self.tgens.SetMinSize( wx.Size( 200,250 ) )
1083         
1084         fgSizer1.Add( self.tgens, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1085         
1086         tgencontentChoices = []
1087         self.tgencontent = wx.ListBox( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, tgencontentChoices, 0|wx.VSCROLL )
1088         self.tgencontent.SetMinSize( wx.Size( 200,250 ) )
1089         
1090         fgSizer1.Add( self.tgencontent, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1091         
1092         fgSizer2 = wx.FlexGridSizer( 0, 2, 0, 0 )
1093         fgSizer2.SetFlexibleDirection( wx.BOTH )
1094         fgSizer2.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
1095         
1096         self.but_new = wx.Button( self, wx.ID_ANY, u"New...", wx.DefaultPosition, wx.DefaultSize, 0 )
1097         fgSizer2.Add( self.but_new, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1098         
1099         self.but_del = wx.Button( self, wx.ID_ANY, u"Delete", wx.DefaultPosition, wx.DefaultSize, 0 )
1100         fgSizer2.Add( self.but_del, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1101         
1102         
1103         fgSizer1.Add( fgSizer2, 0, wx.EXPAND, 5 )
1104         
1105         fgSizer3 = wx.FlexGridSizer( 0, 2, 0, 0 )
1106         fgSizer3.SetFlexibleDirection( wx.BOTH )
1107         fgSizer3.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
1108         self.but_edit = wx.Button( self, wx.ID_ANY, u"Edit", wx.DefaultPosition, wx.DefaultSize, 0 )
1109         fgSizer3.Add( self.but_edit, 1, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1110         
1111         self.but_compute = wx.Button( self, wx.ID_ANY, u"Compute", wx.DefaultPosition, wx.DefaultSize, 0 )
1112         fgSizer3.Add( self.but_compute, 1, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )      
1113
1114         fgSizer1.Add( fgSizer3, 0, wx.EXPAND, 5 )
1115
1116         bSizer1.Add( fgSizer1, 1, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
1117         
1118         m_sdbSizer2 = wx.StdDialogButtonSizer()
1119         self.m_sdbSizer2OK = wx.Button( self, wx.ID_OK )
1120         m_sdbSizer2.AddButton( self.m_sdbSizer2OK )
1121         #self.m_sdbSizer2Cancel = wx.Button( self, wx.ID_CANCEL )
1122         #m_sdbSizer2.AddButton( self.m_sdbSizer2Cancel )
1123         m_sdbSizer2.Realize();
1124         
1125         bSizer1.Add( m_sdbSizer2, 0, wx.EXPAND, 5 )
1126         
1127         
1128         self.SetSizer( bSizer1 )
1129         self.Layout()
1130         
1131         self.Centre( wx.BOTH )
1132         
1133         # Connect Events
1134         self.tgens.Bind( wx.EVT_LISTBOX, self.GetContent )
1135         self.but_new.Bind( wx.EVT_BUTTON, self.OnNewTgen )
1136         self.but_del.Bind( wx.EVT_BUTTON, self.OnDeleteTgen )
1137         self.but_edit.Bind( wx.EVT_BUTTON, self.OnEditTgen )
1138         self.but_compute.Bind(wx.EVT_BUTTON, self.OnCompute)
1139         self.m_sdbSizer2OK.Bind( wx.EVT_BUTTON, self.OnOK )
1140         
1141     def __del__( self ):
1142         pass
1143
1144     def GetContent( self, event ):
1145         tgen = event.GetString()
1146         if tgen != '' :
1147             self.tgencontent.Clear()
1148             for word in self.Tgen[tgen] :
1149                 self.tgencontent.Append(word)
1150     
1151     def OnNewTgen( self, event, tgen = None ):
1152         if tgen is None :
1153             self.dial = CreateTgenDialog(self, dict([[i, [lem, self.corpus.lems[lem].freq]] for i, lem in enumerate(self.corpus.lems.keys())]), tgens = self.Tgen.tgen)
1154         else :
1155             self.dial = CreateTgenDialog(self, dict([[i, [lem, self.corpus.lems[lem].freq]] for i, lem in enumerate(self.corpus.lems.keys())]), tgen = tgen, tgens = self.Tgen.tgen)
1156             self.dial.ip._source.selected = dict(zip(self.Tgen.tgen[tgen], self.Tgen.tgen[tgen]))
1157             self.activetgen = tgen
1158         self.dial.Show()
1159         self.dial.Bind(wx.EVT_CLOSE, self.OnDialClose)
1160     
1161     def OnDeleteTgen( self, event ):
1162         if self.tgens.GetSelection() != -1 :
1163             tgens = self.tgens.GetItems()
1164             del self.Tgen.tgen[tgens[self.tgens.GetSelection()]]
1165             self.Tgen.write()
1166             self.tgens.Clear()
1167             self.tgencontent.Clear()
1168             for val in self.Tgen.tgen :
1169                 self.tgens.Append(val)
1170         event.Skip()
1171     
1172     def OnEditTgen( self, event ):
1173         if self.tgens.GetSelection() != -1 :
1174             tgens = self.tgens.GetItems()
1175             tgen = tgens[self.tgens.GetSelection()]
1176             self.activetgen = tgen
1177             self.dial = CreateTgenDialog(self, dict([[i, [lem, self.corpus.lems[lem].freq]] for i, lem in enumerate(self.corpus.lems.keys())]), tgen = tgen, tgens = self.Tgen.tgen)
1178             self.dial.Bind(wx.EVT_CLOSE, self.OnDialClose)
1179             self.dial.m_textCtrl1.Enable(False)
1180             self.dial.ip._source.selected = dict(zip(self.Tgen.tgen[tgen], self.Tgen.tgen[tgen]))
1181             self.dial.Show()
1182         event.Skip()
1183     
1184     def OnCompute(self, evt):
1185         ira = wx.GetApp().GetTopWindow()
1186         ira.tree.OnTgenCompute(evt)
1187     
1188     def OnOK(self, evt):
1189         self.Destroy()
1190     
1191     def OnDialClose(self, evt):
1192         if self.dial.edit :
1193             del self.Tgen.tgen[self.activetgen]
1194             self.tgens.Clear()
1195             self.tgencontent.Clear()
1196             for val in self.Tgen.tgen :
1197                 self.tgens.Append(val)
1198         self.Tgen.tgen[self.dial.m_textCtrl1.GetValue()] = self.dial.ip.GetSelections()
1199         self.Tgen.write()
1200         self.tgens.Append(self.dial.m_textCtrl1.GetValue())
1201         self.dial.Destroy()
1202         evt.Skip()