...
authorPierre Ratinaud <ratinaud@univ-tlse2.fr>
Mon, 24 Nov 2014 23:02:56 +0000 (00:02 +0100)
committerPierre Ratinaud <ratinaud@univ-tlse2.fr>
Mon, 24 Nov 2014 23:02:56 +0000 (00:02 +0100)
12 files changed:
Rscripts/Rgraph.R
analysematrix.py
analysetxt.py
dictionnaires/lexique_en.txt
functions.py
guifunct.py
iramuteq.py
layout.py
listlex.py
openanalyse.py
tabsimi.py
tree.py

index 14ce864..8cc1c23 100644 (file)
@@ -660,12 +660,15 @@ plot.dendro.prof <- function(tree, classes, chisqtable, nbbycl = 60, type.dendro
         #wordcloud(names(lclasses[[i]]), lclasses[[i]], scale = c(1.5, 0.2), random.order=FALSE, colors = colcloud[i])
         yval <- 1.1
         plot(0,0,pch='', axes = FALSE)
         #wordcloud(names(lclasses[[i]]), lclasses[[i]], scale = c(1.5, 0.2), random.order=FALSE, colors = colcloud[i])
         yval <- 1.1
         plot(0,0,pch='', axes = FALSE)
-        vcex <- norm.vec(lclasses[[i]], 1.5, 1.5)
+        vcex <- norm.vec(lclasses[[i]], 1, 2)
         for (j in 1:length(lclasses[[i]])) {
             yval <- yval-(strheight( names(lclasses[[i]])[j],cex=vcex[j])+0.02)
             text(-0.9, yval, names(lclasses[[i]])[j], cex = vcex[j], col = colcloud[i], adj=0)
         }
     }
         for (j in 1:length(lclasses[[i]])) {
             yval <- yval-(strheight( names(lclasses[[i]])[j],cex=vcex[j])+0.02)
             text(-0.9, yval, names(lclasses[[i]])[j], cex = vcex[j], col = colcloud[i], adj=0)
         }
     }
+    if (!from.cmd) {
+        dev.off()
+    }
     
 }
 
     
 }
 
@@ -686,10 +689,14 @@ plot.dendro.cloud <- function(tree, classes, chisqtable, nbbycl = 60, type.dendr
     lclasses <- list()
     for (classe in 1:length(sum.cl)) {
        ntoplot <- toplot[,classe]
     lclasses <- list()
     for (classe in 1:length(sum.cl)) {
        ntoplot <- toplot[,classe]
+       names(ntoplot) <- rownames(toplot)
        ntoplot <- ntoplot[order(ntoplot, decreasing = TRUE)]
        ntoplot <- round(ntoplot, 0)
        ntoplot <- ntoplot[order(ntoplot, decreasing = TRUE)]
        ntoplot <- round(ntoplot, 0)
-       ntoplot <- ntoplot[1:nbbycl]
+       if (length(toplot) > nbbycl) {
+            ntoplot <- ntoplot[1:nbbycl]
+       }
        ntoplot <- ntoplot[order(ntoplot)]
        ntoplot <- ntoplot[order(ntoplot)]
+       ntoplot <- which(ntoplot > 0)
        #ntoplot <- ifelse(length(ntoplot) > nbbycl, ntoplot[1:nbbycl], ntoplot)
        lclasses[[classe]] <- ntoplot
     }
        #ntoplot <- ifelse(length(ntoplot) > nbbycl, ntoplot[1:nbbycl], ntoplot)
        lclasses[[classe]] <- ntoplot
     }
@@ -714,7 +721,7 @@ plot.dendro.cloud <- function(tree, classes, chisqtable, nbbycl = 60, type.dendr
        plot.phylo(tree,label.offset=0.1,tip.col=col, type=type.dendro)
     for (i in rev(tree.order)) {
         par(mar=c(0,0,1,0),cex=0.9)
        plot.phylo(tree,label.offset=0.1,tip.col=col, type=type.dendro)
     for (i in rev(tree.order)) {
         par(mar=c(0,0,1,0),cex=0.9)
-        wordcloud(names(lclasses[[i]]), lclasses[[i]], scale = c(4, 0.8), random.order=FALSE, colors = colcloud[i])
+        wordcloud(names(lclasses[[i]]), lclasses[[i]], scale = c(2.5, 0.5), random.order=FALSE, colors = colcloud[i])
     }
 }
 
     }
 }
 
index a89b10e..7e3c93f 100644 (file)
@@ -25,12 +25,9 @@ class AnalyseMatrix :
         self.dlg = dlg
         self.parametres = parametres
         self.val = False
         self.dlg = dlg
         self.parametres = parametres
         self.val = False
-        print self.parametres
         if not 'pathout' in self.parametres :
             self.parametres['pathout'] = PathOut(tableau.parametres['originalpath'], analyse_type = self.parametres['type'], dirout = tableau.parametres['pathout']).mkdirout()
         if not 'pathout' in self.parametres :
             self.parametres['pathout'] = PathOut(tableau.parametres['originalpath'], analyse_type = self.parametres['type'], dirout = tableau.parametres['pathout']).mkdirout()
