...
[iramuteq] / ProfList.py
index 4cdffa1..902f2f8 100644 (file)
@@ -278,6 +278,7 @@ class ProfListctrlPanel(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.Col
                 self.idexport = wx.NewId()
                 self.idexporttropes = wx.NewId()
                 self.idexportowledge = wx.NewId()
+                self.onmaketgen = wx.NewId()
             #    self.export_classes = wx.NewId()
    
                 self.Bind(wx.EVT_MENU, self.OnPopupOne, id=self.popupID1)
@@ -302,6 +303,7 @@ class ProfListctrlPanel(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.Col
                 self.Bind(wx.EVT_MENU, self.onexport, id = self.idexport)
                 self.Bind(wx.EVT_MENU, self.onexporttropes, id = self.idexporttropes)
                 self.Bind(wx.EVT_MENU, self.onexportowledge, id = self.idexportowledge)
+                self.Bind(wx.EVT_MENU, self.OnMakeTgen, id=self.onmaketgen)
              #  self.Bind(wx.EVT_MENU, self.on_export_classes, id = self.export_classes)
    #            self.Bind(wx.EVT_MENU, self.OnPopupThree, id=self.popupID3)
     
@@ -320,7 +322,8 @@ class ProfListctrlPanel(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.Col
             menu_conc.Append(self.popupID2, u"dans les segments de texte de la classe")
             menu_conc.Append(self.popupID3, u"dans les segments de texte classés")
             menu_conc.Append(self.popupID4, u"dans tous les segments de texte")
-            menu.AppendMenu(-1, u"Concordancier", menu_conc) 
+            menu.AppendMenu(-1, u"Concordancier", menu_conc)
+            menu.Append(self.onmaketgen, _(u"Make Tgen").decode('utf8'))
             menu_cnrtl = wx.Menu()      
             menu_cnrtl.Append(self.popupID5, u"Définition")
             menu_cnrtl.Append(self.popupID6, u"Etymologie")
@@ -355,7 +358,7 @@ class ProfListctrlPanel(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.Col
             menu.Append(self.pop2, u"Chi2 par classe")
             menu.Append(self.pop3, u"Chi2 modalités de la variable")
             menu.AppendSeparator()
-            menu.Append(self.pop1, u"Graph de la classe")
+            menu.Append(self.pop1, u"Graphe de la classe")
             self.PopupMenu(menu)
             menu.Destroy()
 
@@ -515,6 +518,7 @@ class ProfListctrlPanel(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.Col
                           'halo' : 0,
                           'tmpchi': self.tmpchi,
                           'fromprof' : True,
+                          'edgecurved' : True,
                           }
         act = {}
         tableau = copymatrix(tableau)
@@ -613,11 +617,11 @@ class ProfListctrlPanel(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.Col
             dlg.Update(3, u'concordancier...')
             ucis_txt, ucestxt = doconcorde(corpus, nuces, self.la, uci = uci)
             items = dict([[i, '<br>'.join([ucis_txt[i], '<table bgcolor = #1BF0F7 border=0><tr><td><b>score : %.2f</b></td></tr></table><br>' % ntab2[i][0], ucestxt[i]])] for i, uce in enumerate(nuces)])
-            dlg.Update(4, u'texte...')
-            win = message(self, items, u"Segments de texte caractéristiques - Classe %i" % self.cl, (750, 600))
+            dlg.Destroy()
+            win = message(self, items, u"Segments de texte caractéristiques - Classe %i" % self.cl, (750, 600), uceids = nuces)
+            win.SetWindowStyle(wx.STAY_ON_TOP)
             #win.html = '<html>\n' + '<br>'.join(['<br>'.join([ucis_txt[i], '<table bgcolor = #1BF0F7 border=0><tr><td><b>score : %.2f</b></td></tr></table>' % ntab2[i][0], ucestxt[i]]) for i in range(0,len(ucestxt))]) + '\n</html>'
             #win.HtmlPage.SetPage(win.html)
-            dlg.Destroy()
             win.Show(True)
     
     def on_tablex(self, evt):
@@ -638,28 +642,6 @@ class ProfListctrlPanel(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.Col
         nbcl = len(title)
         nbwords = len(words)
         BarFrame(self.Source.parent, tableout, title, words)
-#         txt = barplot(tableout, words, title, self.Source.parent.RscriptsPath['Rgraph'], tmpgraph)
-#         #print 'ATTENTION TEST R'
-#         #txt = """
-#         #sink('/Users/pierre/Desktop/qdfqsdfqsdfqsdf.txt')
-#         #Sys.getlocale()
-#         #sink()
-#         #"""
-#         tmpscript = tempfile.mktemp(dir=self.Source.parent.TEMPDIR)
-#         file = open(tmpscript,'w')
-#         file.write(txt)
-#         file.close()
-#         exec_rcode(self.Source.parent.RPath, tmpscript, wait = True)
-#         w = 100 + (20 * nbwords) + (100 * nbcl)
-#         h = 100 + (nbwords * 15)
-#         if w > 1100 : w = 1100
-#         if h > 800 : h = 800
-#         if h < 450 : h = 450
-#         win = MessageImage(self, u"Graphique", size=(w, h))
-#         win.addsaveimage(tmpgraph)
-#         txt = "<img src='%s'>" % tmpgraph
-#         win.HtmlPage.SetPage(txt)
-#         win.Show(True)
 
     def onlexdendro(self, evt):
         if 'corpus' in dir(self.Source):
@@ -695,7 +677,7 @@ class ProfListctrlPanel(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.Col
                 uci = True
         ucis_txt, ucestxt = doconcorde(corpus, ucef, ListWord, uci = uci)
         items = dict([[i, '<br><br>'.join([ucis_txt[i], ucestxt[i]])] for i in range(0,len(ucestxt))])
-        win = message(self, items, title, (800, 500))
+        win = message(self, items, title, (800, 500), uceids = ucef)
         return win
 
     def OnPopupTwo(self, event):
@@ -708,13 +690,13 @@ class ProfListctrlPanel(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.Col
     def OnPopupThree(self, event):
         corpus = self.Source.corpus
         uces = [classe[i] for classe in corpus.lc for i in range(0,len(classe))]
-        win = self.make_concord(uces, "Concordancier - UCE classées")
+        win = self.make_concord(uces, "Concordancier - Segments de texte classés")
         win.Show(True)
         
     def OnPopupFour(self, event):
         corpus = self.Source.corpus
         uces = [classe[i] for classe in corpus.lc for i in range(0,len(classe))] + corpus.lc0
-        win = self.make_concord(uces, "Concordancier - Toutes les UCE")
+        win = self.make_concord(uces, "Concordancier - Tous les segments de texte")
         win.Show(True)
 
     def OnPopupFive(self, event):
@@ -772,6 +754,9 @@ class ProfListctrlPanel(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.Col
         #win.html = '<html>\n' + '<br>'.join([' : '.join([str(val) for val in forme]) for forme in rep]) + '\n</html>'
         #win.HtmlPage.SetPage(win.html)
         win.Show(True)
+    
+    def OnMakeTgen(self, evt):
+        self.parent.tree.OnTgenEditor(self.getselectedwords())    
 
 
 class wliste(wx.Frame):