X-Git-Url: http://iramuteq.org/git?p=iramuteq;a=blobdiff_plain;f=layout.py;h=022f2420abd4c731f7d068cc3741e46c4d6d0e88;hp=3a670e585eeb0e1c4edae3e63952ab6344226228;hb=191e64482209e897e7bf1853646c0d2ca84db1f2;hpb=adc24190c47d42d5fa02f074516fc331950d8c5c diff --git a/layout.py b/layout.py index 3a670e5..022f242 100644 --- a/layout.py +++ b/layout.py @@ -110,6 +110,7 @@ class GraphPanelAfc(wx.Panel): self.panel_1.EnableScrolling(True,True) #self.panel_1.SetSize((1000,1000)) self.panel_1.SetScrollRate(20, 20) + self.panel_1.SetFocus() def __do_layout(self): self.sizer_1 = wx.BoxSizer(wx.VERTICAL) @@ -262,14 +263,21 @@ class GraphPanel(wx.ScrolledWindow): self.deb = wx.StaticText(self, -1, txt) for i in range(0,len(list_graph)): if os.path.exists(os.path.join(self.dirout,list_graph[i][0])) : - self.listimg.append(wx.StaticBitmap(self, -1, wx.Bitmap(os.path.join(self.dirout,list_graph[i][0]), wx.BITMAP_TYPE_ANY))) + filename, ext = os.path.splitext(list_graph[i][0]) + if ext == '.svg' : + self.listimg.append(hl.HyperLinkCtrl(self, -1, os.path.join(self.dirout,list_graph[i][0]), URL=os.path.join(self.dirout,list_graph[i][0]))) + else : + self.listimg.append(wx.StaticBitmap(self, -1, wx.Bitmap(os.path.join(self.dirout,list_graph[i][0]), wx.BITMAP_TYPE_ANY))) self.labels.append(wx.StaticText(self, -1, list_graph[i][1])) - + self.Bind(wx.EVT_MOTION, self.onMouseMove) self.__set_properties() self.__do_layout() def __set_properties(self): + self.EnableScrolling(True,True) self.SetScrollRate(20, 20) + self.SetFocus() + def __do_layout(self): self.sizer_1 = wx.BoxSizer(wx.VERTICAL) @@ -282,6 +290,9 @@ class GraphPanel(wx.ScrolledWindow): self.sizer_2.Add(self.sizer_1, 1, wx.EXPAND, 0) self.SetSizer(self.sizer_1) self.sizer_1.Fit(self) + + def onMouseMove(self, event): + self.SetFocus() def open_antiprofil(panel, AntiProfile, encoding) : @@ -514,7 +525,7 @@ def PrintRapport(self, corpus, parametres, istxt = True): txt += u'nombre de formes actives: %i%s' % (corpus.getactivesnb(1), sep) txt += u'nombre de formes supplémentaires: %i%s' % (corpus.getactivesnb(2), sep) txt += u'nombre de formes actives de fréquence >= %i: %i%s' % (parametres['eff_min_forme'], parametres['nbactives'], sep) - txt += u'moyenne d\'occurrences par uce :%f%s' % (float(totocc) / float(corpus.getucenb()), sep) + txt += u'moyenne d\'occurrences par segments :%f%s' % (float(totocc) / float(corpus.getucenb()), sep) if 'tailleuc1' in parametres : if parametres['classif_mode'] == 0 : txt += u'taille rst1 / rst2: %i / %i - %i / %i%s' % (parametres['tailleuc1'], parametres['tailleuc2'], parametres['lenuc1'], parametres['lenuc2'], sep) @@ -529,7 +540,7 @@ def PrintRapport(self, corpus, parametres, istxt = True): elif self.parametres['classif_mode'] == 2 : txt += u'%i textes classés 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) else : - txt += u'%i uce classées sur %i (%.2f%%)%s' % (self.ucecla, self.Ucenb, (float(self.ucecla) / float(self.Ucenb)) * 100, sep) + txt += u'%i segments classées sur %i (%.2f%%)%s' % (self.ucecla, self.Ucenb, (float(self.ucecla) / float(self.Ucenb)) * 100, sep) txt += """ ########################### @@ -655,6 +666,7 @@ class GraphPanelDendro(wx.Panel): self.panel_1.EnableScrolling(True,True) #self.panel_1.SetSize((1000,1000)) self.panel_1.SetScrollRate(20, 20) + self.panel_1.SetFocus() self.Bind(wx.EVT_BUTTON, self.ondendro, self.butdendro) self.param = {'width' : 700, 'height': 500, @@ -776,7 +788,12 @@ class CopusPanel(wx.Panel) : fgSizer5.Add( self.m_staticText21, 0, wx.ALL, 5 ) description = {'lang' : u'langue', - 'encoding' : u'encodage'} + 'encoding' : u'encodage', + 'ucinb' : u'Nombre de textes', + 'ucenb' : u'Nombre de segments de texte', + 'formesnb' : u'Nombre de formes', + 'hapax' : u'Nombre d\'hapax' + } keys = ['lang', 'encoding', 'originalpath', 'pathout', 'date', 'time'] @@ -809,7 +826,7 @@ class CopusPanel(wx.Panel) : def addkeys(self, keys, description) : for key in keys : - option = self.parametres.get(key,u'non défnini') + option = self.parametres.get(key,u'non défini') if isinstance(option, int) : option = `option` text = wx.StaticText( self, wx.ID_ANY, description.get(key, key), wx.DefaultPosition, wx.DefaultSize, 0 ) @@ -834,19 +851,13 @@ class DefaultTextLayout : class WordCloudLayout(DefaultTextLayout): def dolayout(self): - #self.dictpathout = parent.corpus.dictpathout - #self.pathout = os.path.dirname(filename) - #self.corpus = parent.corpus - # self.read_result() self.pathout.basefiles(simipath) self.Tab = aui.AuiNotebook(self.ira.nb, -1, wx.DefaultPosition) -# if os.path.exists(self.pathout['liste_graph']) : -# list_graph = read_list_file(self.pathout['liste_graph']) -# else : -# list_graph = [['','']] - list_graph = [['nuage_1.png', 'Nuage']] + if self.parametres['svg'] : + list_graph = [['nuage_1.svg', 'Nuage']] + else : + list_graph = [['nuage_1.png', 'Nuage']] self.TabStatTot = GraphPanel(self.ira.nb, self.pathout, list_graph) - #self.TabStatTot.write(self.result['glob']) self.Tab.AddPage(self.TabStatTot, 'Nuage') self.Tab.corpus = self.corpus self.Tab.parametres = self.parametres @@ -1166,7 +1177,7 @@ class GraphPanelSimi(wx.Panel): else : self.listimg.append(wx.StaticBitmap(self.panel_1, -1, wx.Bitmap(os.path.join(self.dirout,list_graph[i][0]), wx.BITMAP_TYPE_ANY))) self.labels.append(wx.StaticText(self.panel_1, -1, list_graph[i][1])) - + self.panel_1.Bind(wx.EVT_MOTION, self.onMouseMove) self.__set_properties() self.__do_layout() @@ -1174,6 +1185,7 @@ class GraphPanelSimi(wx.Panel): self.panel_1.EnableScrolling(True,True) #self.panel_1.SetSize((1000,1000)) self.panel_1.SetScrollRate(20, 20) + self.panel_1.SetFocus() def __do_layout(self): self.sizer_1 = wx.BoxSizer(wx.HORIZONTAL) @@ -1188,3 +1200,6 @@ class GraphPanelSimi(wx.Panel): self.sizer_1.Add(self.sizer_2, 0, wx.EXPAND, 0) self.sizer_1.Add(self.panel_1, 1, wx.EXPAND, 0) self.SetSizer(self.sizer_1) + + def onMouseMove(self, event): + self.panel_1.SetFocus()