-            print self.parametres
             self.pathout = PathOut(analyse_type = self.parametres['type'], dirout = self.parametres['pathout'])
             self.pathout = PathOut(analyse_type = self.parametres['type'], dirout = self.parametres['pathout'])
-            print self.pathout.dirout
         else :
             self.pathout = PathOut(filename = tableau.parametres['originalpath'], dirout = self.parametres['pathout'], analyse_type = self.parametres['type'])
 
         else :
             self.pathout = PathOut(filename = tableau.parametres['originalpath'], dirout = self.parametres['pathout'], analyse_type = self.parametres['type'])
 
index 33f7d12..cc99482 100644 (file)
@@ -78,7 +78,10 @@ class AnalyseText :
             else :
                 self.val = False
                 if dlg :
             else :
                 self.val = False
                 if dlg :
-                    self.dlg.Destroy()
+                    try :
+                        self.dlg.Destroy()
+                    except :
+                        pass
         else :
             #if isinstance(dlg, wx.ProgressDialog) :
             #    self.dlg.Destroy()
         else :
             #if isinstance(dlg, wx.ProgressDialog) :
             #    self.dlg.Destroy()
index 02d5cc0..d10dced 100644 (file)
@@ -96476,7 +96476,7 @@ willowwares     willowware      nom
 willowy        willowy adj
 willpower      willpower       nom
 willpowers     willpower       nom
 willowy        willowy adj
 willpower      willpower       nom
 willpowers     willpower       nom
-wills  will    nom
+wills  wills   nom
 wilt   wilt    nom
 wilted wilt    ver
 wilting        wilt    ver
 wilt   wilt    nom
 wilted wilt    ver
 wilting        wilt    ver
@@ -97652,7 +97652,7 @@ your    your    sw
 yours  yours   sw
 yourself       yourself        sw
 yourselves     yourselves      sw
 yours  yours   sw
 yourself       yourself        sw
 yourselves     yourselves      sw
-yous   you     nom
+yous   yous    nom
 youth  youth   nom
 youthfulness   youthfulness    nom
 youthfulnesses youthfulness    nom
 youth  youth   nom
 youthfulness   youthfulness    nom
 youthfulnesses youthfulness    nom
index f2579f1..758f94b 100644 (file)
@@ -48,7 +48,9 @@ class TGen :
     def __getitem__(self, key):
         return self.tgen[key]
     
     def __getitem__(self, key):
         return self.tgen[key]
     
-    def read(self, path):
+    def read(self, path = None):
+        if path is None :
+            path = self.path
         with codecs.open(path, 'r', self.encoding) as f :
             tgen = f.read()
         tgen = [line.split('\t') for line in tgen.splitlines()]
         with codecs.open(path, 'r', self.encoding) as f :
             tgen = f.read()
         tgen = [line.split('\t') for line in tgen.splitlines()]
@@ -376,15 +378,8 @@ def treat_line_alceste(i, line) :
     return [i, int(line[0]), int(line[1]), float(line[2]), float(line[3]), line[6], line[4], line[5]]
 
 def ReadProfileAsDico(File, Alceste=False, encoding = sys.getdefaultencoding()):
     return [i, int(line[0]), int(line[1]), float(line[2]), float(line[3]), line[6], line[4], line[5]]
 
 def ReadProfileAsDico(File, Alceste=False, encoding = sys.getdefaultencoding()):
-    #print 'lecture des profils : ReadProfileAsDico'
-    #if Alceste :
-    #    print 'lecture du dictionnaire de type'
-    #    dictlem = {}
-    #    for line in parent.corpus.lem_type_list :
-    #        dictlem[line[0]] = line[1]
     dictlem = {}
     print 'lecture des profiles'
     dictlem = {}
     print 'lecture des profiles'
-    #encoding = sys.getdefaultencoding()
     FileReader = codecs.open(File, 'r', encoding)
     Filecontent = FileReader.readlines()
     FileReader.close()
     FileReader = codecs.open(File, 'r', encoding)
     Filecontent = FileReader.readlines()
     FileReader.close()
@@ -418,17 +413,17 @@ def GetTxtProfile(dictprofile, cluster_size) :
     return '\n\n'.join(proflist)
 
 def formatExceptionInfo(maxTBlevel=5):
     return '\n\n'.join(proflist)
 
 def formatExceptionInfo(maxTBlevel=5):
-         cla, exc, trbk = sys.exc_info()
-         try :
-            excName = cla.__name__
-         except :
-            excName = 'None'
-         try:
-             excArgs = exc.args[0]
-         except :
-             excArgs = "<no args>"
-         excTb = traceback.format_tb(trbk, maxTBlevel)
-         return (excName, excArgs, excTb)
+    cla, exc, trbk = sys.exc_info()
+    try :
+        excName = cla.__name__
+    except :
+        excName = 'None'
+    try:
+        excArgs = exc.args[0]
+    except :
+        excArgs = "<no args>"
+    excTb = traceback.format_tb(trbk, maxTBlevel)
+    return (excName, excArgs, excTb)
 
 
 #fonction des etudiants de l'iut
 
 
 #fonction des etudiants de l'iut
@@ -692,7 +687,6 @@ def progressbar(self, maxi) :
     else :
         parent = self
     try :
     else :
         parent = self
     try :
