Merge branch 'master' of 192.168.0.2:/home/pouns/iramuteqNG
[iramuteq] / layout.py
1 #!/bin/env python
2 # -*- coding: utf-8 -*-
3 #Author: Pierre Ratinaud
4 #Copyright (c) 2008-2009 Pierre Ratinaud
5 #Lisense: GNU/GPL
6
7 import os
8 import wx
9 #import wx.lib.agw.aui as aui
10 import agw.aui as aui
11 from chemins import ConstructPathOut, ChdTxtPathOut, FFF, ffr, PathOut, StatTxtPathOut
12 from ConfigParser import ConfigParser
13 from functions import ReadProfileAsDico, GetTxtProfile, read_list_file, ReadList, exec_rcode, print_liste, BugReport, DoConf
14 from ProfList import *
15 from guiparam3d import param3d, simi3d
16 from PrintRScript import write_afc_graph, print_simi3d
17 from profile_segment import *
18 from functions import ReadList
19 from listlex import *
20 from Liste import *
21 from search_tools import SearchFrame
22 from dialog import PrefGraph, PrefExport, PrefSimpleFile, PrefDendro
23 from corpusNG import Corpus
24 import datetime
25 import sys
26 import tempfile
27 import shutil
28 import webbrowser
29 import codecs
30
31 class GraphPanelAfc(wx.Panel):
32     def __init__(self, parent, dico, list_graph, clnb, itempath = 'liste_graph_afc', coding = sys.getdefaultencoding()):
33         wx.Panel.__init__(self,parent)
34         self.afcnb = 1
35         self.clnb = clnb
36         self.Dict = dico
37         self.coding = coding
38         self.itempath = itempath
39         self.parent = self.GetParent()#parent
40         self.SetFont(wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "courier"))
41         self.labels = []
42         self.listimg = []
43         self.TabCHD = self.parent.GetParent()
44         self.nb = self.TabCHD.GetParent()
45         self.ira = self.nb.GetParent()
46         self.panel_1 = wx.ScrolledWindow(self, -1, style=wx.TAB_TRAVERSAL)
47         afc_img = wx.Image(os.path.join(self.ira.images_path,'button_afc.jpg'), wx.BITMAP_TYPE_ANY).ConvertToBitmap()
48         self.butafc = wx.BitmapButton(self, -1, afc_img)
49         self.Bind(wx.EVT_BUTTON, self.afc_graph, self.butafc)
50         self.dirout = os.path.dirname(self.Dict['ira'])
51         for i in range(0,len(list_graph)):
52             if os.path.exists(os.path.join(self.dirout,list_graph[i][0])) :
53                 self.listimg.append(wx.StaticBitmap(self.panel_1, -1, wx.Bitmap(os.path.join(self.dirout,list_graph[i][0]), wx.BITMAP_TYPE_ANY)))
54                 self.labels.append(wx.StaticText(self.panel_1, -1, list_graph[i][1]))
55                 
56         self.param = { 'typegraph' : 0, 
57               'width' : 800,
58               'height' : 800,
59               'what' : 0,
60               'qui' : 0,
61               'do_select_nb' : 0,
62               'do_select_chi' : 0,
63               'select_nb' : 50,
64               'select_chi' : 4,
65               'over' : 0, 
66               'cex_txt' : 0,
67               'txt_min' : 5,
68               'txt_max' : 40,
69               'tchi' : 0,
70               'tchi_min' : 5,
71               'tchi_max' : 40,
72               'taillecar' : 9,
73               'facteur' : [1,2,3],
74               'alpha' : 10,
75               'clnb' : clnb,
76             }
77
78         self.__set_properties()
79         self.__do_layout()
80
81     def __set_properties(self):
82         self.panel_1.EnableScrolling(True,True)
83         #self.panel_1.SetSize((1000,1000))
84         self.panel_1.SetScrollRate(20, 20)
85
86     def __do_layout(self):    
87         self.sizer_1 = wx.BoxSizer(wx.VERTICAL)
88         self.sizer_2 = wx.BoxSizer(wx.HORIZONTAL)
89         self.sizer_3 = wx.BoxSizer(wx.VERTICAL)
90         self.sizer_2.Add(self.butafc, 0, 0, 0)
91         for i in range(0, len(self.listimg)):
92             self.sizer_3.Add(self.listimg[i], 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
93             self.sizer_3.Add(self.labels[i], 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
94         self.panel_1.SetSizer(self.sizer_3)
95         self.sizer_2.Add(self.panel_1, 1, wx.EXPAND, 0)
96         self.SetSizer(self.sizer_2) 
97
98     def afc_graph(self,event):
99         #dirout = os.path.dirname(self.Dict['ira'])
100         while os.path.exists(os.path.join(self.dirout,'graph_afc_'+str(self.afcnb)+'.png')):
101             self.afcnb +=1
102         self.fileout = ffr(os.path.join(self.dirout,'graph_afc_'+str(self.afcnb)+'.png'))
103         dial = PrefGraph(self.parent,-1,self.param,'')
104         dial.CenterOnParent()
105         val = dial.ShowModal()
106         if val == wx.ID_OK :
107             self.param = {'typegraph' : dial.choicetype.GetSelection(),
108                           'width' : dial.spin1.GetValue(),
109                           'height' : dial.spin2.GetValue(),
110                           'what' : dial.choice1.GetSelection(),
111                           'qui' : dial.choice2.GetSelection(),
112                           'do_select_nb' : dial.check1.GetValue(),
113                           'do_select_chi' : dial.check2.GetValue(),
114                           'select_nb' : dial.spin_nb.GetValue(),
115                           'select_chi' : dial.spin_chi.GetValue(),
116                           'over' : dial.check3.GetValue(), 
117                           'cex_txt' : dial.check4.GetValue(),
118                           'txt_min' : dial.spin_min.GetValue(),
119                           'txt_max' : dial.spin_max.GetValue(),
120                           'tchi' : dial.check_tchi.GetValue(),
121                           'tchi_min' : dial.spin_min_tchi.GetValue(),
122                           'tchi_max' : dial.spin_max_tchi.GetValue(),
123                           'taillecar' : dial.spin3.GetValue(),
124                           'facteur' : [dial.spin_f1.GetValue(),dial.spin_f2.GetValue(), dial.spin_f3.GetValue()],
125                           'clnb' : self.clnb,
126                           'film' : str(dial.film.GetValue()).upper(),
127                           'alpha' : dial.slider_sphere.GetValue()
128                         }
129             self.nb.parent = self.ira
130             self.DictPathOut = self.Dict
131             self.RscriptsPath = self.ira.RscriptsPath
132             txt = """
133             load("%s")
134             """ % self.DictPathOut['RData']
135             if self.itempath == 'liste_graph_afcf' :
136                 txt += """
137                 afc <- afcf
138                 afc_table <- afcf_table
139                 chistabletot <- specfp
140                 """ 
141             elif self.itempath == 'liste_graph_afct' :
142                 txt +="""
143                 afc <- afct
144                 afc_table <- afct_table
145                 chistabletot <- spectp
146                 """
147             txt += write_afc_graph(self)
148             filetmp = tempfile.mktemp()
149             file = open(filetmp,'w')
150             file.write(txt)
151             file.close()
152             pid = exec_rcode(self.ira.RPath, filetmp)
153             check_Rresult(self.ira, pid)
154             if self.param['typegraph'] == 0 :
155                 txt = 'Variables '
156                 if self.param['qui'] == 0 : value = u'actives'
157                 if self.param['qui'] == 1 : value = u'supplémentaires'
158                 if self.param['qui'] == 2 : value = u'étoilées'
159                 if self.param['qui'] == 3 : value = u'classes'
160                 txt += value + ' - '
161                 if self.param['what'] == 0 : value = u'Coordonnées'
162                 if self.param['what'] == 1 : value = u'Corrélations'
163                 txt += value + u' - facteur %i / %i' % (self.param['facteur'][0], self.param['facteur'][1])
164                 if self.param['do_select_nb'] : txt += u' - sélection de %i variables' % self.param['select_nb']
165                 if self.param['do_select_chi'] : txt += u' - sélection des variables avec chi2 > %i ' % self.param['select_chi']
166                 if self.param['over'] : txt += u' - Eviter les recouvrements'
167                 if self.param['cex_txt'] : txt += u' - taille du texte proportionnel à la masse'
168                 if self.param['tchi'] : txt += u' - taille du texte proportionnel au chi2 d\'association'
169                 list_graph = read_list_file(self.DictPathOut[self.itempath], self.coding)
170                 list_graph.append([self.fileout, txt])
171                 print_liste(self.DictPathOut[self.itempath], list_graph)
172                 self.sizer_3.Add(wx.StaticBitmap(self.panel_1, -1, wx.Bitmap(self.fileout, wx.BITMAP_TYPE_ANY)), 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
173                 self.sizer_3.Add(wx.StaticText(self.panel_1,-1, txt), 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
174                 self.sizer_3.Fit(self.panel_1)
175                 self.Layout()
176     
177                 self.panel_1.Scroll(0,self.panel_1.GetScrollRange(wx.VERTICAL))
178             
179
180 class GraphPanel(wx.ScrolledWindow):
181     def __init__(self, parent, dico, list_graph, txt = '', style = wx.TAB_TRAVERSAL):
182         wx.ScrolledWindow.__init__(self, parent, style = style)
183         self.Dict = dico
184         self.txt = txt
185         self.parent = parent
186         self.SetFont(wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "courier"))
187         self.labels = []
188         self.listimg = []
189         self.dirout = os.path.dirname(self.Dict['ira'])
190         self.deb = wx.StaticText(self, -1, txt)
191         for i in range(0,len(list_graph)):
192             if os.path.exists(os.path.join(self.dirout,list_graph[i][0])) :
193                 self.listimg.append(wx.StaticBitmap(self, -1, wx.Bitmap(os.path.join(self.dirout,list_graph[i][0]), wx.BITMAP_TYPE_ANY)))
194                 self.labels.append(wx.StaticText(self, -1, list_graph[i][1]))
195                 
196         self.__set_properties()
197         self.__do_layout()
198
199     def __set_properties(self):
200         self.SetScrollRate(20, 20)   
201
202     def __do_layout(self):
203         self.sizer_1 = wx.BoxSizer(wx.VERTICAL)
204         self.sizer_2 = wx.BoxSizer(wx.VERTICAL)
205         self.sizer_3 = wx.BoxSizer(wx.HORIZONTAL)
206         self.sizer_1.Add(self.deb)   
207         for i in range(0, len(self.listimg)):
208             self.sizer_1.Add(self.listimg[i], 1, wx.ALIGN_CENTER_HORIZONTAL, 0)
209             self.sizer_1.Add(self.labels[i], 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
210         self.sizer_2.Add(self.sizer_1, 1, wx.EXPAND, 0)
211         self.SetSizer(self.sizer_1)
212         self.sizer_1.Fit(self)
213         
214 class OpenCHDS():
215     def __init__(self, parent, corpus, parametres, Alceste=False):
216        #sep = u'\n ' 
217        sep=' '
218        self.parent = parent
219        self.corpus = corpus
220        self.parametres = parametres
221        self.pathout = PathOut(parametres['ira'])
222        self.pathout.basefiles(ChdTxtPathOut)
223        DictPathOut = self.pathout 
224        self.DictPathOut = DictPathOut
225        self.parent = parent
226
227        Profile = DictPathOut['PROFILE_OUT']
228        AntiProfile = DictPathOut['ANTIPRO_OUT']
229        if isinstance(self.corpus, Corpus) :
230             self.encoding = self.corpus.parametres['syscoding']
231             self.corpus.make_ucecl_from_R(self.pathout['uce'])
232        elif 'tableau' in dir(gparent) :
233             self.encoding = gparent.tableau.parametres['syscoding']
234
235        #AnalyseConf = ConfigParser()
236        #AnalyseConf.readfp(codecs.open(filename,'r', self.encoding))
237        #AnalyseConf.read(filename)
238        #if 'analyse' in AnalyseConf.sections() :
239        #    section = 'analyse'
240        #elif 'questionnaire' in AnalyseConf.sections() :
241        #    section = 'questionnaire'
242        #elif 'chd_dist_quest' in AnalyseConf.sections() :
243        #    section = 'chd_dist_quest'
244        #self.section = section
245        #clnb = AnalyseConf.get(section, 'clusternb')
246        #clnb = int(clnb)
247        clnb = parametres['clnb']
248        dlg = progressbar(self, maxi = 4 + clnb) 
249        self.clnb = clnb 
250        corpname = self.corpus.parametres['corpus_name']
251        print 'lecture des profils'
252        dlg.Update(2, u'lecture des profils')
253  
254        DictProfile = ReadProfileAsDico(self, Profile, Alceste, self.encoding)
255        self.DictProfile = DictProfile
256        print 'lecture des antiprofils'
257        DictAnti = ReadProfileAsDico(self, AntiProfile, Alceste, self.encoding)
258
259        panel = wx.Panel(parent, -1)
260        sizer1 = wx.BoxSizer(wx.VERTICAL)
261
262        panel.chd_toolbar = wx.ToolBar(panel, -1, wx.DefaultPosition, wx.DefaultSize, wx.TB_FLAT | wx.TB_NODIVIDER)
263        panel.chd_toolbar.SetToolBitmapSize(wx.Size(16, 16))
264
265        if isinstance(self.corpus, Corpus) :
266            panel.corpus = self.corpus
267            self.ID_sg = wx.NewId()
268            butsg = wx.Button(panel.chd_toolbar, self.ID_sg, u"Profils des segments répétés ")
269            panel.chd_toolbar.AddControl(butsg)
270            panel.chd_toolbar.AddSeparator()
271            self.ID_export = wx.NewId() 
272            butexp = wx.Button(panel.chd_toolbar, self.ID_export, u"Exporter le corpus ")
273            panel.chd_toolbar.AddControl(butexp)
274            panel.chd_toolbar.AddSeparator()
275            self.ID_colored = wx.NewId()
276            butcol = wx.Button(panel.chd_toolbar, self.ID_colored, u"Corpus en couleur ")
277            panel.chd_toolbar.AddControl(butcol)
278            panel.chd_toolbar.AddSeparator()
279            self.ID_searchf = wx.NewId()
280            butsearchf = wx.Button(panel.chd_toolbar, self.ID_searchf, u"Outil de navigation ")
281            panel.chd_toolbar.AddControl(butsearchf)
282            panel.chd_toolbar.AddSeparator()
283
284            self.ID_proftype =wx.NewId()
285            butpt = wx.Button(panel.chd_toolbar, self.ID_proftype, u"Profils des types ")
286            panel.chd_toolbar.AddControl(butpt)
287            panel.chd_toolbar.AddSeparator()
288
289            self.ID_clusterstat =wx.NewId()
290            butclusterstat = wx.Button(panel.chd_toolbar, self.ID_clusterstat, u"Stat par classe ")
291            panel.chd_toolbar.AddControl(butclusterstat)
292            panel.chd_toolbar.AddSeparator()
293
294
295        self.ID_rapport = wx.NewId()
296        #rap_img = wx.Image(os.path.join(self.parent.images_path,'icone_rap_16.png'), wx.BITMAP_TYPE_ANY).ConvertToBitmap()
297        #panel.chd_toolbar.AddLabelTool(self.ID_rapport, "rapport", rap_img, shortHelp=u"Produire le rapport", longHelp=u"Exporter un rapport en texte simple")
298        butrap = wx.Button(panel.chd_toolbar, self.ID_rapport, u"Rapport ")
299        panel.chd_toolbar.AddControl(butrap)
300        
301        panel.chd_toolbar.Realize()
302        sizer1.Add(panel.chd_toolbar,0, wx.EXPAND, 5)
303
304        #self.TabChdSim = wx.aui.AuiNotebook(self.parent.nb, -1, wx.DefaultPosition)
305        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
306        panel.TabChdSim = aui.AuiNotebook(panel, -1, wx.DefaultPosition)
307        panel.TabChdSim.SetAGWWindowStyleFlag(notebook_flags)
308        panel.TabChdSim.SetArtProvider(aui.ChromeTabArt())
309        sizer1.Add(panel.TabChdSim,10, wx.EXPAND, 5)
310        panel.SetSizer(sizer1)
311        sizer1.Fit(panel)
312        
313
314        if isinstance(self.corpus, Corpus) :
315            panel.TabChdSim.corpus = corpus
316            panel.TabChdSim.corpus.dictpathout = self.DictPathOut
317            panel.parametres = self.parametres
318
319        self.notenb = self.parent.nb.GetPageCount()
320        if os.path.exists(DictPathOut['pre_rapport']):
321            #self.tabRap = wx.TextCtrl(self.TabChdSim, -1, "", style=wx.TE_MULTILINE | wx.TE_RICH2)
322            #self.tabRap.SetFont(wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "courier"))
323            with codecs.open(DictPathOut['pre_rapport'], 'r', self.encoding) as f :
324                 txt = f.read()
325            #self.tabRap.write(txt)
326            #self.tabRap.ShowPosition(0)
327            self.debtext = txt
328        else :
329            self.debtext = ''
330            
331        if os.path.exists(self.DictPathOut['liste_graph_chd']) :
332            list_graph = read_list_file(self.DictPathOut['liste_graph_chd'], self.encoding)
333            CHD = GraphPanelDendro(panel.TabChdSim, DictPathOut, list_graph, txt = self.debtext)
334            panel.TabChdSim.AddPage(CHD,'CHD')
335                
336        panel.ProfNB = aui.AuiNotebook(panel, -1, wx.DefaultPosition)
337        panel.ProfNB.SetArtProvider(aui.ChromeTabArt())
338        #self.ProfNB.SetTabCtrlHeight(100)
339        panel.AntiProfNB = aui.AuiNotebook(panel, -1, wx.DefaultPosition)
340        if os.path.exists(DictPathOut['prof_seg']) :
341             prof_seg = ReadProfileAsDico(self, DictPathOut['prof_seg'], False, self.encoding)
342             self.prof_seg_nb = aui.AuiNotebook(panel, -1, wx.DefaultPosition)
343        for i in range(0, clnb):
344             dlg.Update(3+i, 'Classe %i' %(i+1))
345             ind = '/'.join(DictProfile[str(i + 1)][0][0:2])
346             indpour = ' - '.join([ind, DictProfile[str(i + 1)][0][2]])
347             print 'construction liste classe %i' % i
348             self.tabprofile = ProfListctrlPanel(self.parent, self, DictProfile[str(i + 1)], Alceste, i + 1)
349             self.tabantiprofile = ProfListctrlPanel(self.parent, self, DictAnti[str(i + 1)], Alceste, i + 1)
350             panel.ProfNB.AddPage(self.tabprofile, 'classe %s %s(%s%%)' % (str(i + 1), sep, indpour))
351             panel.AntiProfNB.AddPage(self.tabantiprofile, 'classe %s' % str(i + 1))
352             if os.path.exists(DictPathOut['prof_seg']) :
353                 self.tab_prof_seg = ProfListctrlPanel(self.parent, self, prof_seg[str(i + 1)], False, i + 1)
354                 self.prof_seg_nb.AddPage(self.tab_prof_seg, 'classe %i' % (i + 1))
355
356        if clnb > 2 :
357            self.TabAFC = aui.AuiNotebook(panel.TabChdSim, -1, wx.DefaultPosition)
358     
359            list_graph=read_list_file(DictPathOut['liste_graph_afc'], self.encoding)
360            self.tabAFCGraph = GraphPanelAfc(self.TabAFC, DictPathOut, list_graph, self.clnb, coding=self.encoding)
361            self.TabAFC.AddPage(self.tabAFCGraph, 'AFC')
362            
363            if os.path.exists(self.DictPathOut['afc_facteur']) :
364                dictrow, first = ReadList(self.DictPathOut['afc_facteur'], self.encoding)
365                self.TabAFC_facteur = ListForSpec(self.parent, parametres, dictrow, first)
366                dictrow, first = ReadList(self.DictPathOut['afc_row'], self.encoding)
367                self.TabAFC_ligne = ListForSpec(self.parent, self.parametres, dictrow, first)
368                dictrow, first = ReadList(self.DictPathOut['afc_col'], self.encoding)
369                self.TabAFC_colonne = ListForSpec(parent, self.parametres, dictrow, first)
370                self.TabAFC.AddPage(self.TabAFC_facteur, 'Facteurs')
371                self.TabAFC.AddPage(self.TabAFC_colonne, u'Colonnes')
372                self.TabAFC.AddPage(self.TabAFC_ligne, u'Lignes')
373            
374            sizer_3 = wx.BoxSizer(wx.VERTICAL)
375            self.parent.nb_panel_2 = wx.Panel(panel.TabChdSim, -1)
376            self.parent.button_simi = wx.Button(self.parent.nb_panel_2, -1, "Voyager")
377            self.parent.simi3dpanel = simi3d(self.parent.nb_panel_2, -1)
378            sizer_3.Add(self.parent.simi3dpanel, 1, wx.EXPAND, 0)
379            sizer_3.Add(self.parent.button_simi, 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
380            self.parent.nb_panel_2.SetSizer(sizer_3)
381            self.TabAFC.AddPage(self.parent.nb_panel_2, "graph 3D")
382            self.parent.Bind(wx.EVT_BUTTON, self.onsimi, self.parent.button_simi)
383        
384        panel.TabChdSim.AddPage(panel.ProfNB, 'Profils')
385        panel.TabChdSim.AddPage(panel.AntiProfNB, 'Antiprofils')
386        dlg.Update(4 + self.clnb, 'Affichage...')
387        if clnb > 2 :
388            panel.TabChdSim.AddPage(self.TabAFC, 'AFC')
389        if os.path.exists(DictPathOut['prof_seg']) :
390            panel.TabChdSim.AddPage(self.prof_seg_nb, u'Profils des segments répétés')
391       
392        if isinstance(self.corpus, Corpus) :
393            panel.Bind(wx.EVT_BUTTON, self.on_export_classes, id = self.ID_export)
394            panel.Bind(wx.EVT_BUTTON, self.onprofseg, id = self.ID_sg)
395            panel.Bind(wx.EVT_BUTTON, self.oncolored, id = self.ID_colored)
396            panel.Bind(wx.EVT_BUTTON, self.onsearchf, id = self.ID_searchf)
397            panel.Bind(wx.EVT_BUTTON, self.onproftype, id = self.ID_proftype)
398            panel.Bind(wx.EVT_BUTTON, self.onclusterstat, id = self.ID_clusterstat)
399
400        panel.Bind(wx.EVT_BUTTON, self.ongetrapport, id = self.ID_rapport)
401        self.parent.nb.AddPage(panel, 'Classification - %s' % corpname)
402        self.parent.ShowTab(True)
403        self.parent.nb.SetSelection(self.parent.nb.GetPageCount() - 1)     
404        #for pane in self.parent._mgr.GetAllPanes() :
405        #     if isinstance(pane.window, aui.AuiNotebook):
406        #         nb = pane.window
407        #         nb.SetAGWWindowStyleFlag(notebook_flags)
408        #         nb.SetArtProvider(aui.ChromeTabArt())
409        dlg.Destroy() 
410        self.parent._mgr.Update()
411         
412     def onsimi(self,event):
413         outfile = print_simi3d(self)
414         error = exec_rcode(self.parent.RPath, outfile, wait = True)
415
416     def ongetrapport(self, event) :
417         dial = PrefSimpleFile(self, self.parent, **{'mask' : '*.txt', 'title': 'Rapport'})
418         dial.fbb.SetValue(self.DictPathOut['rapport'])
419         dial.CenterOnParent()
420         res = dial.ShowModal()
421         if res == wx.ID_OK :
422             fileout = dial.fbb.GetValue()
423             dial.Destroy()
424             with open(fileout, 'w') as f :
425                 f.write(self.debtext + '\n' + GetTxtProfile(self.DictProfile))
426             msg = u"Fini !"
427             dlg = wx.MessageDialog(self.parent, msg, u"Rapport", wx.OK | wx.NO_DEFAULT | wx.ICON_INFORMATION)
428             dlg.CenterOnParent()
429             dlg.ShowModal()
430             dlg.Destroy()
431         else :
432             dial.Destroy()
433
434     def on_export_classes(self, event) :
435         corpus = self.parent.nb.GetPage(self.parent.nb.GetSelection()).corpus
436         dial = PrefExport(self, self.parent)
437         dial.fbb.SetValue(os.path.join(os.path.dirname(corpus.dictpathout['ira']), 'export_corpus.txt'))
438         dial.CenterOnParent()
439         res = dial.ShowModal()
440         if res == wx.ID_OK :
441             if dial.radio_type.GetSelection() == 0 : alc = True
442             else : alc = False
443             if dial.radio_lem.GetSelection() == 0 : lem = True
444             else : lem = False
445             self.corpus.export_corpus_classes(dial.fbb.GetValue(), alc = alc, lem = lem)
446             msg = u"Fini !"
447             dial.Destroy()
448             dlg = wx.MessageDialog(self.parent, msg, u"Export", wx.OK | wx.NO_DEFAULT | wx.ICON_INFORMATION)
449             dlg.CenterOnParent()
450             dlg.ShowModal()
451             dlg.Destroy()
452
453     def onprofseg(self, event):
454         try :
455             corpus = self.parent.nb.GetPage(self.parent.nb.GetSelection()).corpus
456             ProfileSegment(self.parent,corpus)
457         except :
458             BugReport(self.parent)
459
460     def onproftype(self, event):
461         try :
462             corpus = self.parent.nb.GetPage(self.parent.nb.GetSelection()).corpus
463             ProfilType(self.parent, corpus)
464         except :
465             BugReport(self.parent)
466
467     def oncolored(self,evt) :
468         dial = PrefSimpleFile(self, self.parent, **{'mask' : '*.html', 'title': 'Corpus en couleur'})
469         dial.fbb.SetValue(os.path.join(os.path.dirname(self.corpus.dictpathout['ira']), 'corpus_couleur.html'))
470         dial.CenterOnParent()
471         res = dial.ShowModal()
472         if res == wx.ID_OK :
473             fileout = dial.fbb.GetValue()
474             dial.Destroy()
475             txt = self.corpus.make_colored_corpus()
476             with open(fileout, 'w') as f :
477                 f.write(txt)
478             msg = u"Fini !\nVoulez-vous ouvrir le corpus dans votre navigateur ?"
479             dlg = wx.MessageDialog(self.parent, msg, u"Corpus en couleur", wx.NO | wx.YES | wx.NO_DEFAULT | wx.ICON_QUESTION)
480             dlg.CenterOnParent()
481             if dlg.ShowModal() == wx.ID_YES :
482                 webbrowser.open(fileout)
483             dlg.Destroy()
484
485     def onclusterstat(self, evt) :
486         dial = PrefSimpleFile(self, self.parent, **{'mask' : '*.csv', 'title': 'Stat par classe'})
487         dial.fbb.SetValue( os.path.join(os.path.dirname(self.corpus.dictpathout['ira']), 'stat_par_classe.csv'))
488         dial.CenterOnParent()
489         res = dial.ShowModal()
490         if res == wx.ID_OK :
491             fileout = dial.fbb.GetValue()
492             dial.Destroy()
493             print fileout
494             self.corpus.get_stat_by_cluster(fileout)
495             msg = u"Fini !"
496             dlg = wx.MessageDialog(self.parent, msg, u"Stat par classe", wx.OK | wx.NO_DEFAULT | wx.ICON_INFORMATION)
497             dlg.CenterOnParent()
498             if dlg.ShowModal() == wx.ID_OK :
499                 dlg.Destroy()
500
501     def onsearchf(self, evt) :
502         if 'FrameSearch' not in dir(self.parent) :
503             self.parent.FrameSearch = SearchFrame(self.parent, -1, u"Rechercher...", self.corpus)
504         self.parent.FrameSearch.Show()
505     
506         
507
508 def PrintRapport(self, corpus, parametres, txt = True):
509     #if sys.platform == 'win32':
510     #    sep = '\r\n'
511     #else:
512     sep = '\n'
513     txt = """
514 +-+-+-+-+-+-+-+-+
515 |i|R|a|M|u|T|e|Q| - %s
516 +-+-+-+-+-+-+-+-+
517
518
519 """ % datetime.datetime.now().ctime()
520     totocc = corpus.gettotocc()
521     if txt :
522         txt += u'nombre d\'uci: %i%s' % (corpus.getucinb(), sep)
523         txt += u'nombre d\'uce: %i%s' % (corpus.getucenb(), sep)
524         txt += u'nombre de formes: %i%s' % (len(corpus.formes), sep)
525         txt += u'nombre d\'occurrences: %i%s' % (totocc, sep)
526         txt += u'moyenne d\'occurrences par forme: %f%s' % (float(totocc) / float(len(self.corpus.formes)), sep)
527         txt += u'nombre de lemmes: %i%s' % (len(corpus.lems), sep)
528         txt += u'nombre de formes actives: %i%s' % (corpus.getactivesnb(1), sep)
529         txt += u'nombre de formes supplémentaires: %i%s' % (corpus.getactivesnb(2), sep)
530         txt += u'nombre de formes actives de fréquence >= %i: %i%s' % (parametres['eff_min_forme'], parametres['nbactives'], sep)
531         txt += u'moyenne d\'occurrences par uce :%f%s' % (float(totocc) / float(corpus.getucenb()), sep)
532         if 'tailleuc1' in parametres :
533             if parametres['classif_mode'] != 0 :
534                 txt += u'taille uc1 : %i\n' % parametres['tailleuc1']
535             else:
536                 txt += u'taille uc1 / uc2: %i / %i - %i / %i%s' % (parametres['tailleuc1'], parametres['tailleuc2'], parametres['lenuc1'], parametres['lenuc2'], sep)
537     elif not txt :
538         self.Ucenb = self.nbind
539         txt += u'nombre d\'individus : %i%s' % (self.nbind, sep)
540         txt += u'nombre de classes : %i%s' % (self.clnb, sep)
541     if txt :
542         txt += u'nombre de classes : %i%s' % (parametres['clnb'], sep)
543         if parametres['classif_mode'] == 0 or parametres['classif_mode'] == 1 :
544             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)
545         elif self.parametres['classif_mode'] == 2 :
546             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)
547     elif analyse == 'quest' :
548         txt += u'%i uce classées sur %i (%.2f%%)%s' % (self.ucecla, self.Ucenb, (float(self.ucecla) / float(self.Ucenb)) * 100, sep)
549  
550     txt += """
551 ###########################
552 temps d'analyse : %s
553 ###########################
554 """ % parametres['time']
555     file = open(self.pathout['pre_rapport'], 'w')
556     file.write(txt)
557     file.close()
558
559 class dolexlayout :
560     def __init__(self, ira, corpus, parametres):
561         self.pathout = PathOut(dirout = parametres['pathout'])
562         self.corpus = corpus
563         self.dictpathout = StatTxtPathOut(parametres['pathout'])
564         #self.corpus.read_corpus_from_shelves(self.corpus.dictpathout['db'])
565         self.parent = ira
566         self.encoding = self.corpus.parametres['syscoding']
567         self.parametres = parametres
568
569         self.DictSpec, first = ReadList(self.dictpathout['tablespecf'], self.corpus.parametres['syscoding'])
570         self.DictType, firstt = ReadList(self.dictpathout['tablespect'], self.corpus.parametres['syscoding'])
571         self.DictEff, firsteff = ReadList(self.dictpathout['tableafcm'], self.corpus.parametres['syscoding'])
572         self.DictEffType, firstefft = ReadList(self.dictpathout['tabletypem'], self.corpus.parametres['syscoding'])
573         self.DictEffRelForme, firsteffrelf = ReadList(self.dictpathout['eff_relatif_forme'], self.corpus.parametres['syscoding']) 
574         self.DictEffRelType, firsteffrelt = ReadList(self.dictpathout['eff_relatif_type'], self.corpus.parametres['syscoding'])    
575         
576         self.TabStat = aui.AuiNotebook(ira.nb, -1, wx.DefaultPosition)
577         self.TabStat.parametres = parametres
578         self.ListPan = ListForSpec(ira, self.parent, self.DictSpec, first)
579         self.ListPant = ListForSpec(ira, self.parent, self.DictType, firstt)
580         self.ListPanEff = ListForSpec(ira, self.parent, self.DictEff, firsteff)
581         self.ListPanEffType = ListForSpec(ira, self.parent, self.DictEffType, firstefft)
582         self.ListPanEffRelForme = ListForSpec(ira, self.parent, self.DictEffRelForme, firsteffrelf)
583         self.ListPanEffRelType = ListForSpec(ira, self.parent, self.DictEffRelType, firsteffrelt)
584         
585         self.TabStat.AddPage(self.ListPan, u'formes') 
586         self.TabStat.AddPage(self.ListPant, u'Types')
587         self.TabStat.AddPage(self.ListPanEff, u'Effectifs formes')
588         self.TabStat.AddPage(self.ListPanEffType, u'Effectifs Type')
589         self.TabStat.AddPage(self.ListPanEffRelForme, u'Effectifs relatifs formes')
590         self.TabStat.AddPage(self.ListPanEffRelType, u'Effectifs relatifs Type')
591         if self.parametres['clnb'] > 2 :
592            self.TabAFC = aui.AuiNotebook(self.TabStat, -1, wx.DefaultPosition)
593            list_graph=read_list_file(self.dictpathout['liste_graph_afcf'], encoding = self.encoding)
594            self.tabAFCGraph = GraphPanelAfc(self.TabAFC, self.dictpathout, list_graph, self.parametres['clnb'], itempath ='liste_graph_afcf', coding = self.encoding)
595            self.TabAFC.AddPage(self.tabAFCGraph, 'AFC formes')
596            list_graph=read_list_file(self.dictpathout['liste_graph_afct'], encoding = self.encoding)
597            self.tabAFCTGraph = GraphPanelAfc(self.TabAFC, self.dictpathout, list_graph, self.parametres['clnb'], itempath ='liste_graph_afct', coding=self.encoding)
598            self.TabAFC.AddPage(self.tabAFCTGraph, 'AFC type')
599            self.TabStat.AddPage(self.TabAFC, 'AFC')
600            
601         
602         ira.nb.AddPage(self.TabStat, u'Spécificités')
603         
604         self.TabStat.corpus = self.corpus
605         ira.nb.SetSelection(self.parent.nb.GetPageCount() - 1)
606         ira.ShowAPane("Tab_content")
607
608 class StatLayout:
609     def __init__(self, ira, corpus, parametres):
610         self.pathout = PathOut(dirout = os.path.dirname(parametres['pathout']))
611         self.corpus = corpus
612         self.ira = ira
613         self.read_result()
614         self.TabStat = aui.AuiNotebook(ira.nb, -1, wx.DefaultPosition)
615         self.TabStat.parametres = parametres
616 #        CHD = GraphPanel(panel.TabChdSim, DictPathOut, list_graph, txt = self.debtext)
617          #      panel.TabChdSim.AddPage(CHD,'CHD')
618
619         #self.TabStatTot = wx.TextCtrl(self.TabStat, -1, style=wx.NO_BORDER | wx.TE_MULTILINE | wx.TE_RICH2)
620         list_graph = [['zipf.png', 'zipf']]
621         self.TabStatTot = GraphPanel(ira.nb, self.pathout, list_graph, self.result['glob'])
622         #self.TabStatTot.write(self.result['glob'])
623         self.TabStat.AddPage(self.TabStatTot, 'global')
624         for item in self.result:
625             if item != 'glob':
626                 datam = [['forme', 'nb']]
627                 self.ListPan = ListPanel(ira, self, self.result[item])
628                 self.TabStat.AddPage(self.ListPan, item) 
629         ira.nb.AddPage(self.TabStat, 'Stat')
630         ira.nb.SetSelection(ira.nb.GetPageCount() - 1)
631         ira.ShowAPane("Tab_content")
632
633     def read_result(self) :
634         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'}
635         self.result = {}
636         for key in lcle :
637             with open(self.pathout[lcle[key]], 'r') as f :
638                 self.result[key] = [line.split(';') for line in f.read().splitlines()]
639                 self.result[key] = dict([[i,[line[0],int(line[1]), line[2]]] for i, line in enumerate(self.result[key])])
640         with open(self.pathout['glob.txt'], 'r') as f :
641             self.result['glob'] = f.read()
642
643 class GraphPanelDendro(wx.Panel):
644     def __init__(self,parent, dico, list_graph, txt=False):
645         wx.Panel.__init__(self,parent)
646         self.graphnb = 1
647         self.dictpathout = dico
648         self.dirout = os.path.dirname(self.dictpathout['ira'])
649         self.list_graph = list_graph
650         self.parent = self.GetParent()#parent
651         self.SetFont(wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "courier"))
652         self.labels = []
653         self.listimg = []
654         self.tabchd = self.parent.GetParent()
655         self.ira = self.tabchd.GetParent()
656         self.panel_1 = wx.ScrolledWindow(self, -1, style=wx.TAB_TRAVERSAL)
657         self.deb = wx.StaticText(self.panel_1, -1, txt)
658         dendro_img = wx.Image(os.path.join(self.ira.images_path,'but_dendro.png'), wx.BITMAP_TYPE_ANY).ConvertToBitmap()
659         self.butdendro = wx.BitmapButton(self, -1, dendro_img)
660         
661         for i in range(0,len(list_graph)):
662             if os.path.exists(os.path.join(self.dirout,list_graph[i][0])) :
663                 self.listimg.append(wx.StaticBitmap(self.panel_1, -1, wx.Bitmap(os.path.join(self.dirout,list_graph[i][0]), wx.BITMAP_TYPE_ANY)))
664                 self.labels.append(wx.StaticText(self.panel_1, -1, list_graph[i][1]))
665                 
666         self.__set_properties()
667         self.__do_layout()
668
669     def __set_properties(self):
670         self.panel_1.EnableScrolling(True,True)
671         #self.panel_1.SetSize((1000,1000))
672         self.panel_1.SetScrollRate(20, 20)
673         self.Bind(wx.EVT_BUTTON, self.ondendro, self.butdendro)
674         self.param = {'width' : 700,
675                        'height': 500,
676                        'type_dendro': 0,
677                        'color_nb': 0,
678                        'taille_classe' : True,
679                        'type_tclasse' : 0
680                      }
681         self.type_dendro = [ u"phylogram", u"cladogram", u"fan", u"unrooted", u"radial" ]
682
683     def __do_layout(self):    
684         self.sizer_1 = wx.BoxSizer(wx.VERTICAL)
685         self.sizer_2 = wx.BoxSizer(wx.HORIZONTAL)
686         self.sizer_3 = wx.BoxSizer(wx.VERTICAL)
687         self.sizer_3.Add(self.deb)
688         self.sizer_2.Add(self.butdendro, 0, 0, 0)
689         for i in range(0, len(self.listimg)):
690             self.sizer_3.Add(self.listimg[i], 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
691             self.sizer_3.Add(self.labels[i], 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
692         self.panel_1.SetSizer(self.sizer_3)
693         self.sizer_2.Add(self.panel_1, 1, wx.EXPAND, 0)
694         self.SetSizer(self.sizer_2) 
695
696     def make_param(self, dial):
697         self.param['width'] = dial.m_spinCtrl2.GetValue()
698         self.param['height'] = dial.m_spinCtrl1.GetValue()
699         self.param['type_dendro'] = dial.m_choice1.GetSelection()
700         self.param['color_nb'] = dial.m_radioBox1.GetSelection()
701         self.param['taille_classe'] = dial.m_checkBox1.GetValue()
702         self.param['type_tclasse'] = dial.m_radioBox2.GetSelection()
703
704     def make_dendro(self) :
705         while os.path.exists(os.path.join(self.dirout, 'dendrogamme_' + str(self.graphnb)+'.png')) :
706             self.graphnb += 1
707         fileout = ffr(os.path.join(self.dirout,'dendrogamme_' + str(self.graphnb)+'.png'))
708         width = self.param['width']
709         height = self.param['height']
710         type_dendro = self.type_dendro[self.param['type_dendro']]
711         if self.param['taille_classe'] :
712             tclasse = 'TRUE'
713         else :
714             tclasse = 'FALSE'
715         if self.param['color_nb'] == 0 :
716             bw = 'FALSE'
717         else :
718             bw = 'TRUE'
719         if self.param['type_tclasse'] == 0 :
720             histo='FALSE'
721         else :
722             histo = 'TRUE'
723         dendro_path = self.dictpathout['Rdendro']
724         classe_path = self.dictpathout['uce']
725         txt = """
726         library(ape)
727         load("%s")
728         source("%s")
729         classes <- read.csv2("%s", row.names=1)
730         classes <- classes[,1]
731         open_file_graph("%s", width=%i, height=%i)
732         plot.dendropr(tree.cut1$tree.cl, classes, type.dendro="%s", histo=%s, bw=%s, lab=NULL, tclasse=%s)
733         """ % (ffr(dendro_path), ffr(self.ira.RscriptsPath['Rgraph']), ffr(classe_path), ffr(fileout), width, height, type_dendro, histo, bw, tclasse)
734         
735         tmpfile = tempfile.mktemp()
736         with open(tmpfile, 'w') as f :
737             f.write(txt)
738         error = exec_rcode(self.ira.RPath, tmpfile, wait=True) 
739         check_Rresult(self.ira, error)
740         self.list_graph.append([fileout, 'Dendrogramme CHD1 - %s' %  type_dendro])
741         print_liste(self.dictpathout['liste_graph_chd'], self.list_graph)
742         self.sizer_3.Add(wx.StaticBitmap(self.panel_1, -1, wx.Bitmap(fileout, wx.BITMAP_TYPE_ANY)), 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
743         self.sizer_3.Add(wx.StaticText(self.panel_1,-1, 'Dendrogramme CHD1 - %s' %  type_dendro), 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
744         self.sizer_3.Fit(self.panel_1)
745         self.Layout()
746         self.panel_1.Scroll(0,self.panel_1.GetScrollRange(wx.VERTICAL))
747
748
749     def ondendro(self, evt):
750         dial = PrefDendro(self.ira, self.param)
751         val = dial.ShowModal()
752         if val == wx.ID_OK :
753             self.make_param(dial)
754             self.make_dendro()
755
756 class WordCloudLayout:
757     def __init__(self, ira, parent, filename):
758         self.dictpathout = parent.corpus.dictpathout
759         self.pathout = os.path.dirname(filename)
760         self.corpus = parent.corpus
761     #    self.read_result()
762         self.Tab = aui.AuiNotebook(ira.nb, -1, wx.DefaultPosition)
763         list_graph = [['nuage_1.png', 'Nuage']]
764         self.TabStatTot = GraphPanel(ira.nb, self.dictpathout, list_graph)
765         #self.TabStatTot.write(self.result['glob'])
766         self.Tab.AddPage(self.TabStatTot, 'Nuage')
767         self.Tab.corpus = parent.corpus
768         ira.nb.AddPage(self.Tab, 'WordCloud %s' % parent.conf.get('wordcloud','corpus_name'))
769         ira.nb.SetSelection(ira.nb.GetPageCount() - 1)
770         ira.ShowAPane("Tab_content")
771
772 class OpenCorpus :
773     def __init__(self, ira, parametres) :
774         #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)
775         self.panel = CopusPanel(ira, parametres)
776         ira.nb.AddPage(self.panel, 'Description %s' % parametres['corpus_name'])
777         #self.text.write(DoConf().totext(parametres))
778         ira.nb.SetSelection(ira.nb.GetPageCount() - 1)
779         ira.ShowAPane("Tab_content")
780
781 class CopusPanel(wx.Panel) :
782     def __init__(self, parent, parametres) :
783         wx.Panel.__init__ ( self, parent, id = wx.ID_ANY, pos = wx.DefaultPosition, size = wx.Size( 500,300 ), style = wx.TAB_TRAVERSAL )
784         self.parametres = parametres
785         fgSizer5 = wx.FlexGridSizer( 0, 2, 0, 0 )
786         fgSizer5.SetFlexibleDirection( wx.BOTH )
787         fgSizer5.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )        
788         self.fgSizer5 = fgSizer5
789         
790         self.m_staticText18 = wx.StaticText( self, wx.ID_ANY, u"Description du corpus", wx.DefaultPosition, wx.DefaultSize, 0 )
791
792         self.m_staticText18.Wrap( -1 )
793         fgSizer5.Add( self.m_staticText18, 0, wx.ALL, 5 )
794         
795         self.m_staticText19 = wx.StaticText( self, wx.ID_ANY, u"", wx.DefaultPosition, wx.DefaultSize, 0 )
796         self.m_staticText19.Wrap( -1 )
797         fgSizer5.Add( self.m_staticText19, 0, wx.ALL, 5 )
798
799         self.m_staticText20 = wx.StaticText( self, wx.ID_ANY, u"Nom", wx.DefaultPosition, wx.DefaultSize, 0 )
800         self.m_staticText20.Wrap( -1 )
801         fgSizer5.Add( self.m_staticText20, 0, wx.ALL, 5 )
802         
803         self.m_staticText21 = wx.StaticText( self, wx.ID_ANY, parametres['corpus_name'], wx.DefaultPosition, wx.DefaultSize, 0 )
804         self.m_staticText21.Wrap( -1 )
805         fgSizer5.Add( self.m_staticText21, 0, wx.ALL, 5 )
806
807         description = {'lang' : u'langue',
808                         'encoding' : u'encodage'}
809
810         keys = ['lang', 'encoding', 'originalpath', 'pathout', 'date', 'time']
811
812         self.addkeys(keys, description)
813
814         self.m_staticText18 = wx.StaticText( self, wx.ID_ANY, u"Paramètres", wx.DefaultPosition, wx.DefaultSize, 0 )
815         self.m_staticText18.Wrap( -1 )
816         fgSizer5.Add( self.m_staticText18, 0, wx.ALL, 5 )
817         
818         self.m_staticText19 = wx.StaticText( self, wx.ID_ANY, u"", wx.DefaultPosition, wx.DefaultSize, 0 )
819         self.m_staticText19.Wrap( -1 )
820         fgSizer5.Add( self.m_staticText19, 0, wx.ALL, 5 )
821
822         keys = ['ucemethod', 'ucesize', 'keep_caract', 'expressions']
823         self.addkeys(keys, description)
824
825         self.m_staticText18 = wx.StaticText( self, wx.ID_ANY, u"Statistiques", wx.DefaultPosition, wx.DefaultSize, 0 )
826         self.m_staticText18.Wrap( -1 )
827         fgSizer5.Add( self.m_staticText18, 0, wx.ALL, 5 )
828         
829         self.m_staticText19 = wx.StaticText( self, wx.ID_ANY, u"", wx.DefaultPosition, wx.DefaultSize, 0 )
830         self.m_staticText19.Wrap( -1 )
831         fgSizer5.Add( self.m_staticText19, 0, wx.ALL, 5 )
832
833         keys = ['ucinb', 'ucenb', 'occurrences', 'formesnb', 'hapax']
834         self.addkeys(keys, description)
835
836         self.SetSizer( fgSizer5 )
837         self.Layout()
838
839     def addkeys(self, keys, description) :
840         for key in keys :
841             option = self.parametres.get(key,u'non défnini')
842             if isinstance(option, int) :
843                 option = `option`
844             text = wx.StaticText( self, wx.ID_ANY, description.get(key, key), wx.DefaultPosition, wx.DefaultSize, 0 )
845             text.Wrap( -1 )
846             self.fgSizer5.Add( text, 0, wx.ALL, 5 )
847
848             text = wx.StaticText( self, wx.ID_ANY, option, wx.DefaultPosition, wx.DefaultSize, 0 )
849             text.Wrap( -1 )
850             self.fgSizer5.Add( text, 0, wx.ALL, 5 )
851
852    # def read_result(self) :
853    #     #self.corpus.read_corpus_from_shelves(self.corpus.dictpathout['db'])
854    #     #self.corpus.make_et_table()
855    #     self.result = {}
856    #     with open(os.path.join(self.pathout,'glob.txt'), 'r') as f :
857    #         self.result['glob'] = f.read()
858