2 # -*- coding: utf-8 -*-
3 #Author: Pierre Ratinaud
4 #Copyright (c) 2009-2010 Pierre Ratinaud
7 from chemins import ConstructPathOut, construct_simipath, ffr
8 from functions import print_liste, exec_rcode, read_list_file, check_Rresult, indices_simi, treat_var_mod
9 from dialog import PrefSimi, SelectColDial, OptLexi
12 import wx.lib.agw.aui as aui
17 from ConfigParser import RawConfigParser
18 from time import sleep
21 def __init__(self, parent, param = None, isopen = False, fromprof = False, pathout = False, filename ='', gparent = False, wordgraph = False, listactives = False, actives = False, cmd = False, openfromprof=False):
22 #-------------------------------------------------------------------
23 self.fromprof = fromprof
24 self.wordgraph = wordgraph
25 self.listactives = listactives
26 self.actives = actives
27 self.openfromprof = openfromprof
29 if param is not None and fromprof:
30 self.paramsimi = param
32 self.paramsimi = {'coeff' : 0,
53 'cola' : (200,200,200),
61 self.types = indices_simi
63 self.parent = parent.parent
69 self.RPath = self.parent.PathPath.get('PATHS', 'rpath')
72 self.tableau = self.parent.tableau
74 self.tableau = parent.tableau
75 self.tableau.parametre['mineff'] = 0
76 self.dial = PrefSimi(parent, -1, self.paramsimi, self.types)
77 self.dial.CenterOnParent()
78 self.val = self.dial.ShowModal()
79 if self.val == wx.ID_OK :
80 self.paramsimi = self.make_param()
82 if self.paramsimi.get('bystar', False) :
83 variables = treat_var_mod(self.tableau.listet)
84 dial = OptLexi(self.parent)
85 dial.listet = self.tableau.listet
86 var = [v for v in variables]
89 dial.list_box_1.Append(et)
91 val = dial.ShowModal()
93 if dial.choice.GetSelection() == 1 :
94 listet = [self.tableau.listet[i] for i in dial.list_box_1.GetSelections()]
96 listet = variables[var[dial.list_box_1.GetSelections()[0]]]
98 self.tableau.etline = self.Source.corpus.make_etline(listet)
100 dlg = wx.ProgressDialog("Traitements",
101 "Veuillez patienter...",
104 style=wx.PD_APP_MODAL | wx.PD_AUTO_HIDE | wx.PD_ELAPSED_TIME
108 keepGoing = dlg.Update(count)
109 #-------------------------------------------------------------------
112 self.Linecontent = []
113 #-----------------------------------------------------------
116 self.pathout = ConstructPathOut(parent.tableau.parametre['filename'], 'Simi')
117 self.DictPathOut = construct_simipath(self.pathout)
118 self.parent.tableau.dictpathout = self.DictPathOut
119 dlg.Update(count, u"passage en O/1")
120 self.parent.tableau.make_01_from_selection(range(0,self.parent.tableau.colnb))
121 #self.Linecontent = parent.table
124 self.pathout = pathout
125 self.DictPathOut = construct_simipath(self.pathout)
126 self.DictPathOut['mat01'] = fromprof
129 dlg.Update(count, u"R...")
133 dlg.Update(count, u"")
137 from openanalyse import OpenAnalyse
142 OpenAnalyse(self.parent, self.DictPathOut['ira'], False, simifromprof=fromprof)
146 self.tableau = gparent.tableau
147 if 'corpus' in dir(gparent) :
148 self.Source = gparent
149 self.tableau.parametre['mineff'] = 0
150 self.DictPathOut = construct_simipath(os.path.abspath(os.path.dirname(filename)))
152 self.paramsimi['first'] = False
153 self.paramsimi['coeff'] = int(param.get('simi', 'indice'))
154 self.paramsimi['layout'] = int(param.get('simi', 'layout'))
155 self.paramsimi['seuil_ok'] = param.getboolean('simi', 'seuil_ok')
156 self.paramsimi['seuil'] = int(param.get('simi', 'seuil'))
157 if param.get('simi', 'wordgraph') == 'False' :
158 self.wordgraph = False
160 self.wordgraph = param.get('simi', 'wordgraph')
161 if 'listet' in dir(self.tableau) :
162 self.paramsimi['stars'] = self.tableau.listet
163 self.paramsimi['bystar'] = False
164 self.paramsimi['cexfromchi'] = True
165 self.paramsimi['tvprop'] = False
166 self.paramsimi['sfromchi'] = False
167 self.paramsimi['coeff_te'] = True
168 self.paramsimi['coeff_tv'] = True
169 self.paramsimi['coeff_tv_nb'] = 0
170 self.paramsimi['label_e'] = False
171 self.paramsimi['width'] = 1000
172 self.paramsimi['height'] = 1000
175 def make_param(self) :
176 if self.paramsimi['first'] :
179 keep_coord = self.dial.check_coord.GetValue()
180 self.select = self.dial.check_colch.GetValue()
182 paramsimi = {'coeff' : self.dial.choice1.GetSelection(),
183 'layout' : self.dial.choice2.GetSelection(),
184 'type' : self.dial.choice3.GetSelection(),
185 'arbremax' : self.dial.check1.GetValue(),
186 'coeff_tv' : self.dial.check_s_size.GetValue(),
187 'coeff_tv_nb' : self.dial.spin_tv.GetValue(),
188 'tvprop' : self.dial.check2.GetValue(),
189 'tvmin' : self.dial.spin_tvmin.GetValue(),
190 'tvmax' : self.dial.spin_tvmax.GetValue(),
191 'coeff_te' : self.dial.check3.GetValue(),
192 'coeff_temin' : self.dial.spin_temin.GetValue(),
193 'coeff_temax' : self.dial.spin_temax.GetValue(),
194 'label_e' : self.dial.check_elab.GetValue(),
195 'label_v' : self.dial.check_vlab.GetValue(),
196 'vcex' : self.dial.check_vcex.GetValue(),
197 'vcexmin' : self.dial.spin_vcexmin.GetValue(),
198 'vcexmax' : self.dial.spin_vcexmax.GetValue(),
199 'cex' : self.dial.spin_cex.GetValue(),
200 'seuil_ok' : self.dial.check_seuil.GetValue(),
201 'seuil' : self.dial.spin_seuil.GetValue(),
202 'cols' : self.dial.cols.GetColour(),
203 'cola' : self.dial.cola.GetColour(),
204 'width' : self.dial.spin_width.GetValue(),
205 'height' : self.dial.spin_height.GetValue(),
207 'keep_coord' : keep_coord,
208 'alpha' : self.dial.slider_sphere.GetValue(),
209 'film' : self.dial.film.GetValue()
211 if 'cexfromchi' in self.paramsimi :
212 paramsimi['cexfromchi'] = self.dial.checkit.GetValue()
213 if 'sfromchi' in self.paramsimi :
214 paramsimi['sfromchi'] = self.dial.checki.GetValue()
215 if 'vlabcolor' in self.paramsimi :
216 paramsimi['vlabcolor'] = self.paramsimi['vlabcolor']
217 if 'check_bystar' in dir(self.dial) :
218 paramsimi['bystar'] = self.dial.check_bystar.GetValue()
219 paramsimi['stars'] = self.paramsimi['stars']
223 self.tableau.save_tableau(self.DictPathOut['db'])
224 conf = RawConfigParser()
225 conf.read(self.DictPathOut['ira'])
226 if not 'simi' in conf.sections() :
227 conf.add_section('simi')
228 date = datetime.datetime.now().ctime()
229 conf.set('simi', 'date', str(date))
230 conf.set('simi', 'indice', self.paramsimi['coeff'])
231 conf.set('simi','layout', self.paramsimi['layout'])
232 conf.set('simi', 'seuil_ok', self.paramsimi['seuil_ok'])
233 conf.set('simi', 'seuil', str(self.paramsimi['seuil']))
234 conf.set('simi', 'wordgraph', self.wordgraph)
235 fileout = open(self.DictPathOut['ira'], 'w')
239 def PrintScript(self):
241 if self.listactives :
242 lactives = self.listactives
244 lactives = self.tableau.listactives
248 acts = self.tableau.actives
249 dictcol = [[i, [active, acts[active][0]]] for i, active in enumerate(lactives)]
250 dictcol = dict(dictcol)
251 dlg = SelectColDial(self.parent)
252 listcol = ListForSpec(dlg, self, dictcol, ['forme', 'eff'])
253 dlg.bSizer2.Add( listcol, 2, wx.ALL|wx.EXPAND, 5 )
254 dlg.m_sdbSizer2.AddButton( dlg.m_sdbSizer2OK )
255 dlg.m_sdbSizer2.Realize()
256 dlg.bSizer2.Add( dlg.m_sdbSizer2, 0, wx.EXPAND, 5 )
258 if not 'selected_col' in dir(self.tableau) :
259 for row in xrange(listcol.list.GetItemCount()):
260 listcol.list.Select(row)
262 for row in self.tableau.selected_col :
263 listcol.list.Select(row)
265 val = dlg.ShowModal()
266 datas = [listcol.getColumnText(listcol.list.GetFirstSelected(),0)]
267 last = listcol.list.GetFirstSelected()
268 lastl = [listcol.list.GetFirstSelected()]
269 while listcol.list.GetNextSelected(last) != -1:
270 last = listcol.list.GetNextSelected(last)
272 datas.append(listcol.getColumnText(last,0))
274 datas = [lactives.index(val) for val in datas]
275 self.tableau.selected_col = lastl
276 self.tableau.datas = datas
277 datas = str(tuple(datas))
278 elif not self.select and 'selected_col' in dir(self.tableau) :
279 datas = str(tuple(self.tableau.datas))
280 elif self.wordgraph :
281 col = self.tableau.listactives.index(self.wordgraph)
284 if (self.fromprof or self.openfromprof) and (self.paramsimi.get('cexfromchi', False) or self.paramsimi.get('sfromchi', False)):
285 if 'lchi' in dir(self.tableau) :
286 tmpchi = tempfile.mktemp(dir=self.parent.TEMPDIR)
287 with open(tmpchi, 'w') as f:
288 f.write('\n'.join([str(val) for val in self.tableau.lchi]))
290 active_file = tempfile.mktemp(dir=self.parent.TEMPDIR)
291 if self.listactives :
292 lactives = self.listactives
294 lactives = self.tableau.listactives
295 self.tableau.listactives = lactives
296 with open(active_file, 'w') as f:
297 f.write('\n'.join(lactives))
299 txt = '#script genere par Iramuteq'
305 if os.path.exists(self.DictPathOut['RData']) :
308 """ % self.DictPathOut['RData']
309 if not self.paramsimi['keep_coord'] :
313 with open(self.DictPathOut['mat01'],'r') as f :
314 for line in f.readlines() :
315 if 'MatrixMarket' in line :
323 #if (self.fromprof or 'fromtxt' in self.tableau.parametre or self.openfromprof) and not self.actives :
327 """ % self.DictPathOut['mat01']
330 dm <- read.csv2("%s")
331 """ % self.DictPathOut['mat01']
334 #dml <- apply(dm, 2, as.logical)
336 if not self.paramsimi['keep_coord'] :
338 cn <- read.table("%s", sep=';', quote='"')
339 colnames(dm) <- cn[,1]
340 #colnames(dml) <- cn[,1]
341 """ % ffr(active_file)
342 if 'selected_col' in dir(self.tableau) and not self.paramsimi['keep_coord']:
350 """ % (self.parent.RscriptsPath['simi'],self.parent.RscriptsPath['Rgraph'])
353 self.txtgraph += self.types[self.paramsimi['coeff']]
354 if not self.paramsimi['keep_coord'] :
355 if self.paramsimi['coeff'] == 0 :
361 elif self.paramsimi['coeff'] == 1 :
365 mat <- simil(dm, method = 'Russel', diag = TRUE, upper = TRUE, by_rows = FALSE)
367 elif self.types[self.paramsimi['coeff']] == 'binomial' :
374 method = self.types[self.paramsimi['coeff']]
377 mat <- simil(dm, method = method, diag = TRUE, upper = TRUE, by_rows = FALSE)
378 """ % self.types[self.paramsimi['coeff']]
380 mat <- as.matrix(stats::as.dist(mat,diag=TRUE,upper=TRUE))
382 mat[is.infinite(mat)] <- 0
384 if self.types[self.paramsimi['coeff']] not in ['cooccurrence', 'Chi-squared', 'Mozley', 'Stiles'] :
390 mat <- graph.word(mat, %i)
394 x <- list(mat = mat, eff = eff)
398 if self.paramsimi['layout'] == 0 : layout = 'random'
399 if self.paramsimi['layout'] == 1 : layout = 'circle'
400 if self.paramsimi['layout'] == 2 : layout = 'frutch'
401 if self.paramsimi['layout'] == 3 : layout = 'kawa'
402 if self.paramsimi['layout'] == 4 : layout = 'graphopt'
405 if self.paramsimi['type'] == 0 : type = 'tkplot'
406 if self.paramsimi['type'] == 1 :
409 dirout = os.path.dirname(self.DictPathOut['mat01'])
410 while os.path.exists(os.path.join(dirout,'graph_simi_'+str(graphnb)+'.png')):
412 self.filename = ffr(os.path.join(dirout,'graph_simi_'+str(graphnb)+'.png'))
413 if self.paramsimi['type'] == 2 : type = 'rgl'
415 if self.paramsimi['arbremax'] :
417 self.txtgraph += ' - arbre maximum'
418 else : arbremax = 'FALSE'
420 if self.paramsimi['coeff_tv'] :
421 coeff_tv = self.paramsimi['coeff_tv_nb']
422 tvminmax = 'c(NULL,NULL)'
423 elif not self.paramsimi['coeff_tv'] or self.paramsimi.get('sformchi', False) :
425 tvminmax = 'c(%i, %i)' %(self.paramsimi['tvmin'], self.paramsimi['tvmax'])
430 if self.paramsimi['coeff_te'] : coeff_te = 'c(%i,%i)' % (self.paramsimi['coeff_temin'], self.paramsimi['coeff_temax'])
431 else : coeff_te = 'NULL'
433 if self.paramsimi['vcex'] or self.paramsimi.get('cexfromchi', False) :
434 vcexminmax = 'c(%i/10,%i/10)' % (self.paramsimi['vcexmin'],self.paramsimi['vcexmax'])
436 vcexminmax = 'c(NULL,NULL)'
444 """ % self.paramsimi['cex']
446 if not self.paramsimi['label_v'] : label_v = 'FALSE'
447 else : label_v = 'TRUE'
449 if not self.paramsimi['label_e'] : label_e = 'FALSE'
450 else : label_e = 'TRUE'
452 if self.paramsimi['seuil_ok'] : seuil = str(self.paramsimi['seuil'])
453 else : seuil = 'NULL'
455 if self.paramsimi['film'] :
458 """ % self.DictPathOut['film']
471 """ % (label_v, label_e)
473 cols = str(self.paramsimi['cols']).replace(')',', max=255)')
474 cola = str(self.paramsimi['cola']).replace(')',',max=255)')
484 """ % (self.paramsimi['width'], self.paramsimi['height'])
486 if self.paramsimi['keep_coord'] :
488 coords <- try(coords, TRUE)
489 if (!is.matrix(coords)) {
499 """ % self.paramsimi['alpha']
501 if self.paramsimi.get('bystar',False) :
505 for i,et in enumerate(self.tableau.etline) :
508 """ % (i+1, ','.join(et[1:]))
511 """ % ("','".join([val[0] for val in self.tableau.etline]))
515 for (i in 1:length(unetoile)) {
518 if (length(tosum) > 1) {
519 fsum <- cbind(fsum, colSums(dm[tosum,]))
521 fsum <- cbind(fsum, dm[tosum,])
525 lex <- AsLexico2(fsum, chip=TRUE)
526 dcol <- apply(lex[[4]],1,which.max)
527 toblack <- apply(lex[[4]],1,max)
528 gcol <- rainbow(length(unetoile))
530 vertex.label.color <- gcol[dcol]
531 vertex.label.color[which(toblack <= 3.84)] <- 'black'
532 leg <- list(unetoile=unetoile, gcol=gcol)
533 cols <- vertex.label.color
534 chivertex.size <- norm.vec(toblack, vcexminmax[1], vcexminmax[2])
536 """ % (self.parent.RscriptsPath['chdfunct'])
539 vertex.label.color <- 'black'
543 #if not self.paramsimi['keep_coord'] :
545 graph.simi <- do.simi(x, method='%s', seuil = seuil, p.type = '%s', layout.type = '%s', max.tree = %s, coeff.vertex=%s, coeff.edge = %s, minmaxeff = minmaxeff, vcexminmax = vcexminmax, cex = cex, coords = coords)
546 """ % (method, type, layout, arbremax, coeff_tv, coeff_te)
548 if self.paramsimi.get('bystar',False) :
549 if self.paramsimi.get('cexfromchi', False) :
551 label.cex<-chivertex.size
557 if self.paramsimi.get('sfromchi', False) :
559 vertex.size <- norm.vec(toblack, minmaxeff[1], minmaxeff[2])
568 lchi <- read.table("%s")
571 if 'selected_col' in dir(self.tableau) :
575 if tmpchi and self.paramsimi.get('cexfromchi', False) :
577 label.cex <- norm.vec(lchi, vcexminmax[1], vcexminmax[2])
581 if (is.null(vcexminmax[1])) {
584 label.cex <- graph.simi$label.cex
587 if tmpchi and self.paramsimi.get('sfromchi', False) :
589 vertex.size <- norm.vec(lchi, minmaxeff[1], minmaxeff[2])
593 if (is.null(minmaxeff[1])) {
596 vertex.size <- graph.simi$eff
599 txt += """ vertex.size <- NULL """
601 coords <- plot.simi(graph.simi, p.type='%s',filename="%s", vertex.label = label.v, edge.label = label.e, vertex.col = cols, vertex.label.color = vertex.label.color, vertex.label.cex=label.cex, vertex.size = vertex.size, edge.col = cola, leg=leg, width = width, height = height, alpha = alpha, movie = film)
602 save.image(file="%s")
603 """ % (type, self.filename, self.DictPathOut['RData'])
605 self.tmpfile = tempfile.mktemp(dir=self.parent.TEMPDIR)
606 tmpscript = open(self.tmpfile, 'w')
611 if os.path.exists(self.DictPathOut['liste_graph']):
612 graph_simi = read_list_file(self.DictPathOut['liste_graph'])
613 graph_simi.append([os.path.basename(self.filename), self.txtgraph])
615 graph_simi = [[os.path.basename(self.filename), self.txtgraph]]
616 print_liste(self.DictPathOut['liste_graph'], graph_simi)
619 if self.paramsimi['type'] == 1 :
625 pid = exec_rcode(self.RPath, self.tmpfile, wait = wait, graph = graph)
626 if self.paramsimi['type'] == 1 :
627 while pid.poll() == None :
633 check_Rresult(self.parent, pid)
636 if os.path.exists(self.DictPathOut['liste_graph']) :
637 list_graph = read_list_file(self.DictPathOut['liste_graph'])
639 list_graph = [['','']]
640 notebook_flags = aui.AUI_NB_DEFAULT_STYLE | aui.AUI_NB_TAB_EXTERNAL_MOVE | aui.AUI_NB_TAB_MOVE | aui.AUI_NB_TAB_FLOAT
641 self.tabsimi = aui.AuiNotebook(self.parent.nb, -1, wx.DefaultPosition)
642 self.tabsimi.SetAGWWindowStyleFlag(notebook_flags)
643 self.tabsimi.SetArtProvider(aui.ChromeTabArt())
644 if 'corpus' in dir(self.Source) :
645 self.tabsimi.corpus = self.Source.corpus
646 self.graphpan = GraphPanelSimi(self.tabsimi, self.DictPathOut, list_graph)
647 self.graphpan.Bind(wx.EVT_BUTTON, self.redosimi, self.graphpan.butafc)
648 self.graphpan.Bind(wx.EVT_BUTTON, self.export, self.graphpan.butexport)
649 self.tabsimi.AddPage(self.graphpan, 'Graph')
650 self.parent.nb.AddPage(self.tabsimi, 'Analyse de graph')
651 self.parent.ShowTab(True)
652 self.parent.nb.SetSelection(self.parent.nb.GetPageCount() - 1)
654 def export(self, evt) :
655 fileout = os.path.join(os.path.dirname(self.DictPathOut['ira']), "graphout")
658 while os.path.exists(fileout + '_%i.' % i + format_graph) :
660 fileout_graph = fileout + '_%i.' % i + format_graph
661 fileout_table = fileout + '_table_%i.csv' % i
666 fileout.table <- "%s"
668 id <- (1:length(graph.simi$mat.eff)) - 1
669 id <- paste(id, '.0', sep='')
670 table.out <- cbind(Id=id, Label=id, Name=graph.simi$v.label, labelcex=graph.simi$label.cex, eff=graph.simi$mat.eff)
671 write.graph(graph.simi$graph, fileout, format=format)
672 write.csv2(table.out, file = fileout.table, row.names=FALSE)
673 """ % (self.DictPathOut['RData'], ffr(fileout_graph), ffr(fileout_table), format_graph)
674 tmpfile = tempfile.mktemp(dir=self.parent.TEMPDIR)
675 with open(tmpfile, 'w') as f :
677 res = exec_rcode(self.RPath, tmpfile, wait = False)
678 check_Rresult(self.parent,res)
681 def redosimi(self,evt) :
682 if self.openfromprof :
683 if 'cexfromchi' not in self.paramsimi:
684 self.paramsimi['cexfromchi'] = False
685 self.paramsimi['sfromchi'] = False
686 self.dial = PrefSimi(self.parent, -1, self.paramsimi, self.types)
687 self.dial.CenterOnParent()
688 val = self.dial.ShowModal()
690 self.paramsimi = self.make_param()
692 if self.paramsimi.get('bystar',False) :
693 variables = treat_var_mod(self.paramsimi['stars'])
694 dial = OptLexi(self.parent)
695 dial.listet = self.paramsimi['stars']
696 var = [v for v in variables]
699 dial.list_box_1.Append(et)
700 dial.CenterOnParent()
701 val = dial.ShowModal()
703 if dial.choice.GetSelection() == 1 :
704 listet = [dial.listet[i] for i in dial.list_box_1.GetSelections()]
706 listet = variables[var[dial.list_box_1.GetSelections()[0]]]
707 self.tableau.etline = self.Source.corpus.make_etline(listet)
709 dlg = wx.ProgressDialog("Traitements",
710 "Veuillez patienter...",
713 style=wx.PD_APP_MODAL | wx.PD_AUTO_HIDE | wx.PD_ELAPSED_TIME | wx.PD_CAN_ABORT)
719 if self.paramsimi['type'] == 1:
720 self.graphpan.sizer_3.Add(wx.StaticBitmap(self.graphpan.panel_1, -1, wx.Bitmap(self.filename, wx.BITMAP_TYPE_ANY)), 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
721 self.graphpan.sizer_3.Add(wx.StaticText(self.graphpan.panel_1,-1,self.txtgraph), 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
722 self.graphpan.sizer_3.Fit(self.graphpan.panel_1)
723 self.graphpan.Layout()
724 self.graphpan.panel_1.Scroll(0,self.graphpan.panel_1.GetScrollRange(wx.VERTICAL))
729 class GraphPanelSimi(wx.Panel):
730 def __init__(self,parent, dico, list_graph):
731 wx.Panel.__init__(self,parent)
734 self.dirout = os.path.dirname(self.Dict['ira'])
735 self.parent = self.GetParent()#parent
736 self.SetFont(wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "courier"))
739 self.tabsimi = self.parent.GetParent()
740 self.ira = self.tabsimi.GetParent()
741 self.panel_1 = wx.ScrolledWindow(self, -1, style=wx.TAB_TRAVERSAL)
742 afc_img = wx.Image(os.path.join(self.ira.images_path,'button_simi.jpg'), wx.BITMAP_TYPE_ANY).ConvertToBitmap()
743 self.butafc = wx.BitmapButton(self, -1, afc_img)
744 export_img = wx.Image(os.path.join(self.ira.images_path,'button_export.jpg'), wx.BITMAP_TYPE_ANY).ConvertToBitmap()
745 self.butexport = wx.BitmapButton(self, -1, export_img)
747 for i in range(0,len(list_graph)):
748 if os.path.exists(os.path.join(self.dirout,list_graph[i][0])) :
749 self.listimg.append(wx.StaticBitmap(self.panel_1, -1, wx.Bitmap(os.path.join(self.dirout,list_graph[i][0]), wx.BITMAP_TYPE_ANY)))
750 self.labels.append(wx.StaticText(self.panel_1, -1, list_graph[i][1]))
752 self.__set_properties()
755 def __set_properties(self):
756 self.panel_1.EnableScrolling(True,True)
757 #self.panel_1.SetSize((1000,1000))
758 self.panel_1.SetScrollRate(20, 20)
760 def __do_layout(self):
761 self.sizer_1 = wx.BoxSizer(wx.HORIZONTAL)
762 self.sizer_2 = wx.BoxSizer(wx.VERTICAL)
763 self.sizer_3 = wx.BoxSizer(wx.VERTICAL)
764 self.sizer_2.Add(self.butafc, 0, 0, 0)
765 self.sizer_2.Add(self.butexport, 0, 0, 0)
766 for i in range(0, len(self.listimg)):
767 self.sizer_3.Add(self.listimg[i], 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
768 self.sizer_3.Add(self.labels[i], 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
769 self.panel_1.SetSizer(self.sizer_3)
770 self.sizer_1.Add(self.sizer_2, 0, wx.EXPAND, 0)
771 self.sizer_1.Add(self.panel_1, 1, wx.EXPAND, 0)
772 self.SetSizer(self.sizer_1)