-        print '###horrible hack progressbar'
         maxi = int(maxi)
     except :
         maxi = 1
         maxi = int(maxi)
     except :
         maxi = 1
index 1641795..67538dc 100644 (file)
@@ -58,6 +58,7 @@ def get_table_param(self, filename) :
             if self.tableau.parametres['colsep'] == 'tabulation' :
                 self.tableau.parametres['colsep'] = '\t'
             self.tableau.parametres['filetype'] = 'csv'
             if self.tableau.parametres['colsep'] == 'tabulation' :
                 self.tableau.parametres['colsep'] = '\t'
             self.tableau.parametres['filetype'] = 'csv'
+            self.tableau.parametres['encodage'] = dlg.le[dlg.list_encodages.GetSelection()]
     elif  getfileextension(filename) == '.xls' :
         dlg = dialog.FileOptionDialog(self, -1, _(u"File format").decode('utf8'), sep=False, sheet = True, size=(350, 200),
                      style=wx.DEFAULT_DIALOG_STYLE)
     elif  getfileextension(filename) == '.xls' :
         dlg = dialog.FileOptionDialog(self, -1, _(u"File format").decode('utf8'), sep=False, sheet = True, size=(350, 200),
                      style=wx.DEFAULT_DIALOG_STYLE)
@@ -967,7 +968,6 @@ class PrepSimi :
             param['cexfromchi'] = self.dial.checkit.GetValue()
         if 'sfromchi' in self.parametres :
             param['sfromchi'] = self.dial.checki.GetValue()
             param['cexfromchi'] = self.dial.checkit.GetValue()
         if 'sfromchi' in self.parametres :
             param['sfromchi'] = self.dial.checki.GetValue()
-            print param
         if 'vlabcolor' in self.parametres :
             param['vlabcolor'] = self.parametres['vlabcolor']
         if 'check_bystar' in dir(self.dial) :
         if 'vlabcolor' in self.parametres :
             param['vlabcolor'] = self.parametres['vlabcolor']
         if 'check_bystar' in dir(self.dial) :
index e3ded49..f1dabc0 100644 (file)
@@ -5,39 +5,36 @@
 #License: GNU GPL
 
 from optparse import OptionParser
 #License: GNU GPL
 
 from optparse import OptionParser
+from wx import BusyCursor
 
 parser = OptionParser()
 parser.add_option("-f", "--file", dest="filename",
                   help="open FILE", metavar="FILE", default=False)
 (options, args) = parser.parse_args()
 
 
 parser = OptionParser()
 parser.add_option("-f", "--file", dest="filename",
                   help="open FILE", metavar="FILE", default=False)
 (options, args) = parser.parse_args()
 
-#print args
-#print options
 import sys
 reload(sys)
 import locale
 import tempfile
 import codecs
 import os
 import sys
 reload(sys)
 import locale
 import tempfile
 import codecs
 import os
-import shutil
 from random import randint
 from random import randint
-from ConfigParser import *
+from ConfigParser import ConfigParser, RawConfigParser
 import webbrowser
 import gettext
 import logging
 #------------------------------------
 import wx
 import webbrowser
 import gettext
 import logging
 #------------------------------------
 import wx
-#import wx.aui
 import wx.lib.agw.aui as aui
 import wx.html
 import wx.grid
 import wx.lib.hyperlink as hl
 #------------------------------------
 import wx.lib.agw.aui as aui
 import wx.html
 import wx.grid
 import wx.lib.hyperlink as hl
 #------------------------------------
-from functions import BugReport, PlaySound, ReadLexique, History, DoConf, ReadDicoAsDico, progressbar
+from functions import BugReport, PlaySound, History
 from checkversion import NewVersion
 from guifunct import *
 from tableau import Tableau
 from checkversion import NewVersion
 from guifunct import *
 from tableau import Tableau
-from dialog import PrefDialog, CorpusPref
+from dialog import PrefDialog
 from tabfrequence import Frequences, FreqMultiple
 from tabchi2 import ChiSquare
 #from tabstudent import MakeStudent
 from tabfrequence import Frequences, FreqMultiple
 from tabchi2 import ChiSquare
 #from tabstudent import MakeStudent
@@ -48,18 +45,15 @@ from tabsimi import DoSimi
 from tabrsimple import InputText
 from tabverges import Prototypical
 from tabsplitvar import SplitMatrixFromVar
 from tabrsimple import InputText
 from tabverges import Prototypical
 from tabsplitvar import SplitMatrixFromVar
-#from textafcuci import AfcUci
 from textdist import AnalysePam
 from textstat import Stat
 from textaslexico import Lexico
 from textsimi import SimiTxt, SimiFromCluster
 from textwordcloud import WordCloud, ClusterCloud
 from textreinert import Reinert
 from textdist import AnalysePam
 from textstat import Stat
 from textaslexico import Lexico
 from textsimi import SimiTxt, SimiFromCluster
 from textwordcloud import WordCloud, ClusterCloud
 from textreinert import Reinert
