2 # -*- coding: utf-8 -*-
3 #Author: Pierre Ratinaud
4 #Copyright (c) 2008-2009 Pierre Ratinaud
9 #import wx.lib.agw.aui as aui
11 from chemins import ConstructPathOut, ChdTxtPathOut, FFF, ffr, PathOut, StatTxtPathOut, simipath
12 from ConfigParser import ConfigParser
13 from functions import ReadProfileAsDico, GetTxtProfile, read_list_file, ReadList, exec_rcode, print_liste, BugReport, DoConf, indices_simi
14 from ProfList import *
15 from guiparam3d import param3d, simi3d
16 from PrintRScript import write_afc_graph, print_simi3d, PrintSimiScript
17 from profile_segment import *
18 from functions import ReadList
21 from search_tools import SearchFrame
22 from dialog import PrefGraph, PrefExport, PrefSimpleFile, PrefDendro
23 from guifunct import SelectColumn, PrepSimi
24 from corpusNG import Corpus
33 log = logging.getLogger('iramuteq.layout')
36 class GraphPanelAfc(wx.Panel):
37 def __init__(self, parent, dico, list_graph, clnb, itempath = 'liste_graph_afc', coding = sys.getdefaultencoding()):
38 wx.Panel.__init__(self,parent)
43 self.itempath = itempath
44 self.parent = self.GetParent()#parent
45 self.SetFont(wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "courier"))
48 self.TabCHD = self.parent.GetParent()
49 self.nb = self.TabCHD.GetParent()
50 self.ira = self.nb.GetParent()
51 self.panel_1 = wx.ScrolledWindow(self, -1, style=wx.TAB_TRAVERSAL)
52 afc_img = wx.Image(os.path.join(self.ira.images_path,'button_afc.jpg'), wx.BITMAP_TYPE_ANY).ConvertToBitmap()
53 self.butafc = wx.BitmapButton(self, -1, afc_img)
54 self.Bind(wx.EVT_BUTTON, self.afc_graph, self.butafc)
55 self.dirout = os.path.dirname(self.Dict['ira'])
56 for i in range(0,len(list_graph)):
57 if os.path.exists(os.path.join(self.dirout,list_graph[i][0])) :
58 self.listimg.append(wx.StaticBitmap(self.panel_1, -1, wx.Bitmap(os.path.join(self.dirout,list_graph[i][0]), wx.BITMAP_TYPE_ANY)))
59 self.labels.append(wx.StaticText(self.panel_1, -1, list_graph[i][1]))
61 self.param = { 'typegraph' : 0,
83 self.__set_properties()
86 def __set_properties(self):
87 self.panel_1.EnableScrolling(True,True)
88 #self.panel_1.SetSize((1000,1000))
89 self.panel_1.SetScrollRate(20, 20)
91 def __do_layout(self):
92 self.sizer_1 = wx.BoxSizer(wx.VERTICAL)
93 self.sizer_2 = wx.BoxSizer(wx.HORIZONTAL)
94 self.sizer_3 = wx.BoxSizer(wx.VERTICAL)
95 self.sizer_2.Add(self.butafc, 0, 0, 0)
96 for i in range(0, len(self.listimg)):
97 self.sizer_3.Add(self.listimg[i], 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
98 self.sizer_3.Add(self.labels[i], 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
99 self.panel_1.SetSizer(self.sizer_3)
100 self.sizer_2.Add(self.panel_1, 1, wx.EXPAND, 0)
101 self.SetSizer(self.sizer_2)
103 def afc_graph(self,event):
104 #dirout = os.path.dirname(self.Dict['ira'])
105 while os.path.exists(os.path.join(self.dirout,'graph_afc_'+str(self.afcnb)+'.png')):
107 self.fileout = ffr(os.path.join(self.dirout,'graph_afc_'+str(self.afcnb)+'.png'))
108 dial = PrefGraph(self.parent,-1,self.param,'')
109 dial.CenterOnParent()
110 val = dial.ShowModal()
112 self.param = {'typegraph' : dial.choicetype.GetSelection(),
113 'width' : dial.spin1.GetValue(),
114 'height' : dial.spin2.GetValue(),
115 'what' : dial.choice1.GetSelection(),
116 'qui' : dial.choice2.GetSelection(),
117 'do_select_nb' : dial.check1.GetValue(),
118 'do_select_chi' : dial.check2.GetValue(),
119 'select_nb' : dial.spin_nb.GetValue(),
120 'select_chi' : dial.spin_chi.GetValue(),
121 'over' : dial.check3.GetValue(),
122 'cex_txt' : dial.check4.GetValue(),
123 'txt_min' : dial.spin_min.GetValue(),
124 'txt_max' : dial.spin_max.GetValue(),
125 'tchi' : dial.check_tchi.GetValue(),
126 'tchi_min' : dial.spin_min_tchi.GetValue(),
127 'tchi_max' : dial.spin_max_tchi.GetValue(),
128 'taillecar' : dial.spin3.GetValue(),
129 'facteur' : [dial.spin_f1.GetValue(),dial.spin_f2.GetValue(), dial.spin_f3.GetValue()],
131 'film' : str(dial.film.GetValue()).upper(),
132 'alpha' : dial.slider_sphere.GetValue()
134 self.nb.parent = self.ira
135 self.DictPathOut = self.Dict
136 self.RscriptsPath = self.ira.RscriptsPath
139 """ % self.DictPathOut['RData']
140 if self.itempath == 'liste_graph_afcf' :
143 afc_table <- afcf_table
144 chistabletot <- specfp
146 elif self.itempath == 'liste_graph_afct' :
149 afc_table <- afct_table
150 chistabletot <- spectp
152 txt += write_afc_graph(self)
153 filetmp = tempfile.mktemp()
154 file = open(filetmp,'w')
157 pid = exec_rcode(self.ira.RPath, filetmp)
158 check_Rresult(self.ira, pid)
159 if self.param['typegraph'] == 0 :
161 if self.param['qui'] == 0 : value = u'actives'
162 if self.param['qui'] == 1 : value = u'supplémentaires'
163 if self.param['qui'] == 2 : value = u'étoilées'
164 if self.param['qui'] == 3 : value = u'classes'
166 if self.param['what'] == 0 : value = u'Coordonnées'
167 if self.param['what'] == 1 : value = u'Corrélations'
168 txt += value + u' - facteur %i / %i' % (self.param['facteur'][0], self.param['facteur'][1])
169 if self.param['do_select_nb'] : txt += u' - sélection de %i variables' % self.param['select_nb']
170 if self.param['do_select_chi'] : txt += u' - sélection des variables avec chi2 > %i ' % self.param['select_chi']
171 if self.param['over'] : txt += u' - Eviter les recouvrements'
172 if self.param['cex_txt'] : txt += u' - taille du texte proportionnel à la masse'
173 if self.param['tchi'] : txt += u' - taille du texte proportionnel au chi2 d\'association'
174 list_graph = read_list_file(self.DictPathOut[self.itempath], self.coding)
175 list_graph.append([self.fileout, txt])
176 print_liste(self.DictPathOut[self.itempath], list_graph)
177 self.sizer_3.Add(wx.StaticBitmap(self.panel_1, -1, wx.Bitmap(self.fileout, wx.BITMAP_TYPE_ANY)), 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
178 self.sizer_3.Add(wx.StaticText(self.panel_1,-1, txt), 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
179 self.sizer_3.Fit(self.panel_1)
182 self.panel_1.Scroll(0,self.panel_1.GetScrollRange(wx.VERTICAL))
185 class GraphPanel(wx.ScrolledWindow):
186 def __init__(self, parent, dico, list_graph, txt = '', style = wx.TAB_TRAVERSAL):
187 wx.ScrolledWindow.__init__(self, parent, style = style)
191 self.SetFont(wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "courier"))
194 self.dirout = os.path.dirname(self.Dict['ira'])
195 self.deb = wx.StaticText(self, -1, txt)
196 for i in range(0,len(list_graph)):
197 if os.path.exists(os.path.join(self.dirout,list_graph[i][0])) :
198 self.listimg.append(wx.StaticBitmap(self, -1, wx.Bitmap(os.path.join(self.dirout,list_graph[i][0]), wx.BITMAP_TYPE_ANY)))
199 self.labels.append(wx.StaticText(self, -1, list_graph[i][1]))
201 self.__set_properties()
204 def __set_properties(self):
205 self.SetScrollRate(20, 20)
207 def __do_layout(self):
208 self.sizer_1 = wx.BoxSizer(wx.VERTICAL)
209 self.sizer_2 = wx.BoxSizer(wx.VERTICAL)
210 self.sizer_3 = wx.BoxSizer(wx.HORIZONTAL)
211 self.sizer_1.Add(self.deb)
212 for i in range(0, len(self.listimg)):
213 self.sizer_1.Add(self.listimg[i], 1, wx.ALIGN_CENTER_HORIZONTAL, 0)
214 self.sizer_1.Add(self.labels[i], 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
215 self.sizer_2.Add(self.sizer_1, 1, wx.EXPAND, 0)
216 self.SetSizer(self.sizer_1)
217 self.sizer_1.Fit(self)
220 def __init__(self, parent, corpus, parametres, Alceste=False):
225 self.parametres = parametres
226 self.pathout = PathOut(parametres['ira'])
227 self.pathout.basefiles(ChdTxtPathOut)
228 DictPathOut = self.pathout
229 self.DictPathOut = DictPathOut
232 Profile = DictPathOut['PROFILE_OUT']
233 AntiProfile = DictPathOut['ANTIPRO_OUT']
234 if isinstance(self.corpus, Corpus) :
235 self.encoding = self.corpus.parametres['syscoding']
236 self.corpus.make_ucecl_from_R(self.pathout['uce'])
237 elif 'tableau' in dir(gparent) :
238 self.encoding = gparent.tableau.parametres['syscoding']
240 #AnalyseConf = ConfigParser()
241 #AnalyseConf.readfp(codecs.open(filename,'r', self.encoding))
242 #AnalyseConf.read(filename)
243 #if 'analyse' in AnalyseConf.sections() :
244 # section = 'analyse'
245 #elif 'questionnaire' in AnalyseConf.sections() :
246 # section = 'questionnaire'
247 #elif 'chd_dist_quest' in AnalyseConf.sections() :
248 # section = 'chd_dist_quest'
249 #self.section = section
250 #clnb = AnalyseConf.get(section, 'clusternb')
252 clnb = parametres['clnb']
253 dlg = progressbar(self, maxi = 4 + clnb)
255 corpname = self.corpus.parametres['corpus_name']
256 print 'lecture des profils'
257 dlg.Update(2, u'lecture des profils')
259 DictProfile = ReadProfileAsDico(self, Profile, Alceste, self.encoding)
260 self.DictProfile = DictProfile
261 print 'lecture des antiprofils'
262 DictAnti = ReadProfileAsDico(self, AntiProfile, Alceste, self.encoding)
264 panel = wx.Panel(parent, -1)
265 sizer1 = wx.BoxSizer(wx.VERTICAL)
267 panel.chd_toolbar = wx.ToolBar(panel, -1, wx.DefaultPosition, wx.DefaultSize, wx.TB_FLAT | wx.TB_NODIVIDER)
268 panel.chd_toolbar.SetToolBitmapSize(wx.Size(16, 16))
270 if isinstance(self.corpus, Corpus) :
271 panel.corpus = self.corpus
272 self.ID_sg = wx.NewId()
273 butsg = wx.Button(panel.chd_toolbar, self.ID_sg, u"Profils des segments répétés ")
274 panel.chd_toolbar.AddControl(butsg)
275 panel.chd_toolbar.AddSeparator()
276 self.ID_export = wx.NewId()
277 butexp = wx.Button(panel.chd_toolbar, self.ID_export, u"Exporter le corpus ")
278 panel.chd_toolbar.AddControl(butexp)
279 panel.chd_toolbar.AddSeparator()
280 self.ID_colored = wx.NewId()
281 butcol = wx.Button(panel.chd_toolbar, self.ID_colored, u"Corpus en couleur ")
282 panel.chd_toolbar.AddControl(butcol)
283 panel.chd_toolbar.AddSeparator()
284 self.ID_searchf = wx.NewId()
285 butsearchf = wx.Button(panel.chd_toolbar, self.ID_searchf, u"Outil de navigation ")
286 panel.chd_toolbar.AddControl(butsearchf)
287 panel.chd_toolbar.AddSeparator()
289 self.ID_proftype =wx.NewId()
290 butpt = wx.Button(panel.chd_toolbar, self.ID_proftype, u"Profils des types ")
291 panel.chd_toolbar.AddControl(butpt)
292 panel.chd_toolbar.AddSeparator()
294 self.ID_clusterstat =wx.NewId()
295 butclusterstat = wx.Button(panel.chd_toolbar, self.ID_clusterstat, u"Stat par classe ")
296 panel.chd_toolbar.AddControl(butclusterstat)
297 panel.chd_toolbar.AddSeparator()
300 self.ID_rapport = wx.NewId()
301 #rap_img = wx.Image(os.path.join(self.parent.images_path,'icone_rap_16.png'), wx.BITMAP_TYPE_ANY).ConvertToBitmap()
302 #panel.chd_toolbar.AddLabelTool(self.ID_rapport, "rapport", rap_img, shortHelp=u"Produire le rapport", longHelp=u"Exporter un rapport en texte simple")
303 butrap = wx.Button(panel.chd_toolbar, self.ID_rapport, u"Rapport ")
304 panel.chd_toolbar.AddControl(butrap)
306 panel.chd_toolbar.Realize()
307 sizer1.Add(panel.chd_toolbar,0, wx.EXPAND, 5)
309 #self.TabChdSim = wx.aui.AuiNotebook(self.parent.nb, -1, wx.DefaultPosition)
310 notebook_flags = aui.AUI_NB_DEFAULT_STYLE | aui.AUI_NB_TAB_EXTERNAL_MOVE | aui.AUI_NB_TAB_MOVE | aui.AUI_NB_TAB_FLOAT| wx.NO_BORDER
311 panel.TabChdSim = aui.AuiNotebook(panel, -1, wx.DefaultPosition)
312 panel.TabChdSim.SetAGWWindowStyleFlag(notebook_flags)
313 panel.TabChdSim.SetArtProvider(aui.ChromeTabArt())
314 sizer1.Add(panel.TabChdSim,10, wx.EXPAND, 5)
315 panel.SetSizer(sizer1)
319 if isinstance(self.corpus, Corpus) :
320 panel.TabChdSim.corpus = corpus
321 panel.TabChdSim.corpus.dictpathout = self.DictPathOut
322 panel.parametres = self.parametres
324 self.notenb = self.parent.nb.GetPageCount()
325 if os.path.exists(DictPathOut['pre_rapport']):
326 #self.tabRap = wx.TextCtrl(self.TabChdSim, -1, "", style=wx.TE_MULTILINE | wx.TE_RICH2)
327 #self.tabRap.SetFont(wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "courier"))
328 with codecs.open(DictPathOut['pre_rapport'], 'r', self.encoding) as f :
330 #self.tabRap.write(txt)
331 #self.tabRap.ShowPosition(0)
336 if os.path.exists(self.DictPathOut['liste_graph_chd']) :
337 list_graph = read_list_file(self.DictPathOut['liste_graph_chd'], self.encoding)
338 CHD = GraphPanelDendro(panel.TabChdSim, DictPathOut, list_graph, txt = self.debtext)
339 panel.TabChdSim.AddPage(CHD,'CHD')
341 panel.ProfNB = aui.AuiNotebook(panel, -1, wx.DefaultPosition)
342 panel.ProfNB.SetArtProvider(aui.ChromeTabArt())
343 #self.ProfNB.SetTabCtrlHeight(100)
344 panel.AntiProfNB = aui.AuiNotebook(panel, -1, wx.DefaultPosition)
345 if os.path.exists(DictPathOut['prof_seg']) :
346 prof_seg = ReadProfileAsDico(self, DictPathOut['prof_seg'], False, self.encoding)
347 self.prof_seg_nb = aui.AuiNotebook(panel, -1, wx.DefaultPosition)
348 for i in range(0, clnb):
349 dlg.Update(3+i, 'Classe %i' %(i+1))
350 ind = '/'.join(DictProfile[str(i + 1)][0][0:2])
351 indpour = ' - '.join([ind, DictProfile[str(i + 1)][0][2]])
352 print 'construction liste classe %i' % i
353 self.tabprofile = ProfListctrlPanel(self.parent, self, DictProfile[str(i + 1)], Alceste, i + 1)
354 self.tabantiprofile = ProfListctrlPanel(self.parent, self, DictAnti[str(i + 1)], Alceste, i + 1)
355 panel.ProfNB.AddPage(self.tabprofile, 'classe %s %s(%s%%)' % (str(i + 1), sep, indpour))
356 panel.AntiProfNB.AddPage(self.tabantiprofile, 'classe %s' % str(i + 1))
357 if os.path.exists(DictPathOut['prof_seg']) :
358 self.tab_prof_seg = ProfListctrlPanel(self.parent, self, prof_seg[str(i + 1)], False, i + 1)
359 self.prof_seg_nb.AddPage(self.tab_prof_seg, 'classe %i' % (i + 1))
362 self.TabAFC = aui.AuiNotebook(panel.TabChdSim, -1, wx.DefaultPosition)
364 list_graph=read_list_file(DictPathOut['liste_graph_afc'], self.encoding)
365 self.tabAFCGraph = GraphPanelAfc(self.TabAFC, DictPathOut, list_graph, self.clnb, coding=self.encoding)
366 self.TabAFC.AddPage(self.tabAFCGraph, 'AFC')
368 if os.path.exists(self.DictPathOut['afc_facteur']) :
369 dictrow, first = ReadList(self.DictPathOut['afc_facteur'], self.encoding)
370 self.TabAFC_facteur = ListForSpec(self.parent, parametres, dictrow, first)
371 dictrow, first = ReadList(self.DictPathOut['afc_row'], self.encoding)
372 self.TabAFC_ligne = ListForSpec(self.parent, self.parametres, dictrow, first)
373 dictrow, first = ReadList(self.DictPathOut['afc_col'], self.encoding)
374 self.TabAFC_colonne = ListForSpec(parent, self.parametres, dictrow, first)
375 self.TabAFC.AddPage(self.TabAFC_facteur, 'Facteurs')
376 self.TabAFC.AddPage(self.TabAFC_colonne, u'Colonnes')
377 self.TabAFC.AddPage(self.TabAFC_ligne, u'Lignes')
379 sizer_3 = wx.BoxSizer(wx.VERTICAL)
380 self.parent.nb_panel_2 = wx.Panel(panel.TabChdSim, -1)
381 self.parent.button_simi = wx.Button(self.parent.nb_panel_2, -1, "Voyager")
382 self.parent.simi3dpanel = simi3d(self.parent.nb_panel_2, -1)
383 sizer_3.Add(self.parent.simi3dpanel, 1, wx.EXPAND, 0)
384 sizer_3.Add(self.parent.button_simi, 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
385 self.parent.nb_panel_2.SetSizer(sizer_3)
386 self.TabAFC.AddPage(self.parent.nb_panel_2, "graph 3D")
387 self.parent.Bind(wx.EVT_BUTTON, self.onsimi, self.parent.button_simi)
389 panel.TabChdSim.AddPage(panel.ProfNB, 'Profils')
390 panel.TabChdSim.AddPage(panel.AntiProfNB, 'Antiprofils')
391 dlg.Update(4 + self.clnb, 'Affichage...')
393 panel.TabChdSim.AddPage(self.TabAFC, 'AFC')
394 if os.path.exists(DictPathOut['prof_seg']) :
395 panel.TabChdSim.AddPage(self.prof_seg_nb, u'Profils des segments répétés')
397 if isinstance(self.corpus, Corpus) :
398 panel.Bind(wx.EVT_BUTTON, self.on_export_classes, id = self.ID_export)
399 panel.Bind(wx.EVT_BUTTON, self.onprofseg, id = self.ID_sg)
400 panel.Bind(wx.EVT_BUTTON, self.oncolored, id = self.ID_colored)
401 panel.Bind(wx.EVT_BUTTON, self.onsearchf, id = self.ID_searchf)
402 panel.Bind(wx.EVT_BUTTON, self.onproftype, id = self.ID_proftype)
403 panel.Bind(wx.EVT_BUTTON, self.onclusterstat, id = self.ID_clusterstat)
405 panel.Bind(wx.EVT_BUTTON, self.ongetrapport, id = self.ID_rapport)
406 self.parent.nb.AddPage(panel, 'Classification - %s' % corpname)
407 self.parent.ShowTab(True)
408 self.parent.nb.SetSelection(self.parent.nb.GetPageCount() - 1)
409 #for pane in self.parent._mgr.GetAllPanes() :
410 # if isinstance(pane.window, aui.AuiNotebook):
412 # nb.SetAGWWindowStyleFlag(notebook_flags)
413 # nb.SetArtProvider(aui.ChromeTabArt())
415 self.parent._mgr.Update()
417 def onsimi(self,event):
418 outfile = print_simi3d(self)
419 error = exec_rcode(self.parent.RPath, outfile, wait = True)
421 def ongetrapport(self, event) :
422 dial = PrefSimpleFile(self, self.parent, **{'mask' : '*.txt', 'title': 'Rapport'})
423 dial.fbb.SetValue(self.DictPathOut['rapport'])
424 dial.CenterOnParent()
425 res = dial.ShowModal()
427 fileout = dial.fbb.GetValue()
429 with open(fileout, 'w') as f :
430 f.write(self.debtext + '\n' + GetTxtProfile(self.DictProfile))
432 dlg = wx.MessageDialog(self.parent, msg, u"Rapport", wx.OK | wx.NO_DEFAULT | wx.ICON_INFORMATION)
439 def on_export_classes(self, event) :
440 corpus = self.parent.nb.GetPage(self.parent.nb.GetSelection()).corpus
441 dial = PrefExport(self, self.parent)
442 dial.fbb.SetValue(os.path.join(os.path.dirname(corpus.dictpathout['ira']), 'export_corpus.txt'))
443 dial.CenterOnParent()
444 res = dial.ShowModal()
446 if dial.radio_type.GetSelection() == 0 : alc = True
448 if dial.radio_lem.GetSelection() == 0 : lem = True
450 self.corpus.export_corpus_classes(dial.fbb.GetValue(), alc = alc, lem = lem)
453 dlg = wx.MessageDialog(self.parent, msg, u"Export", wx.OK | wx.NO_DEFAULT | wx.ICON_INFORMATION)
458 def onprofseg(self, event):
460 corpus = self.parent.nb.GetPage(self.parent.nb.GetSelection()).corpus
461 ProfileSegment(self.parent,corpus)
463 BugReport(self.parent)
465 def onproftype(self, event):
467 corpus = self.parent.nb.GetPage(self.parent.nb.GetSelection()).corpus
468 ProfilType(self.parent, corpus)
470 BugReport(self.parent)
472 def oncolored(self,evt) :
473 dial = PrefSimpleFile(self, self.parent, **{'mask' : '*.html', 'title': 'Corpus en couleur'})
474 dial.fbb.SetValue(os.path.join(os.path.dirname(self.corpus.dictpathout['ira']), 'corpus_couleur.html'))
475 dial.CenterOnParent()
476 res = dial.ShowModal()
478 fileout = dial.fbb.GetValue()
480 txt = self.corpus.make_colored_corpus()
481 with open(fileout, 'w') as f :
483 msg = u"Fini !\nVoulez-vous ouvrir le corpus dans votre navigateur ?"
484 dlg = wx.MessageDialog(self.parent, msg, u"Corpus en couleur", wx.NO | wx.YES | wx.NO_DEFAULT | wx.ICON_QUESTION)
486 if dlg.ShowModal() == wx.ID_YES :
487 webbrowser.open(fileout)
490 def onclusterstat(self, evt) :
491 dial = PrefSimpleFile(self, self.parent, **{'mask' : '*.csv', 'title': 'Stat par classe'})
492 dial.fbb.SetValue( os.path.join(os.path.dirname(self.corpus.dictpathout['ira']), 'stat_par_classe.csv'))
493 dial.CenterOnParent()
494 res = dial.ShowModal()
496 fileout = dial.fbb.GetValue()
499 self.corpus.get_stat_by_cluster(fileout)
501 dlg = wx.MessageDialog(self.parent, msg, u"Stat par classe", wx.OK | wx.NO_DEFAULT | wx.ICON_INFORMATION)
503 if dlg.ShowModal() == wx.ID_OK :
506 def onsearchf(self, evt) :
507 if 'FrameSearch' not in dir(self.parent) :
508 self.parent.FrameSearch = SearchFrame(self.parent, -1, u"Rechercher...", self.corpus)
509 self.parent.FrameSearch.Show()
513 def PrintRapport(self, corpus, parametres, txt = True):
514 #if sys.platform == 'win32':
520 |i|R|a|M|u|T|e|Q| - %s
524 """ % datetime.datetime.now().ctime()
525 totocc = corpus.gettotocc()
527 txt += u'nombre d\'uci: %i%s' % (corpus.getucinb(), sep)
528 txt += u'nombre d\'uce: %i%s' % (corpus.getucenb(), sep)
529 txt += u'nombre de formes: %i%s' % (len(corpus.formes), sep)
530 txt += u'nombre d\'occurrences: %i%s' % (totocc, sep)
531 txt += u'moyenne d\'occurrences par forme: %f%s' % (float(totocc) / float(len(self.corpus.formes)), sep)
532 txt += u'nombre de lemmes: %i%s' % (len(corpus.lems), sep)
533 txt += u'nombre de formes actives: %i%s' % (corpus.getactivesnb(1), sep)
534 txt += u'nombre de formes supplémentaires: %i%s' % (corpus.getactivesnb(2), sep)
535 txt += u'nombre de formes actives de fréquence >= %i: %i%s' % (parametres['eff_min_forme'], parametres['nbactives'], sep)
536 txt += u'moyenne d\'occurrences par uce :%f%s' % (float(totocc) / float(corpus.getucenb()), sep)
537 if 'tailleuc1' in parametres :
538 if parametres['classif_mode'] != 0 :
539 txt += u'taille uc1 : %i\n' % parametres['tailleuc1']
541 txt += u'taille uc1 / uc2: %i / %i - %i / %i%s' % (parametres['tailleuc1'], parametres['tailleuc2'], parametres['lenuc1'], parametres['lenuc2'], sep)
543 self.Ucenb = self.nbind
544 txt += u'nombre d\'individus : %i%s' % (self.nbind, sep)
545 txt += u'nombre de classes : %i%s' % (self.clnb, sep)
547 txt += u'nombre de classes : %i%s' % (parametres['clnb'], sep)
548 if parametres['classif_mode'] == 0 or parametres['classif_mode'] == 1 :
549 txt += u'%i uce classées sur %i (%.2f%%)%s' % (sum([len(cl) for cl in corpus.lc]), corpus.getucenb(), (float(sum([len(cl) for cl in corpus.lc])) / float(corpus.getucenb())) * 100, sep)
550 elif self.parametres['classif_mode'] == 2 :
551 txt += u'%i uci classées sur %i (%.2f%%)%s' % (sum([len(cl) for cl in corpus.lc]), corpus.getucinb(), (float(sum([len(cl) for cl in corpus.lc]))) / float(corpus.getucinb()) * 100, sep)
552 elif analyse == 'quest' :
553 txt += u'%i uce classées sur %i (%.2f%%)%s' % (self.ucecla, self.Ucenb, (float(self.ucecla) / float(self.Ucenb)) * 100, sep)
556 ###########################
558 ###########################
559 """ % parametres['time']
560 file = open(self.pathout['pre_rapport'], 'w')
565 def __init__(self, ira, corpus, parametres):
566 self.pathout = PathOut(dirout = parametres['pathout'])
568 self.dictpathout = StatTxtPathOut(parametres['pathout'])
569 #self.corpus.read_corpus_from_shelves(self.corpus.dictpathout['db'])
571 self.encoding = self.corpus.parametres['syscoding']
572 self.parametres = parametres
574 self.DictSpec, first = ReadList(self.dictpathout['tablespecf'], self.corpus.parametres['syscoding'])
575 self.DictType, firstt = ReadList(self.dictpathout['tablespect'], self.corpus.parametres['syscoding'])
576 self.DictEff, firsteff = ReadList(self.dictpathout['tableafcm'], self.corpus.parametres['syscoding'])
577 self.DictEffType, firstefft = ReadList(self.dictpathout['tabletypem'], self.corpus.parametres['syscoding'])
578 self.DictEffRelForme, firsteffrelf = ReadList(self.dictpathout['eff_relatif_forme'], self.corpus.parametres['syscoding'])
579 self.DictEffRelType, firsteffrelt = ReadList(self.dictpathout['eff_relatif_type'], self.corpus.parametres['syscoding'])
581 self.TabStat = aui.AuiNotebook(ira.nb, -1, wx.DefaultPosition)
582 self.TabStat.parametres = parametres
583 self.ListPan = ListForSpec(ira, self.parent, self.DictSpec, first)
584 self.ListPant = ListForSpec(ira, self.parent, self.DictType, firstt)
585 self.ListPanEff = ListForSpec(ira, self.parent, self.DictEff, firsteff)
586 self.ListPanEffType = ListForSpec(ira, self.parent, self.DictEffType, firstefft)
587 self.ListPanEffRelForme = ListForSpec(ira, self.parent, self.DictEffRelForme, firsteffrelf)
588 self.ListPanEffRelType = ListForSpec(ira, self.parent, self.DictEffRelType, firsteffrelt)
590 self.TabStat.AddPage(self.ListPan, u'formes')
591 self.TabStat.AddPage(self.ListPant, u'Types')
592 self.TabStat.AddPage(self.ListPanEff, u'Effectifs formes')
593 self.TabStat.AddPage(self.ListPanEffType, u'Effectifs Type')
594 self.TabStat.AddPage(self.ListPanEffRelForme, u'Effectifs relatifs formes')
595 self.TabStat.AddPage(self.ListPanEffRelType, u'Effectifs relatifs Type')
596 if self.parametres['clnb'] > 2 :
597 self.TabAFC = aui.AuiNotebook(self.TabStat, -1, wx.DefaultPosition)
598 list_graph=read_list_file(self.dictpathout['liste_graph_afcf'], encoding = self.encoding)
599 self.tabAFCGraph = GraphPanelAfc(self.TabAFC, self.dictpathout, list_graph, self.parametres['clnb'], itempath ='liste_graph_afcf', coding = self.encoding)
600 self.TabAFC.AddPage(self.tabAFCGraph, 'AFC formes')
601 list_graph=read_list_file(self.dictpathout['liste_graph_afct'], encoding = self.encoding)
602 self.tabAFCTGraph = GraphPanelAfc(self.TabAFC, self.dictpathout, list_graph, self.parametres['clnb'], itempath ='liste_graph_afct', coding=self.encoding)
603 self.TabAFC.AddPage(self.tabAFCTGraph, 'AFC type')
604 self.TabStat.AddPage(self.TabAFC, 'AFC')
607 ira.nb.AddPage(self.TabStat, u'Spécificités')
609 self.TabStat.corpus = self.corpus
610 ira.nb.SetSelection(self.parent.nb.GetPageCount() - 1)
611 ira.ShowAPane("Tab_content")
614 def __init__(self, ira, corpus, parametres):
615 self.pathout = PathOut(dirout = parametres['pathout'])
619 self.TabStat = aui.AuiNotebook(ira.nb, -1, wx.DefaultPosition)
620 self.TabStat.parametres = parametres
621 # CHD = GraphPanel(panel.TabChdSim, DictPathOut, list_graph, txt = self.debtext)
622 # panel.TabChdSim.AddPage(CHD,'CHD')
624 #self.TabStatTot = wx.TextCtrl(self.TabStat, -1, style=wx.NO_BORDER | wx.TE_MULTILINE | wx.TE_RICH2)
625 list_graph = [['zipf.png', 'zipf']]
626 self.TabStatTot = GraphPanel(ira.nb, self.pathout, list_graph, self.result['glob'])
627 #self.TabStatTot.write(self.result['glob'])
628 self.TabStat.AddPage(self.TabStatTot, 'global')
629 for item in self.result:
631 datam = [['forme', 'nb']]
632 self.ListPan = ListPanel(ira, self, self.result[item])
633 self.TabStat.AddPage(self.ListPan, item)
634 ira.nb.AddPage(self.TabStat, 'Stat')
635 ira.nb.SetSelection(ira.nb.GetPageCount() - 1)
636 ira.ShowAPane("Tab_content")
638 def read_result(self) :
639 lcle = {'total' :u'total.csv', u'formes_actives':u'formes_actives.csv', u'formes_supplémentaires':u'formes_supplémentaires.csv', u'hapax': u'hapax.csv'}
642 with open(self.pathout[lcle[key]], 'r') as f :
643 self.result[key] = [line.split(';') for line in f.read().splitlines()]
644 self.result[key] = dict([[i,[line[0],int(line[1]), line[2]]] for i, line in enumerate(self.result[key])])
645 with open(self.pathout['glob.txt'], 'r') as f :
646 self.result['glob'] = f.read()
648 class GraphPanelDendro(wx.Panel):
649 def __init__(self,parent, dico, list_graph, txt=False):
650 wx.Panel.__init__(self,parent)
652 self.dictpathout = dico
653 self.dirout = os.path.dirname(self.dictpathout['ira'])
654 self.list_graph = list_graph
655 self.parent = self.GetParent()#parent
656 self.SetFont(wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "courier"))
659 self.tabchd = self.parent.GetParent()
660 self.ira = self.tabchd.GetParent()
661 self.panel_1 = wx.ScrolledWindow(self, -1, style=wx.TAB_TRAVERSAL)
662 self.deb = wx.StaticText(self.panel_1, -1, txt)
663 dendro_img = wx.Image(os.path.join(self.ira.images_path,'but_dendro.png'), wx.BITMAP_TYPE_ANY).ConvertToBitmap()
664 self.butdendro = wx.BitmapButton(self, -1, dendro_img)
666 for i in range(0,len(list_graph)):
667 if os.path.exists(os.path.join(self.dirout,list_graph[i][0])) :
668 self.listimg.append(wx.StaticBitmap(self.panel_1, -1, wx.Bitmap(os.path.join(self.dirout,list_graph[i][0]), wx.BITMAP_TYPE_ANY)))
669 self.labels.append(wx.StaticText(self.panel_1, -1, list_graph[i][1]))
671 self.__set_properties()
674 def __set_properties(self):
675 self.panel_1.EnableScrolling(True,True)
676 #self.panel_1.SetSize((1000,1000))
677 self.panel_1.SetScrollRate(20, 20)
678 self.Bind(wx.EVT_BUTTON, self.ondendro, self.butdendro)
679 self.param = {'width' : 700,
683 'taille_classe' : True,
686 self.type_dendro = [ u"phylogram", u"cladogram", u"fan", u"unrooted", u"radial" ]
688 def __do_layout(self):
689 self.sizer_1 = wx.BoxSizer(wx.VERTICAL)
690 self.sizer_2 = wx.BoxSizer(wx.HORIZONTAL)
691 self.sizer_3 = wx.BoxSizer(wx.VERTICAL)
692 self.sizer_3.Add(self.deb)
693 self.sizer_2.Add(self.butdendro, 0, 0, 0)
694 for i in range(0, len(self.listimg)):
695 self.sizer_3.Add(self.listimg[i], 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
696 self.sizer_3.Add(self.labels[i], 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
697 self.panel_1.SetSizer(self.sizer_3)
698 self.sizer_2.Add(self.panel_1, 1, wx.EXPAND, 0)
699 self.SetSizer(self.sizer_2)
701 def make_param(self, dial):
702 self.param['width'] = dial.m_spinCtrl2.GetValue()
703 self.param['height'] = dial.m_spinCtrl1.GetValue()
704 self.param['type_dendro'] = dial.m_choice1.GetSelection()
705 self.param['color_nb'] = dial.m_radioBox1.GetSelection()
706 self.param['taille_classe'] = dial.m_checkBox1.GetValue()
707 self.param['type_tclasse'] = dial.m_radioBox2.GetSelection()
709 def make_dendro(self) :
710 while os.path.exists(os.path.join(self.dirout, 'dendrogamme_' + str(self.graphnb)+'.png')) :
712 fileout = ffr(os.path.join(self.dirout,'dendrogamme_' + str(self.graphnb)+'.png'))
713 width = self.param['width']
714 height = self.param['height']
715 type_dendro = self.type_dendro[self.param['type_dendro']]
716 if self.param['taille_classe'] :
720 if self.param['color_nb'] == 0 :
724 if self.param['type_tclasse'] == 0 :
728 dendro_path = self.dictpathout['Rdendro']
729 classe_path = self.dictpathout['uce']
734 classes <- read.csv2("%s", row.names=1)
735 classes <- classes[,1]
736 open_file_graph("%s", width=%i, height=%i)
737 plot.dendropr(tree.cut1$tree.cl, classes, type.dendro="%s", histo=%s, bw=%s, lab=NULL, tclasse=%s)
738 """ % (ffr(dendro_path), ffr(self.ira.RscriptsPath['Rgraph']), ffr(classe_path), ffr(fileout), width, height, type_dendro, histo, bw, tclasse)
740 tmpfile = tempfile.mktemp()
741 with open(tmpfile, 'w') as f :
743 error = exec_rcode(self.ira.RPath, tmpfile, wait=True)
744 check_Rresult(self.ira, error)
745 self.list_graph.append([fileout, 'Dendrogramme CHD1 - %s' % type_dendro])
746 print_liste(self.dictpathout['liste_graph_chd'], self.list_graph)
747 self.sizer_3.Add(wx.StaticBitmap(self.panel_1, -1, wx.Bitmap(fileout, wx.BITMAP_TYPE_ANY)), 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
748 self.sizer_3.Add(wx.StaticText(self.panel_1,-1, 'Dendrogramme CHD1 - %s' % type_dendro), 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
749 self.sizer_3.Fit(self.panel_1)
751 self.panel_1.Scroll(0,self.panel_1.GetScrollRange(wx.VERTICAL))
754 def ondendro(self, evt):
755 dial = PrefDendro(self.ira, self.param)
756 val = dial.ShowModal()
758 self.make_param(dial)
764 def __init__(self, ira, parametres) :
765 #self.text = wx.TextCtrl(ira, -1, "", wx.Point(0, 0), wx.Size(200, 200), wx.NO_BORDER | wx.TE_MULTILINE | wx.TE_RICH2 | wx.TE_READONLY)
766 self.panel = CopusPanel(ira, parametres)
767 ira.nb.AddPage(self.panel, 'Description %s' % parametres['corpus_name'])
768 #self.text.write(DoConf().totext(parametres))
769 ira.nb.SetSelection(ira.nb.GetPageCount() - 1)
770 ira.ShowAPane("Tab_content")
772 class CopusPanel(wx.Panel) :
773 def __init__(self, parent, parametres) :
774 wx.Panel.__init__ ( self, parent, id = wx.ID_ANY, pos = wx.DefaultPosition, size = wx.Size( 500,300 ), style = wx.TAB_TRAVERSAL )
775 self.parametres = parametres
776 fgSizer5 = wx.FlexGridSizer( 0, 2, 0, 0 )
777 fgSizer5.SetFlexibleDirection( wx.BOTH )
778 fgSizer5.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
779 self.fgSizer5 = fgSizer5
781 self.m_staticText18 = wx.StaticText( self, wx.ID_ANY, u"Description du corpus", wx.DefaultPosition, wx.DefaultSize, 0 )
783 self.m_staticText18.Wrap( -1 )
784 fgSizer5.Add( self.m_staticText18, 0, wx.ALL, 5 )
786 self.m_staticText19 = wx.StaticText( self, wx.ID_ANY, u"", wx.DefaultPosition, wx.DefaultSize, 0 )
787 self.m_staticText19.Wrap( -1 )
788 fgSizer5.Add( self.m_staticText19, 0, wx.ALL, 5 )
790 self.m_staticText20 = wx.StaticText( self, wx.ID_ANY, u"Nom", wx.DefaultPosition, wx.DefaultSize, 0 )
791 self.m_staticText20.Wrap( -1 )
792 fgSizer5.Add( self.m_staticText20, 0, wx.ALL, 5 )
794 self.m_staticText21 = wx.StaticText( self, wx.ID_ANY, parametres['corpus_name'], wx.DefaultPosition, wx.DefaultSize, 0 )
795 self.m_staticText21.Wrap( -1 )
796 fgSizer5.Add( self.m_staticText21, 0, wx.ALL, 5 )
798 description = {'lang' : u'langue',
799 'encoding' : u'encodage'}
801 keys = ['lang', 'encoding', 'originalpath', 'pathout', 'date', 'time']
803 self.addkeys(keys, description)
805 self.m_staticText18 = wx.StaticText( self, wx.ID_ANY, u"Paramètres", wx.DefaultPosition, wx.DefaultSize, 0 )
806 self.m_staticText18.Wrap( -1 )
807 fgSizer5.Add( self.m_staticText18, 0, wx.ALL, 5 )
809 self.m_staticText19 = wx.StaticText( self, wx.ID_ANY, u"", wx.DefaultPosition, wx.DefaultSize, 0 )
810 self.m_staticText19.Wrap( -1 )
811 fgSizer5.Add( self.m_staticText19, 0, wx.ALL, 5 )
813 keys = ['ucemethod', 'ucesize', 'keep_caract', 'expressions']
814 self.addkeys(keys, description)
816 self.m_staticText18 = wx.StaticText( self, wx.ID_ANY, u"Statistiques", wx.DefaultPosition, wx.DefaultSize, 0 )
817 self.m_staticText18.Wrap( -1 )
818 fgSizer5.Add( self.m_staticText18, 0, wx.ALL, 5 )
820 self.m_staticText19 = wx.StaticText( self, wx.ID_ANY, u"", wx.DefaultPosition, wx.DefaultSize, 0 )
821 self.m_staticText19.Wrap( -1 )
822 fgSizer5.Add( self.m_staticText19, 0, wx.ALL, 5 )
824 keys = ['ucinb', 'ucenb', 'occurrences', 'formesnb', 'hapax']
825 self.addkeys(keys, description)
827 self.SetSizer( fgSizer5 )
830 def addkeys(self, keys, description) :
832 option = self.parametres.get(key,u'non défnini')
833 if isinstance(option, int) :
835 text = wx.StaticText( self, wx.ID_ANY, description.get(key, key), wx.DefaultPosition, wx.DefaultSize, 0 )
837 self.fgSizer5.Add( text, 0, wx.ALL, 5 )
839 text = wx.StaticText( self, wx.ID_ANY, option, wx.DefaultPosition, wx.DefaultSize, 0 )
841 self.fgSizer5.Add( text, 0, wx.ALL, 5 )
843 class GraphPanelSimi(wx.Panel):
844 def __init__(self, parent, dico, list_graph):
845 wx.Panel.__init__(self,parent)
848 self.dirout = os.path.dirname(self.Dict['ira'])
849 self.parent = self.GetParent()#parent
850 self.SetFont(wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "courier"))
853 self.tabsimi = self.parent.GetParent()
854 self.ira = self.tabsimi.GetParent()
855 self.panel_1 = wx.ScrolledWindow(self, -1, style=wx.TAB_TRAVERSAL)
856 afc_img = wx.Image(os.path.join(self.ira.images_path,'button_simi.jpg'), wx.BITMAP_TYPE_ANY).ConvertToBitmap()
857 self.butafc = wx.BitmapButton(self, -1, afc_img)
858 export_img = wx.Image(os.path.join(self.ira.images_path,'button_export.jpg'), wx.BITMAP_TYPE_ANY).ConvertToBitmap()
859 self.butexport = wx.BitmapButton(self, -1, export_img)
861 for i in range(0,len(list_graph)):
862 if os.path.exists(os.path.join(self.dirout,list_graph[i][0])) and list_graph[i][0] != '' :
863 self.listimg.append(wx.StaticBitmap(self.panel_1, -1, wx.Bitmap(os.path.join(self.dirout,list_graph[i][0]), wx.BITMAP_TYPE_ANY)))
864 self.labels.append(wx.StaticText(self.panel_1, -1, list_graph[i][1]))
866 self.__set_properties()
869 def __set_properties(self):
870 self.panel_1.EnableScrolling(True,True)
871 #self.panel_1.SetSize((1000,1000))
872 self.panel_1.SetScrollRate(20, 20)
874 def __do_layout(self):
875 self.sizer_1 = wx.BoxSizer(wx.HORIZONTAL)
876 self.sizer_2 = wx.BoxSizer(wx.VERTICAL)
877 self.sizer_3 = wx.BoxSizer(wx.VERTICAL)
878 self.sizer_2.Add(self.butafc, 0, 0, 0)
879 self.sizer_2.Add(self.butexport, 0, 0, 0)
880 for i in range(0, len(self.listimg)):
881 self.sizer_3.Add(self.listimg[i], 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
882 self.sizer_3.Add(self.labels[i], 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
883 self.panel_1.SetSizer(self.sizer_3)
884 self.sizer_1.Add(self.sizer_2, 0, wx.EXPAND, 0)
885 self.sizer_1.Add(self.panel_1, 1, wx.EXPAND, 0)
886 self.SetSizer(self.sizer_1)
888 class DefaultTextLayout :
889 def __init__(self, ira, corpus, parametres) :
890 self.pathout = PathOut(dirout = parametres['pathout'])
893 self.parametres = parametres
898 log.info('no layout yet')
900 class WordCloudLayout(DefaultTextLayout):
902 #self.dictpathout = parent.corpus.dictpathout
903 #self.pathout = os.path.dirname(filename)
904 #self.corpus = parent.corpus
906 self.pathout.basefiles(simipath)
907 self.Tab = aui.AuiNotebook(self.ira.nb, -1, wx.DefaultPosition)
908 # if os.path.exists(self.pathout['liste_graph']) :
909 # list_graph = read_list_file(self.pathout['liste_graph'])
911 # list_graph = [['','']]
912 list_graph = [['nuage_1.png', 'Nuage']]
913 self.TabStatTot = GraphPanel(self.ira.nb, self.pathout, list_graph)
914 #self.TabStatTot.write(self.result['glob'])
915 self.Tab.AddPage(self.TabStatTot, 'Nuage')
916 self.Tab.corpus = self.corpus
917 self.Tab.parametres = self.parametres
918 self.ira.nb.AddPage(self.Tab, 'WordCloud %s' % self.parametres.get('corpus_name','corpus_name'))
919 self.ira.nb.SetSelection(self.ira.nb.GetPageCount() - 1)
920 self.ira.ShowAPane("Tab_content")
922 class SimiLayout(DefaultTextLayout) :
924 self.pathout.basefiles(simipath)
926 self.indices = indices_simi
927 if os.path.exists(self.pathout['liste_graph']) :
928 list_graph = read_list_file(self.pathout['liste_graph'])
930 list_graph = [['','']]
931 notebook_flags = aui.AUI_NB_DEFAULT_STYLE | aui.AUI_NB_TAB_EXTERNAL_MOVE | aui.AUI_NB_TAB_MOVE | aui.AUI_NB_TAB_FLOAT
932 self.tabsimi = aui.AuiNotebook(self.ira.nb, -1, wx.DefaultPosition)
933 self.tabsimi.SetAGWWindowStyleFlag(notebook_flags)
934 self.tabsimi.SetArtProvider(aui.ChromeTabArt())
935 self.tabsimi.corpus = self.corpus
936 self.tabsimi.parametres = self.parametres
937 self.graphpan = GraphPanelSimi(self.tabsimi, self.pathout, list_graph)
938 self.graphpan.Bind(wx.EVT_BUTTON, self.redosimi, self.graphpan.butafc)
939 self.graphpan.Bind(wx.EVT_BUTTON, self.export, self.graphpan.butexport)
940 self.tabsimi.AddPage(self.graphpan, 'Graph')
941 self.ira.nb.AddPage(self.tabsimi, 'Analyse de graph')
942 self.ira.ShowTab(True)
943 self.ira.nb.SetSelection(self.ira.nb.GetPageCount() - 1)
945 def redosimi(self, evt) :
946 with open(self.pathout['selected.csv'],'r') as f :
948 selected = [int(val) for val in selected.splitlines()]
949 if self.actives is None :
950 with codecs.open(self.pathout['actives.csv'], 'r', self.parametres['encoding']) as f :
951 self.actives = f.read()
952 self.actives = [act for act in self.actives.splitlines()]
953 dictcol = dict([[i, [act, self.corpus.getlemeff(act)]] for i, act in enumerate(self.actives)])
954 SelectColumn(self.ira, dictcol, self.actives, self.pathout['selected.csv'], selected = selected)
955 prep = PrepSimi(self.ira, self.parametres, indices_simi)
956 self.parametres = prep.parametres
957 script = PrintSimiScript(self)
959 pid = exec_rcode(self.ira.RPath, script.scriptout, wait = True)
960 check_Rresult(self.ira, pid)
961 if self.parametres['type_graph'] == 1:
962 if os.path.exists(self.pathout['liste_graph']):
963 graph_simi = read_list_file(self.pathout['liste_graph'])
964 graph_simi.append([os.path.basename(script.filename), script.txtgraph])
966 graph_simi = [[os.path.basename(script.filename), script.txtgraph]]
967 print_liste(self.pathout['liste_graph'], graph_simi)
968 DoConf().makeoptions([self.parametres['type']], [self.parametres], self.pathout['Analyse.ira'])
969 if self.parametres['type_graph'] == 1:
970 self.graphpan.sizer_3.Add(wx.StaticBitmap(self.graphpan.panel_1, -1, wx.Bitmap(script.filename, wx.BITMAP_TYPE_ANY)), 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
971 self.graphpan.sizer_3.Add(wx.StaticText(self.graphpan.panel_1,-1, script.txtgraph), 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
972 self.graphpan.sizer_3.Fit(self.graphpan.panel_1)
973 self.graphpan.Layout()
974 self.graphpan.panel_1.Scroll(0,self.graphpan.panel_1.GetScrollRange(wx.VERTICAL))
976 def export(self, evt) :
978 # def read_result(self) :
979 # #self.corpus.read_corpus_from_shelves(self.corpus.dictpathout['db'])
980 # #self.corpus.make_et_table()
982 # with open(os.path.join(self.pathout,'glob.txt'), 'r') as f :
983 # self.result['glob'] = f.read()