-#from profile_segment import ProfileSegment
 #from textcheckcorpus import checkcorpus
 from openanalyse import OpenAnalyse
 from corpus import Builder, SubBuilder
 #from textcheckcorpus import checkcorpus
 from openanalyse import OpenAnalyse
 from corpus import Builder, SubBuilder
-#from sheet import MySheet
 from checkinstall import CreateIraDirectory, CheckRPath, FindRPAthWin32, FindRPathNix, CheckRPackages, IsNew, UpgradeConf, CopyConf, RLibsAreInstalled
 from chemins import RscriptsPath, ConstructConfigPath, ConstructDicoPath, ConstructGlobalPath, PathOut
 from parse_factiva_xml import ImportFactiva
 from checkinstall import CreateIraDirectory, CheckRPath, FindRPAthWin32, FindRPathNix, CheckRPackages, IsNew, UpgradeConf, CopyConf, RLibsAreInstalled
 from chemins import RscriptsPath, ConstructConfigPath, ConstructDicoPath, ConstructGlobalPath, PathOut
 from parse_factiva_xml import ImportFactiva
@@ -152,17 +146,18 @@ sys.stdout = printer()
 ConfigPath = ConstructConfigPath(UserConfigPath)
 
 langues = {'french' : wx.LANGUAGE_FRENCH,
 ConfigPath = ConstructConfigPath(UserConfigPath)
 
 langues = {'french' : wx.LANGUAGE_FRENCH,
-            'english' : wx.LANGUAGE_ENGLISH,
-            'portuguese' : wx.LANGUAGE_PORTUGUESE,
-            'italian' : wx.LANGUAGE_ITALIAN,
-            'spanish' : wx.LANGUAGE_SPANISH}
+           'english' : wx.LANGUAGE_ENGLISH,
+           'portuguese' : wx.LANGUAGE_PORTUGUESE,
+           'italian' : wx.LANGUAGE_ITALIAN,
+           'spanish' : wx.LANGUAGE_SPANISH
+           }
 
 code_langues = {'french' : 'fr_FR',
 
 code_langues = {'french' : 'fr_FR',
-             'english' : 'en',
-            'portuguese' : 'pt_PT',
-            'italian' : 'it_IT',
-            'spanish' : 'es_ES'
-            }
+                'english' : 'en',
+                'portuguese' : 'pt_PT',
+                'italian' : 'it_IT',
+                'spanish' : 'es_ES'
+               }
 #####################################################################
 
 class IraFrame(wx.Frame):
 #####################################################################
 
 class IraFrame(wx.Frame):
@@ -310,8 +305,8 @@ class IraFrame(wx.Frame):
 #--------------------------------------------------------------------
         self.statusbar = self.CreateStatusBar(2, wx.ST_SIZEGRIP)
         self.statusbar.SetStatusWidths([-2, -3])
 #--------------------------------------------------------------------
         self.statusbar = self.CreateStatusBar(2, wx.ST_SIZEGRIP)
         self.statusbar.SetStatusWidths([-2, -3])
-        self.statusbar.SetStatusText(u"Prêt", 0)
-        self.statusbar.SetStatusText(u"Bienvenue", 1)
+        self.statusbar.SetStatusText(_(u"Ready"), 0)
+        self.statusbar.SetStatusText(_(u"Wellcome"), 1)
 
         # min size for the frame itself isn't completely done.
         # see the end up FrameManager::Update() for the test
 
         # min size for the frame itself isn't completely done.
         # see the end up FrameManager::Update() for the test
@@ -583,9 +578,16 @@ vous devez signaler le chemin de l'éxecutable de R dans les préférences."""
             self.tableau = Tableau(self,os.path.abspath(self.input_path[0]))
             val = get_table_param(self, self.input_path[0])
             if val == wx.ID_OK :
             self.tableau = Tableau(self,os.path.abspath(self.input_path[0]))
             val = get_table_param(self, self.input_path[0])
             if val == wx.ID_OK :
-                self.tableau.make_content()
-                OpenAnalyse(self, self.tableau.parametres)
-                self.tree.OnItemAppend(self.tableau.parametres)
+                busy = wx.BusyInfo(_("Please wait...").decode('utf8'), self)
+                wx.SafeYield()
+                try :
+                    self.tableau.make_content()
+                    OpenAnalyse(self, self.tableau.parametres)
+                    self.tree.OnItemAppend(self.tableau.parametres)
+                    del busy 
+                except :
+                    del busy
+                    BugReport(self)
                 #self.tableau.show_tab()
 
     def OnOpenAnalyse(self, event):
                 #self.tableau.show_tab()
 
     def OnOpenAnalyse(self, event):
@@ -965,8 +967,8 @@ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, États-Unis."""
         except:
             BugReport(self)
 
         except:
             BugReport(self)
 
-    def SimiCluster(self, parametres = {}, fromprof = False, pathout = '', listactives = [], actives = [], tableau = None) :
-        DoSimi(self, param = parametres, fromprof =  fromprof, listactives = listactives, actives = actives, tableau = tableau)
+    def SimiCluster(self, parametres = {}, fromprof = False, tableau = None) :
+        self.analyse_matrix(DoSimi, parametres = parametres, analyse_type = 'simiclustermatrix', matrix = tableau)
     
 #    def OnSimi(self,evt):
 #        try :
     
 #    def OnSimi(self,evt):
 #        try :
index b362300..8e92228 100644 (file)
--- a/layout.py
+++ b/layout.py
@@ -12,7 +12,7 @@ import wx.lib.agw.labelbook as LB
 from wx.lib.agw.fmresources import *
 from chemins import ConstructPathOut, ChdTxtPathOut, FFF, ffr, PathOut, StatTxtPathOut, simipath
 from ConfigParser import ConfigParser
 from wx.lib.agw.fmresources import *
 from chemins import ConstructPathOut, ChdTxtPathOut, FFF, ffr, PathOut, StatTxtPathOut, simipath
 from ConfigParser import ConfigParser
-from functions import ReadProfileAsDico, GetTxtProfile, read_list_file, ReadList, exec_rcode, print_liste, BugReport, DoConf, indices_simi, check_Rresult, progressbar, normpath_win32
+from functions import ReadProfileAsDico, GetTxtProfile, read_list_file, ReadList, exec_rcode, print_liste, BugReport, DoConf, indices_simi, check_Rresult, progressbar, normpath_win32, TGen
 from ProfList import ProfListctrlPanel
 from guiparam3d import param3d, simi3d
 from PrintRScript import write_afc_graph, print_simi3d, PrintSimiScript
 from ProfList import ProfListctrlPanel
 from guiparam3d import param3d, simi3d
 from PrintRScript import write_afc_graph, print_simi3d, PrintSimiScript
@@ -659,7 +659,10 @@ class TgenLayout :
         self.page = page
         parametres = self.page.parametres
         ira = wx.GetApp().GetTopWindow()
         self.page = page
         parametres = self.page.parametres
         ira = wx.GetApp().GetTopWindow()
+        tgenpath = os.path.join(parametres['pathout'], 'tgen.csv')
         self.page.tgens, etoiles =  ReadList(parametres['tgenspec'], ira.syscoding, sep="\t")
         self.page.tgens, etoiles =  ReadList(parametres['tgenspec'], ira.syscoding, sep="\t")
+        tgen = TGen(path = tgenpath, encoding = parametres['encoding'])
+        tgen.read()
         tgentab = False
         gparent = None
         for i in range(page.GetPageCount()) :
         tgentab = False
         gparent = None
         for i in range(page.GetPageCount()) :
@@ -673,10 +676,12 @@ class TgenLayout :
                     break
         if tgentab :
             self.page.tgentab.RefreshData(self.page.tgens)
                     break
         if tgentab :
             self.page.tgentab.RefreshData(self.page.tgens)
+            self.page.tgentab.tgens = tgen.tgen
             self.page.SetSelection(i)
         else :
             self.page.tgentab = ListForSpec(ira, gparent, self.page.tgens, etoiles[1:])
             self.page.tgentab.tgen = True
             self.page.SetSelection(i)
         else :
             self.page.tgentab = ListForSpec(ira, gparent, self.page.tgens, etoiles[1:])
             self.page.tgentab.tgen = True
+            self.page.tgentab.tgens = tgen.tgen
             self.page.AddPage(self.page.tgentab, u'Tgens Specificities')
             self.page.SetSelection(self.page.GetPageCount() - 1)
 
             self.page.AddPage(self.page.tgentab, u'Tgens Specificities')
             self.page.SetSelection(self.page.GetPageCount() - 1)
 
@@ -706,7 +711,7 @@ class dolexlayout :
         self.TabStat.parametres = parametres
         self.ListPan = ListForSpec(ira, self, self.DictSpec, self.etoiles)
         if os.path.exists(self.pathout['banalites.csv']) :
         self.TabStat.parametres = parametres
         self.ListPan = ListForSpec(ira, self, self.DictSpec, self.etoiles)
         if os.path.exists(self.pathout['banalites.csv']) :
-            self.listban = ListForSpec(ira, self, self.dictban, ['eff'] + self.etoiles)
+            self.listban = ListForSpec(ira, self, self.dictban, ['eff'] + self.etoiles, usefirst = True)
         #self.ListPan2 = ListForSpec(sash.rightwin1, self, self.DictSpec, first)
         self.ListPant = ListForSpec(ira, self, self.DictType, self.etoiles)
         self.ListPanEff = ListForSpec(ira, self, self.DictEff, self.etoiles)
         #self.ListPan2 = ListForSpec(sash.rightwin1, self, self.DictSpec, first)
         self.ListPant = ListForSpec(ira, self, self.DictType, self.etoiles)
         self.ListPanEff = ListForSpec(ira, self, self.DictEff, self.etoiles)
@@ -732,10 +737,6 @@ class dolexlayout :
             self.TabAFC.AddPage(self.tabAFCTGraph, 'AFC type')
             self.TabStat.AddPage(self.TabAFC, 'AFC')
         
             self.TabAFC.AddPage(self.tabAFCTGraph, 'AFC type')
             self.TabStat.AddPage(self.TabAFC, 'AFC')
         
-        
-        
-           
-        
         ira.nb.AddPage(self.TabStat, u'Spécificités')
         self.ira = ira
         
         ira.nb.AddPage(self.TabStat, u'Spécificités')
         self.ira = ira
         
@@ -801,9 +802,11 @@ class GraphPanelDendro(wx.Panel):
         self.panel_1.SetBackgroundColour('white')
         self.deb = wx.StaticText(self.panel_1, -1, txt)
         dendro_img = wx.Image(os.path.join(self.ira.images_path,'but_dendro.png'), wx.BITMAP_TYPE_ANY).ConvertToBitmap()
         self.panel_1.SetBackgroundColour('white')
         self.deb = wx.StaticText(self.panel_1, -1, txt)
         dendro_img = wx.Image(os.path.join(self.ira.images_path,'but_dendro.png'), wx.BITMAP_TYPE_ANY).ConvertToBitmap()
+        dendro_liste_img = wx.Image(os.path.join(self.ira.images_path,'but_dendro_liste.png'), wx.BITMAP_TYPE_ANY).ConvertToBitmap()
+        dendro_cloud_img= wx.Image(os.path.join(self.ira.images_path,'but_dendro_cloud.png'), wx.BITMAP_TYPE_ANY).ConvertToBitmap()
         self.butdendro = wx.BitmapButton(self, -1, dendro_img)
         self.butdendro = wx.BitmapButton(self, -1, dendro_img)
-        self.butdendrotexte = wx.BitmapButton(self, -1, dendro_img)
-        self.butdendrocloud = wx.BitmapButton(self, -1, dendro_img)
+        self.butdendrotexte = wx.BitmapButton(self, -1, dendro_liste_img)
+        self.butdendrocloud = wx.BitmapButton(self, -1, dendro_cloud_img)
         
         for i in range(0,len(list_graph)):
             if os.path.exists(os.path.join(self.dirout,list_graph[i][0])) :
         
         for i in range(0,len(list_graph)):
             if os.path.exists(os.path.join(self.dirout,list_graph[i][0])) :
@@ -906,6 +909,9 @@ class GraphPanelDendro(wx.Panel):
             txt += """
             load("%s")
             source("%s")
             txt += """
             load("%s")
             source("%s")
+            if (is.null(debsup)) {
+                debsup <- debet
+            }
             chistable <- chistabletot[1:(debsup-1),]
             open_file_graph("%s", width=%i, height=%i, svg = %s)
             plot.dendro.prof(tree.cut1$tree.cl, classes, chistable, nbbycl = 60, type.dendro="%s", bw=%s, lab=NULL)
             chistable <- chistabletot[1:(debsup-1),]
             open_file_graph("%s", width=%i, height=%i, svg = %s)
             plot.dendro.prof(tree.cut1$tree.cl, classes, chistable, nbbycl = 60, type.dendro="%s", bw=%s, lab=NULL)
@@ -914,6 +920,9 @@ class GraphPanelDendro(wx.Panel):
             txt += """
             load("%s")
             source("%s")
             txt += """
             load("%s")
             source("%s")
+            if (is.null(debsup)) {
+                debsup <- debet
+            }
             chistable <- chistabletot[1:(debsup-1),]
             open_file_graph("%s", width=%i, height=%i, svg=%s)
             plot.dendro.cloud(tree.cut1$tree.cl, classes, chistable, nbbycl = 300, type.dendro="%s", bw=%s, lab=NULL)
             chistable <- chistabletot[1:(debsup-1),]
             open_file_graph("%s", width=%i, height=%i, svg=%s)
             plot.dendro.cloud(tree.cut1$tree.cl, classes, chistable, nbbycl = 300, type.dendro="%s", bw=%s, lab=NULL)
@@ -923,7 +932,10 @@ class GraphPanelDendro(wx.Panel):
         tmpfile = tempfile.mktemp()
         with open(tmpfile, 'w') as f :
             f.write(txt)
         tmpfile = tempfile.mktemp()
         with open(tmpfile, 'w') as f :
             f.write(txt)
+        busy = wx.BusyInfo(_("Please wait...").decode('utf8'), self.parent)
+        wx.SafeYield()
         error = exec_rcode(self.ira.RPath, tmpfile, wait=True) 
         error = exec_rcode(self.ira.RPath, tmpfile, wait=True) 
+        del busy
         check_Rresult(self.ira, error)
         self.list_graph.append([fileout, 'Dendrogramme CHD1 - %s' %  type_dendro])
         print_liste(self.dictpathout['liste_graph_chd'], self.list_graph)
         check_Rresult(self.ira, error)
         self.list_graph.append([fileout, 'Dendrogramme CHD1 - %s' %  type_dendro])
         print_liste(self.dictpathout['liste_graph_chd'], self.list_graph)
index ef36372..dea3c98 100644 (file)
@@ -26,7 +26,7 @@ from operator import itemgetter
 #---------------------------------------------------------------------------
 
 class ListForSpec(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.ColumnSorterMixin):
 #---------------------------------------------------------------------------
 
 class ListForSpec(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.ColumnSorterMixin):
-    def __init__(self, parent,gparent, dlist = {}, first = [], menu = True):
+    def __init__(self, parent,gparent, dlist = {}, first = [], usefirst = False, menu = True):
     #def  __init__(self, parent) :
         wx.ListCtrl.__init__( self, parent, -1, style=wx.LC_REPORT|wx.LC_VIRTUAL|wx.LC_HRULES|wx.LC_VRULES)
         self.parent=parent
     #def  __init__(self, parent) :
         wx.ListCtrl.__init__( self, parent, -1, style=wx.LC_REPORT|wx.LC_VIRTUAL|wx.LC_HRULES|wx.LC_VRULES)
         self.parent=parent
@@ -34,7 +34,7 @@ class ListForSpec(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.ColumnSor
         self.dlist=dlist
         self.first = first
         self.tgen = False
         self.dlist=dlist
         self.first = first
         self.tgen = False
-        if 'etoiles' in dir(self.gparent) :
+        if 'etoiles' in dir(self.gparent) and not usefirst :
             self.etoiles = self.gparent.etoiles
         else :
             self.etoiles = []
             self.etoiles = self.gparent.etoiles
         else :
             self.etoiles = []
@@ -248,15 +248,10 @@ class ListForSpec(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.ColumnSor
         parametres = page.parametres
         paneff = self.gparent.ListPanEff
         panchi = self.gparent.ListPan
         parametres = page.parametres
         paneff = self.gparent.ListPanEff
         panchi = self.gparent.ListPan
-        #etoiles = self.gparent.etoiles
         et = self.etoiles[ind]
         et = self.etoiles[ind]
-        
-        #if et.startswith(u'X.') :
-        #    et = et.replace(u'X.', u'*')
         uces = corpus.getucesfrometoile(et)
         self.la = [panchi.dlist[i][0] for i in range(0, len(panchi.dlist)) if panchi.dlist[i][ind+1] >= minind ]
         self.lchi = [panchi.dlist[i][ind+1] for i in range(0, len(panchi.dlist)) if panchi.dlist[i][ind+1] >= minind ]
         uces = corpus.getucesfrometoile(et)
         self.la = [panchi.dlist[i][0] for i in range(0, len(panchi.dlist)) if panchi.dlist[i][ind+1] >= minind ]
         self.lchi = [panchi.dlist[i][ind+1] for i in range(0, len(panchi.dlist)) if panchi.dlist[i][ind+1] >= minind ]
-        #lfreq = [paneff.dlist[i][ind+1] for i in range(0, len(panchi.dlist)) if panchi.dlist[i][ind+1] >= minind ]
         if max(self.lchi) == float('inf') :
             nchi = []
             for val in self.lchi :
         if max(self.lchi) == float('inf') :
             nchi = []
             for val in self.lchi :
@@ -278,8 +273,6 @@ class ListForSpec(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.ColumnSor
         ucis_txt, ucestxt = doconcorde(corpus, nuces, self.la)
         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 in range(0,len(ucestxt))])
         win = message(self, items, u"Segments de texte caractéristiques - %s" % self.first[ind], (900, 600))
         ucis_txt, ucestxt = doconcorde(corpus, nuces, self.la)
         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 in range(0,len(ucestxt))])
         win = message(self, items, u"Segments de texte caractéristiques - %s" % self.first[ind], (900, 600))
-        #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)
         win.Show(True)
         
     def OnPopupTwo(self, event):
         win.Show(True)
         
     def OnPopupTwo(self, event):
@@ -289,15 +282,17 @@ class ListForSpec(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.ColumnSor
             corpus = page.corpus
         else :
             corpus = self.parent.parent.parent.corpus
             corpus = page.corpus
         else :
             corpus = self.parent.parent.parent.corpus
-        item=self.getColumnText(self.GetFirstSelected(), 0)
-        uce_ok = corpus.getlemuces(item)
         ira = wx.GetApp().GetTopWindow()
         ira = wx.GetApp().GetTopWindow()
-        ucis_txt, ucestxt = doconcorde(corpus, uce_ok, [item])
+        item=self.getColumnText(self.GetFirstSelected(), 0)
+        if not self.tgen :
+            uce_ok = corpus.getlemuces(item)
+            wordlist = [item]
+        else :
+            uce_ok = corpus.gettgenst(self.tgens[item])
+            wordlist = [val for val in self.tgens[item] if val in corpus.lems]
+        ucis_txt, ucestxt = doconcorde(corpus, uce_ok, wordlist)
         items = dict([[i, '<br><br>'.join([ucis_txt[i], ucestxt[i]])] for i in range(0,len(ucestxt))])
         items = dict([[i, '<br><br>'.join([ucis_txt[i], ucestxt[i]])] for i in range(0,len(ucestxt))])
-        win = message(ira, items, u"Concordancier - %s" % item, (800, 500))
-        #win = message(ira, u"Concordancier", (800, 500))
-        #win.html = ('<html>\n<h1>%s</h1>' % item) + '<br>'.join(['<br>'.join([ucis_txt[i], ucestxt[i]]) for i in range(0,len(ucestxt))]) + '\n</html>'
-        #win.HtmlPage.SetPage(win.html)
+        win = message(ira, items, u"Concordancier - %s" % item, (800, 500), uceids = uce_ok)
         win.Show(True)
 
     def getinf(self, txt) :
         win.Show(True)
 
     def getinf(self, txt) :
index 899a0bb..c8089d2 100644 (file)
@@ -162,7 +162,7 @@ class OpenAnalyse():
             WordCloudLayout(self.parent, corpus, self.conf)
         elif self.conf['type'] == 'reinertmatrix' :
             OpenCHDS(self.parent,  corpus, self.conf, Alceste = False)
             WordCloudLayout(self.parent, corpus, self.conf)
         elif self.conf['type'] == 'reinertmatrix' :
             OpenCHDS(self.parent,  corpus, self.conf, Alceste = False)
-        elif self.conf['type'] == 'simimatrix' :
+        elif self.conf['type'] == 'simimatrix' or self.conf['type'] == 'simiclustermatrix':
             SimiMatLayout(self.parent, corpus, self.conf)
         elif self.conf['type'] == 'proto' :
             ProtoLayout(self.parent, corpus, self.conf)
             SimiMatLayout(self.parent, corpus, self.conf)
         elif self.conf['type'] == 'proto' :
             ProtoLayout(self.parent, corpus, self.conf)
index 9de8067..db34395 100644 (file)
@@ -30,7 +30,7 @@ class DoSimi(AnalyseMatrix):
         self.cmd = self.parametres.get('cmd', False)
         self.dirout = self.parametres.get('pathout', False)
         if self.fromprof:
         self.cmd = self.parametres.get('cmd', False)
         self.dirout = self.parametres.get('pathout', False)
         if self.fromprof:
-            self.paramsimi = parametres
+            self.paramsimi = self.parametres
         else :
             self.paramsimi = {'coeff' : 0,
                           'layout' : 2,
         else :
             self.paramsimi = {'coeff' : 0,
                           'layout' : 2,
@@ -109,7 +109,6 @@ class DoSimi(AnalyseMatrix):
                     #self.parametres['type'] = 'simimatrix'
                     if not self.pathout : 
                         self.parametres['pathout'] = ConstructPathOut(self.parametres['pathout'], 'SimiMatrix')
                     #self.parametres['type'] = 'simimatrix'
                     if not self.pathout : 
                         self.parametres['pathout'] = ConstructPathOut(self.parametres['pathout'], 'SimiMatrix')
-                        print self.parametres['pathout']
                     else :
                         self.parametres['pathout'] = self.dirout
                     self.pathout.createdir(self.parametres['pathout'])
                     else :
                         self.parametres['pathout'] = self.dirout
                     self.pathout.createdir(self.parametres['pathout'])
diff --git a/tree.py b/tree.py
index 532457f..6d0945f 100644 (file)
--- a/tree.py
+++ b/tree.py
@@ -127,6 +127,7 @@ class LeftTree(CT.CustomTreeCtrl):
         self.ild['chi2'] = self.il.Add(wx.Image(os.path.join(self.parent.images_path,'chi2.png'), wx.BITMAP_TYPE_PNG).Scale(16,16).ConvertToBitmap())
         self.ild['reinertmatrix'] = self.il.Add(wx.Image(os.path.join(self.parent.images_path,'reinertmatrix.png'), wx.BITMAP_TYPE_PNG).Scale(16,16).ConvertToBitmap())
         self.ild['simimatrix'] = self.il.Add(wx.Image(os.path.join(self.parent.images_path,'simimatrix.png'), wx.BITMAP_TYPE_PNG).Scale(16,16).ConvertToBitmap())
         self.ild['chi2'] = self.il.Add(wx.Image(os.path.join(self.parent.images_path,'chi2.png'), wx.BITMAP_TYPE_PNG).Scale(16,16).ConvertToBitmap())
         self.ild['reinertmatrix'] = self.il.Add(wx.Image(os.path.join(self.parent.images_path,'reinertmatrix.png'), wx.BITMAP_TYPE_PNG).Scale(16,16).ConvertToBitmap())
         self.ild['simimatrix'] = self.il.Add(wx.Image(os.path.join(self.parent.images_path,'simimatrix.png'), wx.BITMAP_TYPE_PNG).Scale(16,16).ConvertToBitmap())
+        self.ild['simiclustermatrix'] = self.il.Add(wx.Image(os.path.join(self.parent.images_path,'simimatrix.png'), wx.BITMAP_TYPE_PNG).Scale(16,16).ConvertToBitmap())
         self.ild['proto'] = self.il.Add(wx.Image(os.path.join(self.parent.images_path,'proto.png'), wx.BITMAP_TYPE_PNG).Scale(16,16).ConvertToBitmap())
         self.SetImageList(self.il)
         
         self.ild['proto'] = self.il.Add(wx.Image(os.path.join(self.parent.images_path,'proto.png'), wx.BITMAP_TYPE_PNG).Scale(16,16).ConvertToBitmap())
         self.SetImageList(self.il)
         
@@ -970,6 +971,7 @@ class LeftTree(CT.CustomTreeCtrl):
         if select :
             self.history.addtab(item)
             self.SetItemBold(child, True)
         if select :
             self.history.addtab(item)
             self.SetItemBold(child, True)
+            self.SelectItem(child)
         
         #dlg = wx.TextEntryDialog(self, "Please Enter The New Item Name", 'Item Naming', 'Python')
 
         
         #dlg = wx.TextEntryDialog(self, "Please Enter The New Item Name", 'Item Naming', 'Python')