correction 3.0
authorPierre Ratinaud <ratinaud@univ-tlse2.fr>
Wed, 19 Jun 2024 10:23:35 +0000 (12:23 +0200)
committerPierre Ratinaud <ratinaud@univ-tlse2.fr>
Wed, 19 Jun 2024 10:23:35 +0000 (12:23 +0200)
15 files changed:
PrintRScript.py
ProfList.py
Rscripts/prototypical.R
analysetxt.py
configuration/global.cfg
configuration/iramuteq.cfg
corpus.py
dialog.py
elcategorizator.py
functions.py
iramuteq.py
layout.py
openanalyse.py
tabverges.py
tree.py

index f8aaa96..e005361 100755 (executable)
@@ -125,7 +125,7 @@ class Alceste2(PrintRScript):
 #
 
 
 #
 
 
-def RchdTxt(DicoPath, RscriptPath, mincl, classif_mode, nbt = 9, svdmethod = 'svdR', libsvdc = False, libsvdc_path = None, R_max_mem = False, mode_patate = False, nbproc=1):
+def RchdTxt(DicoPath, RscriptPath, mincl, classif_mode, nbt = 9, svdmethod = 'svdR', libsvdc = False, libsvdc_path = None, R_max_mem = False, mode_patate = False, nbproc=10):
     txt = """
     source("%s")
     source("%s")
     txt = """
     source("%s")
     source("%s")
@@ -176,7 +176,7 @@ def RchdTxt(DicoPath, RscriptPath, mincl, classif_mode, nbt = 9, svdmethod = 'sv
         row.names(data2) <- 1:nrow(data2)
         """ % ffr(DicoPath['TableUc2'])
     txt += """
         row.names(data2) <- 1:nrow(data2)
         """ % ffr(DicoPath['TableUc2'])
     txt += """
-    log1 <- "%s"
+    #log1 <- "%s"
     #print('FIXME : source newCHD')
     #source('/home/pierre/workspace/iramuteq/Rscripts/newCHD.R')
     #nbproc <- %s
     #print('FIXME : source newCHD')
     #source('/home/pierre/workspace/iramuteq/Rscripts/newCHD.R')
     #nbproc <- %s
@@ -741,7 +741,7 @@ class PrintSimiScript(PrintRScript):
                 """
             txt += """
             dm <-readMM(dm.path)
                 """
             txt += """
             dm <-readMM(dm.path)
-            cn <- read.table(cn.path, sep="\t", quote='"')
+            cn <- read.table(cn.path, sep="\t", quote='"', comment.char="")
             colnames(dm) <- cn[,1]
             if (file.exists(selected.col)) {
                 sel.col <- read.csv2(selected.col, header = FALSE)
             colnames(dm) <- cn[,1]
             if (file.exists(selected.col)) {
                 sel.col <- read.csv2(selected.col, header = FALSE)
@@ -1243,7 +1243,7 @@ class ProtoScript(PrintRScript):
         }
         mat <- read.csv2("%s", header = FALSE, row.names=1, sep='\t', quote='"', dec='.')
         open_file_graph("%s",height=800, width=1000)
         }
         mat <- read.csv2("%s", header = FALSE, row.names=1, sep='\t', quote='"', dec='.')
         open_file_graph("%s",height=800, width=1000)
-        prototypical(mat, mfreq = %s, mrank = %s, cloud = FALSE, cexrange=c(1,2.4), cexalpha= c(0.4, 1), type = '%s', mat.col.path='/tmp/matcol.csv')
+        prototypical(mat, mfreq = %s, mrank = %s, cloud = FALSE, cexrange=c(1,2.4), cexalpha= c(0.4, 1), type = '%s')#, mat.col.path='/tmp/matcol.csv')
         dev.off()
         """ % (ffr(self.analyse.pathout['table.csv']), ffr(self.analyse.pathout['proto.png']), self.parametres['limfreq'], self.parametres['limrang'], self.parametres['typegraph'])
         self.add(txt)
         dev.off()
         """ % (ffr(self.analyse.pathout['table.csv']), ffr(self.analyse.pathout['proto.png']), self.parametres['limfreq'], self.parametres['limrang'], self.parametres['typegraph'])
         self.add(txt)
index ebc9a53..5e35765 100644 (file)
@@ -676,7 +676,7 @@ class ProfListctrlPanel(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.Col
             ntab2 = ntab2[:limite]
             nuces = [val[1] for val in ntab2]
             dlg.Update(3, 'concordancier...')
             ntab2 = ntab2[:limite]
             nuces = [val[1] for val in ntab2]
             dlg.Update(3, 'concordancier...')
-            ucis_txt, ucestxt = doconcorde(corpus, nuces, self.la, uci = uci)
+            ucis_txt, ucestxt = doconcorde(corpus, nuces, self.la, uci = uci, fontsize = self.ira.fontsize)
             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.Destroy()
             win = message(self, items, ' - '.join([_("Typical text segments"), "Classe %i" % self.cl]), (750, 600), uceids = nuces)
             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.Destroy()
             win = message(self, items, ' - '.join([_("Typical text segments"), "Classe %i" % self.cl]), (750, 600), uceids = nuces)
index 53a3d30..c74c1c8 100644 (file)
@@ -50,7 +50,7 @@ prototypical <- function(x, mfreq = NULL, mrank = NULL, cexrange=c(0.8, 3), cexa
         labcol <- colors[ord.ori]
     }
        mat.col <- cbind(r.names, labcol)
         labcol <- colors[ord.ori]
     }
        mat.col <- cbind(r.names, labcol)
-       write.table(mat.col,file=mat.col.path)
+       #write.table(mat.col,file=mat.col.path)
     ti <- c("Zone du noyau", "Première périphérie", "Seconde périphérie", "Elements contrastés")
        if (type == 'classical') {
            par(oma=c(1,3,3,1))
     ti <- c("Zone du noyau", "Première périphérie", "Seconde périphérie", "Elements contrastés")
        if (type == 'classical') {
            par(oma=c(1,3,3,1))
index f11a596..7bbd053 100755 (executable)
@@ -48,6 +48,7 @@ class AnalyseText :
             self.parametres = self.make_config(parametres)
         if self.parametres is not None:
             self.keys = DoConf(self.ira.ConfigPath['key']).getoptions()
             self.parametres = self.make_config(parametres)
         if self.parametres is not None:
             self.keys = DoConf(self.ira.ConfigPath['key']).getoptions()
+            print(self.keys)
             gramact = [k for k in self.keys if self.keys[k] == 1]
             gramsup = [k for k in self.keys if self.keys[k] == 2]
             self.parametres['pathout'] = self.pathout.mkdirout()
             gramact = [k for k in self.keys if self.keys[k] == 1]
             gramsup = [k for k in self.keys if self.keys[k] == 2]
             self.parametres['pathout'] = self.pathout.mkdirout()
index 8f28997..c27d8f5 100644 (file)
@@ -2,7 +2,7 @@
 #do not edit !
 gpl-en = gpl-2.0.txt
 name = iramuteq
 #do not edit !
 gpl-en = gpl-2.0.txt
 name = iramuteq
-copyright = (c) 2008-2015 Pierre Ratinaud
+copyright = (c) 2008-2024 Pierre Ratinaud
 author = Pierre Ratinaud
 gpl-fr = gpl-2.0-fr.txt
 dev = Pierre Ratinaud (Université de Toulouse - Laboratoire LERASS - ratinaud@univ-tlse2.fr);Sébastien Déjean (Université de Toulouse);David Skalinder (Mash Strategy - davids@mash.uk.com);
 author = Pierre Ratinaud
 gpl-fr = gpl-2.0-fr.txt
 dev = Pierre Ratinaud (Université de Toulouse - Laboratoire LERASS - ratinaud@univ-tlse2.fr);Sébastien Déjean (Université de Toulouse);David Skalinder (Mash Strategy - davids@mash.uk.com);
index 7d24336..2b962fc 100644 (file)
@@ -10,3 +10,4 @@ rlibs = false
 libsvdc = false
 libsvdc_path = /usr/bin/svd
 rmirror = http://cran.rstudio.com/
 libsvdc = false
 libsvdc_path = /usr/bin/svd
 rmirror = http://cran.rstudio.com/
+fontsize = 16
index 489d4f1..555a034 100644 (file)
--- a/corpus.py
+++ b/corpus.py
@@ -258,14 +258,14 @@ class Corpus :
 
     def getucisize(self) :
         ucesize = self.getucesize()
 
     def getucisize(self) :
         ucesize = self.getucesize()
-        return [sum(ucesize[uci.uces[0].ident:(uci.uces[-1].ident + 1)]) for uci in self.ucis]
+        return [sum(ucesize[uci.uces[0].ident:(uci.uces[-1].ident + 1)]) for uci in self.ucis if len(uci.uces) != 0]
 
     def getucesize(self) :
         res = self.getalluces()
         return [len(uce[1].split()) for uce in res]
 
     def getconcorde(self, uces) :
 
     def getucesize(self) :
         res = self.getalluces()
         return [len(uce[1].split()) for uce in res]
 
     def getconcorde(self, uces) :
-        return self.cuces.execute('select * from uces where id IN (%s) ORDER BY id;' % ', '.join([repr(i) for i in uces])) 
+        return self.cuces.execute('select * from uces where id IN (%s) ORDER BY id;' % ', '.join([repr(i) for i in uces]))
 
     def getuciconcorde(self, ucis) :
         uces = [[val,[uce.ident for uce in self.ucis[val].uces]] for val in ucis]
 
     def getuciconcorde(self, ucis) :
         uces = [[val,[uce.ident for uce in self.ucis[val].uces]] for val in ucis]
@@ -293,6 +293,11 @@ class Corpus :
     def getucesfrometoile(self, etoile) :
         return [uce.ident for uci in self.ucis for uce in uci.uces if etoile in uci.etoiles]
 
     def getucesfrometoile(self, etoile) :
         return [uce.ident for uci in self.ucis for uce in uci.uces if etoile in uci.etoiles]
 
+    def getucisfrometoile(self, etoile):
+        uces = [uce.ident for uci in self.ucis for uce in uci.uces if etoile in uci.etoiles]
+        return list(set([self.getucefromid(val).uci for val in uces]))
+
+
     def getetoileuces(self) :
         log.info('get uces etoiles')
         etoileuces = {}
     def getetoileuces(self) :
         log.info('get uces etoiles')
         etoileuces = {}
@@ -878,7 +883,7 @@ class Corpus :
             etoileuces = self.getetoileuces()
         else :
             etoileuces = self.getetoileucis()
             etoileuces = self.getetoileuces()
         else :
             etoileuces = self.getetoileucis()
-        etoileuces = dict([[et, etoileuces[et]] for et in etoileuces if len(etoileuces[et]) > 1])
+        etoileuces = dict([[et, etoileuces[et]] for et in etoileuces if len(etoileuces[et]) > 0])
         with open(fileout, 'w', encoding='utf8') as f :
             f.write('\n'.join([';'.join([et] + [repr(len(set(etoileuces[et]).intersection(classe))) for classe in ucecl]) for et in etoileuces])) #.encode(self.parametres['syscoding'])
         #etoiles = self.make_etoiles()
         with open(fileout, 'w', encoding='utf8') as f :
             f.write('\n'.join([';'.join([et] + [repr(len(set(etoileuces[et]).intersection(classe))) for classe in ucecl]) for et in etoileuces])) #.encode(self.parametres['syscoding'])
         #etoiles = self.make_etoiles()
@@ -1505,7 +1510,7 @@ class BuildSubCorpus(BuildCorpus):
                 newuces = []
                 newpara = []
                 for et in uci.paras :
                 newuces = []
                 newpara = []
                 for et in uci.paras :
-                    keepuces = [CopyUce(uce) for uce in uci.uces if uce.ident in dictucekeep]
+                    keepuces = [CopyUce(uce) for uce in uci.uces if uce.ident in dictucekeepand and uce.para == idpara]
                     idpara += 1
                     if keepuces != [] :
                         newuces += keepuces
                     idpara += 1
                     if keepuces != [] :
                         newuces += keepuces
index 54751ad..edefe21 100755 (executable)
--- a/dialog.py
+++ b/dialog.py
@@ -2434,6 +2434,7 @@ class ConcordList(wx.html.HtmlListBox):
         self.concord = concord
         #self.script_status = dict()
         wx.html.HtmlListBox.__init__(self, parent, -1, size = (900, 600))
         self.concord = concord
         #self.script_status = dict()
         wx.html.HtmlListBox.__init__(self, parent, -1, size = (900, 600))
+        #self.SetFont(wx.Font(30,wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL))
         self.SetItemCount(len(concord))
         #self.Bind(wx.EVT_LISTBOX, self.RefreshMe)
         #self.Bind(wx.EVT_LISTBOX_DCLICK, self.Download)
         self.SetItemCount(len(concord))
         #self.Bind(wx.EVT_LISTBOX, self.RefreshMe)
         #self.Bind(wx.EVT_LISTBOX_DCLICK, self.Download)
@@ -2455,6 +2456,7 @@ class message(wx.Frame):
         #self.HtmlPage=wx.html.HtmlWindow(self, -1)
         self.panel = wx.Panel(self, wx.ID_ANY)
         self.HtmlPage = ConcordList(self.panel, items)
         #self.HtmlPage=wx.html.HtmlWindow(self, -1)
         self.panel = wx.Panel(self, wx.ID_ANY)
         self.HtmlPage = ConcordList(self.panel, items)
+        #self.HtmlPage.SetFonts("","",self.ira.fontsize)
         #self.HtmlPage.SetMinSize( size )
         #if "gtk2" in wx.PlatformInfo:
         #    self.HtmlPage.SetStandardFonts()
         #self.HtmlPage.SetMinSize( size )
         #if "gtk2" in wx.PlatformInfo:
         #    self.HtmlPage.SetStandardFonts()
@@ -3311,12 +3313,12 @@ class MergeClusterFrame ( wx.Dialog ):
                 for analyse in corpus['analyses'] :
                     if analyse['type'] == 'alceste' :
                         if corpus['uuid'] not in self.intree :
                 for analyse in corpus['analyses'] :
                     if analyse['type'] == 'alceste' :
                         if corpus['uuid'] not in self.intree :
-                            child = self.tree.Append(self.tree.root, corpus['corpus_name'])
+                            child = self.tree.AppendItem(self.tree.root, corpus['corpus_name'])
                             self.tree.SetItemImage(child, self.ild['corpus'], wx.TreeItemIcon_Normal)
                             self.tree.SetItemImage(child, self.ild['corpus'], wx.TreeItemIcon_Expanded)
                             self.tree.SetPyData(child, corpus)
                             self.intree[corpus['uuid']] = corpus
                             self.tree.SetItemImage(child, self.ild['corpus'], wx.TreeItemIcon_Normal)
                             self.tree.SetItemImage(child, self.ild['corpus'], wx.TreeItemIcon_Expanded)
                             self.tree.SetPyData(child, corpus)
                             self.intree[corpus['uuid']] = corpus
-                        last = self.tree.Append(child, analyse['name'])
+                        last = self.tree.AppendItem(child, analyse['name'])
                         self.tree.SetItemImage(last, self.ild['reinert'], wx.TreeItemIcon_Normal)
                         self.tree.SetItemImage(last, self.ild['reinert'], wx.TreeItemIcon_Expanded)
 
                         self.tree.SetItemImage(last, self.ild['reinert'], wx.TreeItemIcon_Normal)
                         self.tree.SetItemImage(last, self.ild['reinert'], wx.TreeItemIcon_Expanded)
 
@@ -3325,7 +3327,7 @@ class MergeClusterFrame ( wx.Dialog ):
                             parametres = DoConf(analyse['ira']).getoptions()
                             clnb = int(parametres['clnb'])
                             for i in range(clnb) :
                             parametres = DoConf(analyse['ira']).getoptions()
                             clnb = int(parametres['clnb'])
                             for i in range(clnb) :
-                                cl = self.tree.Append(last, 'classe %i' % (i+1))
+                                cl = self.tree.AppendItem(last, 'classe %i' % (i+1))
                                 self.tree.SetItemImage(cl, self.ild['wordcloud'], wx.TreeItemIcon_Normal)
                                 self.tree.SetItemImage(cl, self.ild['wordcloud'], wx.TreeItemIcon_Expanded)
                                 self.tree.SetPyData(cl, {'type' : 'cluster', 'analyse': analyse['uuid'], 'number': i+1, 'corpus': analyse['corpus'], 'ira':analyse['ira']})
                                 self.tree.SetItemImage(cl, self.ild['wordcloud'], wx.TreeItemIcon_Normal)
                                 self.tree.SetItemImage(cl, self.ild['wordcloud'], wx.TreeItemIcon_Expanded)
                                 self.tree.SetPyData(cl, {'type' : 'cluster', 'analyse': analyse['uuid'], 'number': i+1, 'corpus': analyse['corpus'], 'ira':analyse['ira']})
index 23dcfa4..367e22a 100644 (file)
@@ -6,7 +6,7 @@
 import os
 import wx
 import wx.xrc
 import os
 import wx
 import wx.xrc
-#from wx.lib.splitter import MultiSplitterWindow
+from wx.lib.splitter import MultiSplitterWindow
 from listlex import *
 import pickle
 import json
 from listlex import *
 import pickle
 import json
@@ -156,6 +156,181 @@ class CategoDict :
 #cate = CategoDict()
 
 
 #cate = CategoDict()
 
 
+#class ElCategorizator ( wx.Panel ):
+#
+#    def __init__( self, parent, pathout, tableau, id = wx.ID_ANY, pos = wx.DefaultPosition, size = wx.Size( 500,300 ), style = wx.TAB_TRAVERSAL, name = wx.EmptyString ):
+#        wx.Panel.__init__ ( self, parent, id = id, pos = pos, size = size, style = style, name = name )
+#        self.pathout = pathout
+#        self.parent = parent
+#        self.tableau = tableau
+#
+#        self.cate = CategoDict(self.pathout)
+#        gsizer =  wx.BoxSizer( wx.VERTICAL )
+#
+#        bSizer1 = wx.BoxSizer( wx.HORIZONTAL )
+#
+#        self.m_listToCate = ListForWords(self, dlist = self.cate, first = ['eff'])
+#        bSizer1.Add( self.m_listToCate, 2, wx.ALL|wx.EXPAND, 5 )
+#
+#        self.m_listCate = ListForCate(self, dlist = self.cate, first = ['eff'])
+#        bSizer1.Add( self.m_listCate, 1, wx.ALL|wx.EXPAND, 5 )
+#
+#        self.m_listCateWords = ListForCateWords(self, dlist = self.cate, first = ['eff'])
+#        bSizer1.Add( self.m_listCateWords, 1, wx.ALL|wx.EXPAND, 5 )
+#
+#        bSizer2 = wx.BoxSizer( wx.HORIZONTAL )
+#
+#        self.butsave = wx.Button( self, wx.ID_SAVE, u"Save", wx.DefaultPosition, wx.DefaultSize, 0 )
+#        bSizer2.Add( self.butsave, 0, wx.ALL, 5 )
+#
+#        self.butcsv = wx.Button( self, wx.ID_ANY, u"Export Columns", wx.DefaultPosition, wx.DefaultSize, 0 )
+#        bSizer2.Add( self.butcsv, 0, wx.ALL, 5 )
+#
+#        self.butdict = wx.Button( self, wx.ID_ANY, u"Export dictonary", wx.DefaultPosition, wx.DefaultSize, 0 )
+#        bSizer2.Add( self.butdict, 0, wx.ALL, 5 )
+#
+#        self.butload = wx.Button( self, wx.ID_ANY, u"Load a categorization", wx.DefaultPosition, wx.DefaultSize, 0 )
+#        bSizer2.Add( self.butload, 0, wx.ALL, 5 )
+#
+#        self.butaddcate = wx.Button( self, wx.ID_ANY, u"Add a category", wx.DefaultPosition, wx.DefaultSize, 0 )
+#        bSizer2.Add( self.butaddcate, 0, wx.ALL, 5 )
+#
+#
+#        bSizer3 = wx.BoxSizer( wx.HORIZONTAL )
+#
+#        self.nbword = """Words : {:d} ({:d}) | """
+#
+#        self.stat = """ Words to categorize : {:d} ({}%) - {:d} ({}%) -- Categories : {:d} - {:d} ({}%) - {:d} ({}%)"""
+##        nbtocat, totocat, nbcate, totcate = self.cate.makestat()
+##        lenwords = self.cate.lenwords
+##        totwords = totocat + totcate
+##        prtocat = repr(nbtocat/lenwords)
+##        prtotocat = repr(totocat/totwords)
+##        prcate = repr(totcate/totwords)
+#        self.wordtxt = wx.StaticText(self, -1, "")
+#        bSizer3.Add( self.wordtxt, 0, wx.ALL, 5 )
+#        self.stattxt = wx.StaticText(self, -1, "")
+#        bSizer3.Add( self.stattxt, 0, wx.ALL, 5 )
+#
+#
+#        gsizer.Add( bSizer2, 0, wx.EXPAND, 5 )
+#        gsizer.Add( bSizer1, 2, wx.EXPAND, 5 )
+#        gsizer.Add( bSizer3, 0, wx.EXPAND, 5 )
+#
+#        self.butsave.Bind(wx.EVT_BUTTON, self.OnSave)
+#        self.butcsv.Bind(wx.EVT_BUTTON, self.OnCSV)
+#        self.butdict.Bind(wx.EVT_BUTTON, self.OnDict)
+#        self.butsave.SetBackgroundColour((14, 242, 14, 255))
+#        self.butload.Bind(wx.EVT_BUTTON, self.OnLoad)
+#        self.butaddcate.Bind(wx.EVT_BUTTON, self.OnAddCate)
+#        self.OnStat()
+#        self.SetSizer( gsizer )
+#        self.Layout()
+#
+#    def __del__( self ):
+#        pass
+#
+#
+#    def OnLoad(self, event) :
+#        if len(self.cate.cate['CATE']) != 0 :
+#            message = wx.MessageDialog(self, _("Categories must be empty to load a categorization."), _("Information"), wx.OK|wx.ICON_WARNING)
+#            message.ShowModal()
+#            message.Destroy()
+#            return
+#        wildcard = "json|*.json|" \
+#                   "All file|*.*"
+#        dlg = wx.FileDialog(
+#             self, message="Choose a file",
+#             defaultDir=self.pathout.dirout,
+#             defaultFile="",
+#             wildcard=wildcard,
+#             style=wx.FD_OPEN |
+#                   wx.FD_CHANGE_DIR | wx.FD_FILE_MUST_EXIST |
+#                   wx.FD_PREVIEW
+#             )
+#
+#        if dlg.ShowModal() == wx.ID_OK:
+#            paths = dlg.GetPaths()
+#            path = paths[0]
+#            self.cate.loadcate(path)
+#            self.m_listCate.RefreshData(self.cate.getcate())
+#            self.m_listToCate.RefreshData(self.cate.getwordstocate())
+#        dlg.Destroy()
+#
+#    def OnSave(self, event) :
+#        self.cate.save()
+#        self.butsave.SetBackgroundColour((14, 242, 14, 255))
+#
+#    def OnCSV(self, event) :
+#        wordscate = self.cate.getwordscate()
+#        newtab = [['category%i' % i for i in range(1, len(self.tableau.selected_col)+1)]]
+#        for line in self.tableau.select_col(self.tableau.selected_col):
+#            newline = []
+#            for word in line :
+#                newline.append(wordscate.get(word,word))
+#            newtab.append(newline)
+#        with open(self.pathout['tableout.csv'], 'w', encoding='utf8') as f :
+#            f.write('\n'.join(['\t'.join(line) for line in newtab]))
+#        message = wx.MessageDialog(self, _("Export successful\n%s" % self.pathout['tableout.csv']), _("Information"), wx.OK|wx.ICON_INFORMATION)
+#        message.ShowModal()
+#        message.Destroy()
+#
+#    def OnDict(self, event):
+#        with open(self.pathout['dictionnary.txt'], 'w', encoding='utf8') as f :
+#            for categorie in self.cate.cate['CATE'] :
+#                f.write(categorie + ': \t' + repr(self.cate.cate['CATE'][categorie][0]) + '\n')
+#                for word in self.cate.cate['CATE'][categorie][1] :
+#                    f.write('\t' + word + ': \t' + repr(self.cate.cate['CATE'][categorie][1][word]) + '\n')
+#            for word in self.cate.cate['TOCATE'] :
+#                f.write(word + ':\t' + repr(self.cate.cate['TOCATE'][word]) + '\n')
+#        message = wx.MessageDialog(self, _("Export successful\n%s" % self.pathout['dictionnary.txt']), _("Information"), wx.OK|wx.ICON_INFORMATION)
+#        message.ShowModal()
+#        message.Destroy()
+#
+#    def OnStat(self) :
+#        nbtocat, totocat, nbcate, totcate, lenwordincate = self.cate.makestat()
+#        totwords = totocat + totcate
+#        prtocat = repr(round((nbtocat/self.cate.lenwords) * 100 ,2))
+#        prtotocat = repr(round((totocat/totwords) * 100, 2))
+#        prcate = repr(round((totcate/totwords)*100, 2))
+#        prwordincate = repr(round((lenwordincate/self.cate.lenwords)*100, 2))
+#        self.stattxt.SetLabel(self.stat.format(nbtocat, prtocat, totocat, prtotocat, nbcate, lenwordincate, prwordincate, totcate, prcate))
+#
+#    def OnAddToTable(self) :
+#        wordscate = self.cate.getwordscate()
+#        newtab = [['category%i' % i for i in range(1, len(self.tableau.selected_col)+1)]]
+#        for line in self.tableau.select_col(self.tableau.selected_col):
+#            newline = []
+#            for word in line :
+#                newline.append(wordscate.get(word,word))
+#            newtab.append(newline)
+#
+#    def OnAddCate(self, evt) :
+#        print('add a category')
+#        print(self.m_listCate.GetItemCount())
+#        self.cate.addcatefromscratch()
+#        self.m_listCate.dlist = self.cate.getcate()
+#        self.m_listCate.RefreshData(self.m_listCate.dlist)
+#        self.m_listCate.SetSelection(self.m_listCate.GetItemCount() - 1)
+
+
+
+class ListPanel(wx.Panel) :
+     def __init__(self, parent, gparent, List):
+        wx.Panel.__init__(self, parent, style=wx.BORDER_SUNKEN)
+        self.parent = parent
+        self.gparent = gparent
+        self.cate = gparent.cate
+        gsizer =  wx.BoxSizer( wx.HORIZONTAL )
+        self.list = List(self, dlist = gparent.cate, first = ['eff'])
+        gsizer.Add(self.list, 5, wx.EXPAND, 5 )
+        self.SetSizer( gsizer )
+        self.Layout()
+
+
+     def OnStat(self) :
+        self.gparent.OnStat()
+
 class ElCategorizator ( wx.Panel ):
 
     def __init__( self, parent, pathout, tableau, id = wx.ID_ANY, pos = wx.DefaultPosition, size = wx.Size( 500,300 ), style = wx.TAB_TRAVERSAL, name = wx.EmptyString ):
 class ElCategorizator ( wx.Panel ):
 
     def __init__( self, parent, pathout, tableau, id = wx.ID_ANY, pos = wx.DefaultPosition, size = wx.Size( 500,300 ), style = wx.TAB_TRAVERSAL, name = wx.EmptyString ):
@@ -168,15 +343,28 @@ class ElCategorizator ( wx.Panel ):
         gsizer =  wx.BoxSizer( wx.VERTICAL )
 
         bSizer1 = wx.BoxSizer( wx.HORIZONTAL )
         gsizer =  wx.BoxSizer( wx.VERTICAL )
 
         bSizer1 = wx.BoxSizer( wx.HORIZONTAL )
+        splitter = MultiSplitterWindow(self, style=wx.SP_LIVE_UPDATE)
+        self.splitter = splitter
+        #sizer = wx.BoxSizer(wx.HORIZONTAL)
+        #sizer.Add(splitter, 1, wx.EXPAND)
+        #self.SetSizer(sizer)
+        W,H = wx.GetTopLevelParent(self).GetSize()
+        print(W)
+        W = W - 200
+        if W < 300 :
+            W = 300
+        splitsize = int(W/3)
+
+        panelwords = ListPanel(splitter, self, ListForWords)
+        splitter.AppendWindow(panelwords, splitsize)
+        panelcate = ListPanel(splitter, self, ListForCate)
+        splitter.AppendWindow(panelcate, splitsize)
+        panelwordscate = ListPanel(splitter, self, ListForCateWords)
+        splitter.AppendWindow(panelwordscate, splitsize)
+        self.m_listToCate = panelwords.list
+        self.m_listCate = panelcate.list
+        self.m_listCateWords = panelwordscate.list
 
 
-        self.m_listToCate = ListForWords(self, dlist = self.cate, first = ['eff'])
-        bSizer1.Add( self.m_listToCate, 2, wx.ALL|wx.EXPAND, 5 )
-
-        self.m_listCate = ListForCate(self, dlist = self.cate, first = ['eff'])
-        bSizer1.Add( self.m_listCate, 1, wx.ALL|wx.EXPAND, 5 )
-
-        self.m_listCateWords = ListForCateWords(self, dlist = self.cate, first = ['eff'])
-        bSizer1.Add( self.m_listCateWords, 1, wx.ALL|wx.EXPAND, 5 )
 
         bSizer2 = wx.BoxSizer( wx.HORIZONTAL )
 
 
         bSizer2 = wx.BoxSizer( wx.HORIZONTAL )
 
@@ -201,6 +389,12 @@ class ElCategorizator ( wx.Panel ):
         self.nbword = """Words : {:d} ({:d}) | """
 
         self.stat = """ Words to categorize : {:d} ({}%) - {:d} ({}%) -- Categories : {:d} - {:d} ({}%) - {:d} ({}%)"""
         self.nbword = """Words : {:d} ({:d}) | """
 
         self.stat = """ Words to categorize : {:d} ({}%) - {:d} ({}%) -- Categories : {:d} - {:d} ({}%) - {:d} ({}%)"""
+        for panel in [panelwords, panelcate, panelwordscate] :
+            panel.m_listToCate = self.m_listToCate
+            panel.m_listCate = self.m_listCate
+            panel.m_listCateWords = self.m_listCateWords
+            panel.butsave = self.butsave
+
 #        nbtocat, totocat, nbcate, totcate = self.cate.makestat()
 #        lenwords = self.cate.lenwords
 #        totwords = totocat + totcate
 #        nbtocat, totocat, nbcate, totcate = self.cate.makestat()
 #        lenwords = self.cate.lenwords
 #        totwords = totocat + totcate
@@ -214,7 +408,7 @@ class ElCategorizator ( wx.Panel ):
 
 
         gsizer.Add( bSizer2, 0, wx.EXPAND, 5 )
 
 
         gsizer.Add( bSizer2, 0, wx.EXPAND, 5 )
-        gsizer.Add( bSizer1, 2, wx.EXPAND, 5 )
+        gsizer.Add( splitter, 2, wx.EXPAND, 5 )
         gsizer.Add( bSizer3, 0, wx.EXPAND, 5 )
 
         self.butsave.Bind(wx.EVT_BUTTON, self.OnSave)
         gsizer.Add( bSizer3, 0, wx.EXPAND, 5 )
 
         self.butsave.Bind(wx.EVT_BUTTON, self.OnSave)
@@ -227,10 +421,11 @@ class ElCategorizator ( wx.Panel ):
         self.SetSizer( gsizer )
         self.Layout()
 
         self.SetSizer( gsizer )
         self.Layout()
 
+
+
     def __del__( self ):
         pass
 
     def __del__( self ):
         pass
 
-
     def OnLoad(self, event) :
         if len(self.cate.cate['CATE']) != 0 :
             message = wx.MessageDialog(self, _("Categories must be empty to load a categorization."), _("Information"), wx.OK|wx.ICON_WARNING)
     def OnLoad(self, event) :
         if len(self.cate.cate['CATE']) != 0 :
             message = wx.MessageDialog(self, _("Categories must be empty to load a categorization."), _("Information"), wx.OK|wx.ICON_WARNING)
@@ -296,6 +491,7 @@ class ElCategorizator ( wx.Panel ):
         prwordincate = repr(round((lenwordincate/self.cate.lenwords)*100, 2))
         self.stattxt.SetLabel(self.stat.format(nbtocat, prtocat, totocat, prtotocat, nbcate, lenwordincate, prwordincate, totcate, prcate))
 
         prwordincate = repr(round((lenwordincate/self.cate.lenwords)*100, 2))
         self.stattxt.SetLabel(self.stat.format(nbtocat, prtocat, totocat, prtotocat, nbcate, lenwordincate, prwordincate, totcate, prcate))
 
+
     def OnAddToTable(self) :
         wordscate = self.cate.getwordscate()
         newtab = [['category%i' % i for i in range(1, len(self.tableau.selected_col)+1)]]
     def OnAddToTable(self) :
         wordscate = self.cate.getwordscate()
         newtab = [['category%i' % i for i in range(1, len(self.tableau.selected_col)+1)]]
@@ -314,71 +510,6 @@ class ElCategorizator ( wx.Panel ):
         self.m_listCate.SetSelection(self.m_listCate.GetItemCount() - 1)
 
 
         self.m_listCate.SetSelection(self.m_listCate.GetItemCount() - 1)
 
 
-
-#class ListPanel(wx.Panel) :
-#     def __init__(self, parent, gparent, List):
-#        wx.Panel.__init__(self, parent, style=wx.BORDER_SUNKEN)
-#        self.parent = parent
-#        self.cate = gparent.cate
-#        self.list = List(self, dlist = gparent.cate, first = ['eff'])
-
-
-#class ElCategorizator ( wx.Panel ):
-#
-#    def __init__( self, parent, pathout, tableau, id = wx.ID_ANY, pos = wx.DefaultPosition, size = wx.Size( 500,300 ), style = wx.TAB_TRAVERSAL, name = wx.EmptyString ):
-#        wx.Panel.__init__ ( self, parent, id = id, pos = pos, size = size, style = style, name = name )
-#        self.pathout = pathout
-#        self.parent = parent
-#        self.tableau = tableau
-#
-#        self.cate = CategoDict(self.pathout)
-#
-#        splitter = MultiSplitterWindow(self, style=wx.SP_LIVE_UPDATE)
-#        self.splitter = splitter
-#        sizer = wx.BoxSizer(wx.HORIZONTAL)
-#        sizer.Add(splitter, 1, wx.EXPAND)
-#        self.SetSizer(sizer)
-#
-#        panelwords = ListPanel(splitter, self, ListForWords)
-#        splitter.AppendWindow(panelwords, 150)
-#        panelcate = ListPanel(splitter, self, ListForCate)
-#        splitter.AppendWindow(panelcate, 150)
-#        panelwordscate = ListPanel(splitter, self, ListForCateWords)
-#        splitter.AppendWindow(panelwordscate, 150)
-#        self.m_listToCate = panelwords.list
-#        self.m_listCate = panelcate.list
-#        self.m_listCateWords = panelwordscate.list
-#
-#    def __del__( self ):
-#        pass
-#
-#    def OnSave(self, event) :
-#        self.cate.save()
-#        self.butsave.SetBackgroundColour((14, 242, 14, 255))
-#
-#    def OnCSV(self, event) :
-#        wordscate = self.cate.getwordscate()
-#        newtab = [['category%i' % i for i in range(1, len(self.tableau.selected_col)+1)]]
-#        for line in self.tableau.select_col(self.tableau.selected_col):
-#            newline = []
-#            for word in line :
-#                newline.append(wordscate.get(word,word))
-#            newtab.append(newline)
-#        with open(self.pathout['tableout.csv'], 'w') as f :
-#            f.write('\n'.join(['\t'.join(line) for line in newtab]))
-#        print("csv exported !")
-#
-#    def OnDict(self, event):
-#        with open(self.pathout['dictionnary.txt'], 'w') as f :
-#            for categorie in self.cate.cate['CATE'] :
-#                f.write(categorie + ': \t' + repr(self.cate.cate['CATE'][categorie][0]) + '\n')
-#                for word in self.cate.cate['CATE'][categorie][1] :
-#                    f.write('\t' + word + ': \t' + repr(self.cate.cate['CATE'][categorie][1][word]) + '\n')
-#            for word in self.cate.cate['TOCATE'] :
-#                f.write(word + ':\t' + repr(self.cate.cate['TOCATE'][word]) + '\n')
-#        print("dictionnary exported !")
-
-
 class ListForCate(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.ColumnSorterMixin):
 
     def __init__(self, parent, dlist = {}, first = [], usefirst = False, menu = True):
 class ListForCate(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.ColumnSorterMixin):
 
     def __init__(self, parent, dlist = {}, first = [], usefirst = False, menu = True):
index 3472b77..add77d8 100755 (executable)
@@ -50,7 +50,7 @@ def open_folder(folder):
     else:
         opener ="open" if sys.platform == "darwin" else "xdg-open"
         #call([opener, folder])
     else:
         opener ="open" if sys.platform == "darwin" else "xdg-open"
         #call([opener, folder])
-        call(["%s %s &" % (opener, folder)], shell=True)
+        call(["%s '%s' &" % (opener, folder)], shell=True)
 
 def normpath_win32(path) :
     if not sys.platform == 'win32' :
 
 def normpath_win32(path) :
     if not sys.platform == 'win32' :
@@ -860,7 +860,7 @@ def treat_var_mod(variables) :
 #                     var_mod[var].append(variable)
     return var_mod
 
 #                     var_mod[var].append(variable)
     return var_mod
 
-def doconcorde(corpus, uces, mots, uci = False) :
+def doconcorde(corpus, uces, mots, uci = False, fontsize=16) :
     if not uci :
         ucestxt1 = [row for row in corpus.getconcorde(uces)]
     else :
     if not uci :
         ucestxt1 = [row for row in corpus.getconcorde(uces)]
     else :
@@ -872,15 +872,17 @@ def doconcorde(corpus, uces, mots, uci = False) :
     listmot = [corpus.getforme(fid).forme for lem in listmot for fid in lem]
     mothtml = ['<font color=red><b>%s</b></font>' % mot for mot in listmot]
     dmots = dict(list(zip(listmot, mothtml)))
     listmot = [corpus.getforme(fid).forme for lem in listmot for fid in lem]
     mothtml = ['<font color=red><b>%s</b></font>' % mot for mot in listmot]
     dmots = dict(list(zip(listmot, mothtml)))
+    presfont = '<p><b><font size="%i">' % fontsize
+    font = '<font size="%i">' % fontsize
     for uce in uces :
         ucetxt = ucestxt1[uce].split()
         ucetxt = ' '.join([dmots.get(mot, mot) for mot in ucetxt])
         if not uci :
             uciid = corpus.getucefromid(uce).uci
     for uce in uces :
         ucetxt = ucestxt1[uce].split()
         ucetxt = ' '.join([dmots.get(mot, mot) for mot in ucetxt])
         if not uci :
             uciid = corpus.getucefromid(uce).uci
-            ucis_txt.append('<p><b>' + ' '.join(corpus.ucis[corpus.getucefromid(uce).uci].etoiles) + '<a href="%i_%i"> *%i_%i</a></b></p>' % (uciid, uce, uciid, uce))
+            ucis_txt.append(presfont + ' '.join(corpus.ucis[corpus.getucefromid(uce).uci].etoiles) + '<a href="%i_%i"> *%i_%i</a></font></b></p>' % (uciid, uce, uciid, uce))
         else :
         else :
-            ucis_txt.append('<p><b>' + ' '.join(corpus.ucis[uce].etoiles) + '</b></p>')
-        ucestxt.append(ucetxt)
+            ucis_txt.append(presfont + ' '.join(corpus.ucis[uce].etoiles) + '</font></b></p>')
+        ucestxt.append(font + ucetxt + '</font>')
     return ucis_txt, ucestxt
 
 
     return ucis_txt, ucestxt
 
 
index 042ee0e..79b15e5 100755 (executable)
@@ -240,8 +240,7 @@ class IraFrame(wx.Frame):
         log.info('version : %s' % ConfigGlob.get('DEFAULT', 'version'))
         print(size)
         wx.Frame.__init__(self, parent, id, title, pos, size, style)
         log.info('version : %s' % ConfigGlob.get('DEFAULT', 'version'))
         print(size)
         wx.Frame.__init__(self, parent, id, title, pos, size, style)
-        #Font
-        self.SetFont(wx.Font(12, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL))
+
         # configuration
         self.AppliPath = AppliPath
         self.images_path = os.path.join(AppliPath,'images')
         # configuration
         self.AppliPath = AppliPath
         self.images_path = os.path.join(AppliPath,'images')
@@ -260,6 +259,15 @@ class IraFrame(wx.Frame):
         self._mgr = aui.AuiManager()
         self._mgr.SetManagedWindow(self)
         self.x = 0
         self._mgr = aui.AuiManager()
         self._mgr.SetManagedWindow(self)
         self.x = 0
+        #Font
+        try :
+            self.pref.read(self.ConfigPath['preferences'])
+            self.fontsize = self.pref.getint('iramuteq','fontsize')
+        except :
+            print('no pref : setting fontsize to 12')
+            self.fontsize = 12
+        self.SetFont(wx.Font(self.fontsize, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL))
+
         #--------------------------------------------------------------------------------
         # creation menu
         #--------------------------------------------------------------------------------
         #--------------------------------------------------------------------------------
         # creation menu
         #--------------------------------------------------------------------------------
@@ -511,7 +519,8 @@ class IraFrame(wx.Frame):
             Name("lefttree").
             Caption(_("Historic")).
             Left().
             Name("lefttree").
             Caption(_("Historic")).
             Left().
-            MinSize(wx.Size(300,400)).
+            MinSize(wx.Size(200,400)).
+            BestSize(wx.Size(300,-1)).
             Layer(1).
             Position(1).
             CloseButton(False).
             Layer(1).
             Position(1).
             CloseButton(False).
@@ -528,6 +537,7 @@ class IraFrame(wx.Frame):
         # | aui.AUI_NB_TAB_EXTERNAL_MOVE | aui.AUI_NB_TAB_MOVE | aui.AUI_NB_TAB_FLOAT| wx.NO_BORDER
         self.nb.SetAGWWindowStyleFlag(notebook_flags)
         self.nb.SetArtProvider(aui.ChromeTabArt())
         # | aui.AUI_NB_TAB_EXTERNAL_MOVE | aui.AUI_NB_TAB_MOVE | aui.AUI_NB_TAB_FLOAT| wx.NO_BORDER
         self.nb.SetAGWWindowStyleFlag(notebook_flags)
         self.nb.SetArtProvider(aui.ChromeTabArt())
+        self.nb.SetFont(wx.Font(self.fontsize, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL))
         #self.nb.SetArtProvider(aui.VC8TabArt())
         #self.nb.parent = self
         #self._notebook_style = aui.AUI_NB_DEFAULT_STYLE | aui.AUI_NB_TAB_EXTERNAL_MOVE | wx.NO_BORDER
         #self.nb.SetArtProvider(aui.VC8TabArt())
         #self.nb.parent = self
         #self._notebook_style = aui.AUI_NB_DEFAULT_STYLE | aui.AUI_NB_TAB_EXTERNAL_MOVE | wx.NO_BORDER
@@ -539,6 +549,7 @@ class IraFrame(wx.Frame):
             aui.AuiPaneInfo().
             Name("Tab_content").
             CenterPane())
             aui.AuiPaneInfo().
             Name("Tab_content").
             CenterPane())
+
         #self._mgr.AddPane(self.Sheet, wx.aui.AuiPaneInfo().Name("Data").CenterPane())
         #self._mgr.AddPane(self.Sheet, aui.AuiPaneInfo().Name("Data").CenterPane())
         self.nb.Bind(aui.EVT_AUINOTEBOOK_PAGE_CLOSE, self.OnCloseTab)
         #self._mgr.AddPane(self.Sheet, wx.aui.AuiPaneInfo().Name("Data").CenterPane())
         #self._mgr.AddPane(self.Sheet, aui.AuiPaneInfo().Name("Data").CenterPane())
         self.nb.Bind(aui.EVT_AUINOTEBOOK_PAGE_CLOSE, self.OnCloseTab)
@@ -684,6 +695,7 @@ class IraFrame(wx.Frame):
         self.Text = ''
         self.lexique = None
         self.corpus = None
         self.Text = ''
         self.lexique = None
         self.corpus = None
+        
 
     def finish_init(self) :
         try :
 
     def finish_init(self) :
         try :
index 302cbed..67411fc 100644 (file)
--- a/layout.py
+++ b/layout.py
@@ -46,6 +46,7 @@ from webexport import WebExport
 from corpus import Corpus
 from sheet import MySheet
 from graph_to_json import GraphToJson
 from corpus import Corpus
 from sheet import MySheet
 from graph_to_json import GraphToJson
+#from listlex2 import LexPanel
 
 
 import langue
 
 
 import langue
@@ -459,9 +460,12 @@ class OpenCHDS():
     #    self.TabChdSim = wx.aui.AuiNotebook(self.parent.nb, -1, wx.DefaultPosition)
         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
         panel.TabChdSim = aui.AuiNotebook(panel, -1, wx.DefaultPosition)
     #    self.TabChdSim = wx.aui.AuiNotebook(self.parent.nb, -1, wx.DefaultPosition)
         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
         panel.TabChdSim = aui.AuiNotebook(panel, -1, wx.DefaultPosition)
-        #panel.TabChdSim = LB.LabelBook(panel, -1, agwStyle = INB_TOP|INB_SHOW_ONLY_TEXT|INB_FIT_LABELTEXT)
+
+       #panel.TabChdSim = LB.LabelBook(panel, -1, agwStyle = INB_TOP|INB_SHOW_ONLY_TEXT|INB_FIT_LABELTEXT)
         panel.TabChdSim.SetAGWWindowStyleFlag(notebook_flags)
         panel.TabChdSim.SetArtProvider(aui.ChromeTabArt())
         panel.TabChdSim.SetAGWWindowStyleFlag(notebook_flags)
         panel.TabChdSim.SetArtProvider(aui.ChromeTabArt())
+        font = wx.Font(self.parent.fontsize, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL)
+        panel.TabChdSim.SetFont(font)
         sizer1.Add(panel.TabChdSim,10, wx.EXPAND, 5)
         panel.SetSizer(sizer1)
         sizer1.Fit(panel)
         sizer1.Add(panel.TabChdSim,10, wx.EXPAND, 5)
         panel.SetSizer(sizer1)
         sizer1.Fit(panel)
@@ -507,6 +511,7 @@ class OpenCHDS():
                 self.tab_prof_seg = ProfListctrlPanel(self.parent, self, prof_seg[str(i + 1)], False, i + 1)
                 self.prof_seg_nb.AddPage(self.tab_prof_seg, _("Cluster") + ' %i' % (i + 1))
         panel.ProfNB.SetSelection(0)
                 self.tab_prof_seg = ProfListctrlPanel(self.parent, self, prof_seg[str(i + 1)], False, i + 1)
                 self.prof_seg_nb.AddPage(self.tab_prof_seg, _("Cluster") + ' %i' % (i + 1))
         panel.ProfNB.SetSelection(0)
+        panel.ProfNB.SetFont(font)
         if clnb > 2 :
             self.TabAFC = aui.AuiNotebook(panel.TabChdSim, -1, wx.DefaultPosition)
             log.info('read AFC')
         if clnb > 2 :
             self.TabAFC = aui.AuiNotebook(panel.TabChdSim, -1, wx.DefaultPosition)
             log.info('read AFC')
@@ -751,15 +756,22 @@ class dolexlayout :
         #sash = SashList(ira.nb)
         self.TabStat = aui.AuiNotebook(ira.nb, -1, wx.DefaultPosition)
         self.TabStat.parametres = parametres
         #sash = SashList(ira.nb)
         self.TabStat = aui.AuiNotebook(ira.nb, -1, wx.DefaultPosition)
         self.TabStat.parametres = parametres
+        #self.ListPan = LexPanel(self, ira, self.DictSpec, self.etoiles)
         self.ListPan = ListForSpec(ira, self, self.DictSpec, self.etoiles)
         self.ListPan = ListForSpec(ira, self, self.DictSpec, self.etoiles)
+        self.ListPan.pathout = self.pathout
         if os.path.exists(self.pathout['banalites.csv']) :
             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)
         if os.path.exists(self.pathout['banalites.csv']) :
             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.ListPant.pathout = self.pathout
         self.ListPanEff = ListForSpec(ira, self, self.DictEff, self.etoiles)
         self.ListPanEff = ListForSpec(ira, self, self.DictEff, self.etoiles)
+        self.ListPanEff.pathout = self.pathout
         self.ListPanEffType = ListForSpec(ira, self, self.DictEffType, self.etoiles)
         self.ListPanEffType = ListForSpec(ira, self, self.DictEffType, self.etoiles)
+        self.ListPanEffType.pathout = self.pathout
         self.ListPanEffRelForme = ListForSpec(ira, self, self.DictEffRelForme, self.etoiles)
         self.ListPanEffRelForme = ListForSpec(ira, self, self.DictEffRelForme, self.etoiles)
+        self.ListPanEffRelForme.pathout = self.pathout
         self.ListPanEffRelType = ListForSpec(ira, self, self.DictEffRelType, self.etoiles)
         self.ListPanEffRelType = ListForSpec(ira, self, self.DictEffRelType, self.etoiles)
+        self.ListPanEffRelType.pathout = self.pathout
         self.TabStat.AddPage(self.ListPan, _('Forms'))
         if os.path.exists(self.pathout['banalites.csv']) :
             self.TabStat.AddPage(self.listban, _('Banal forms'))
         self.TabStat.AddPage(self.ListPan, _('Forms'))
         if os.path.exists(self.pathout['banalites.csv']) :
             self.TabStat.AddPage(self.listban, _('Banal forms'))
@@ -781,6 +793,7 @@ class dolexlayout :
         self.ira = ira
         self.TabStat.corpus = self.corpus
         self.TabStat.etoiles = self.etoiles
         self.ira = ira
         self.TabStat.corpus = self.corpus
         self.TabStat.etoiles = self.etoiles
+        self.TabStat.pathout = self.pathout
         if os.path.exists(os.path.join(self.parametres['pathout'], 'tgenspec.csv')) :
             self.parametres['tgenspec'] = os.path.join(self.parametres['pathout'], 'tgenspec.csv')
             TgenLayout(self.TabStat)
         if os.path.exists(os.path.join(self.parametres['pathout'], 'tgenspec.csv')) :
             self.parametres['tgenspec'] = os.path.join(self.parametres['pathout'], 'tgenspec.csv')
             TgenLayout(self.TabStat)
@@ -1361,7 +1374,8 @@ class FreqLayout(DefaultMatLayout) :
         self.tab = wx.html.HtmlWindow(self.ira.nb, -1)
         #self.tab = wx.html2.WebView.New(self)
         res = normpath_win32(self.pathout['resultats.html']).replace('\\','/')
         self.tab = wx.html.HtmlWindow(self.ira.nb, -1)
         #self.tab = wx.html2.WebView.New(self)
         res = normpath_win32(self.pathout['resultats.html']).replace('\\','/')
-        self.tab.LoadPage(res)
+        #self.tab.LoadPage(res)
+        self.tab.LoadFile(res)
         #self.tab.LoadURL(res)
         self.tab.parametres = self.parametres
         self.ira.nb.AddPage(self.tab, ' - '.join([_("Frequency"), self.parametres['name']]))
         #self.tab.LoadURL(res)
         self.tab.parametres = self.parametres
         self.ira.nb.AddPage(self.tab, ' - '.join([_("Frequency"), self.parametres['name']]))
@@ -1374,7 +1388,7 @@ class Chi2Layout(DefaultMatLayout) :
         if "gtk2" in wx.PlatformInfo:
             self.tab.SetStandardFonts()
         res = normpath_win32(self.pathout['resultats-chi2.html']).replace('\\','/')
         if "gtk2" in wx.PlatformInfo:
             self.tab.SetStandardFonts()
         res = normpath_win32(self.pathout['resultats-chi2.html']).replace('\\','/')
-        self.tab.LoadPage(res)
+        self.tab.LoadFile(res)
         self.tab.parametres = self.parametres
         self.ira.nb.AddPage(self.tab, ' - '.join(["Chi2", self.parametres['name']]))
         #self.ira.nb.SetSelection(self.ira.nb.GetPageCount() - 1)
         self.tab.parametres = self.parametres
         self.ira.nb.AddPage(self.tab, ' - '.join(["Chi2", self.parametres['name']]))
         #self.ira.nb.SetSelection(self.ira.nb.GetPageCount() - 1)
@@ -1403,6 +1417,7 @@ class CateLayout(DefaultMatLayout) :
     def dolayout(self) :
         self.tableau.read_tableau(self.pathout['analyse.db'])
         TabCate = ElCategorizator(self.ira.nb, self.pathout, self.tableau)
     def dolayout(self) :
         self.tableau.read_tableau(self.pathout['analyse.db'])
         TabCate = ElCategorizator(self.ira.nb, self.pathout, self.tableau)
+        TabCate.parametres = self.parametres
         self.ira.nb.AddPage(TabCate, ' - '.join([_('ElCaTeGoRiZaToR'), self.parametres['name']]))
 
 class SimiMatLayout(DefaultMatLayout) :
         self.ira.nb.AddPage(TabCate, ' - '.join([_('ElCaTeGoRiZaToR'), self.parametres['name']]))
 
 class SimiMatLayout(DefaultMatLayout) :
index 873f4b3..2c025f3 100644 (file)
@@ -183,4 +183,4 @@ class OpenAnalyse():
             Chi2Layout(self.parent, corpus, self.conf)
         elif self.conf['type'] == 'categorisation' :
             CateLayout(self.parent, corpus, self.conf)
             Chi2Layout(self.parent, corpus, self.conf)
         elif self.conf['type'] == 'categorisation' :
             CateLayout(self.parent, corpus, self.conf)
-            print(self.conf)
+            #print(self.conf)
index 24bcce7..55c2efd 100644 (file)
@@ -100,7 +100,7 @@ class Prototypical(AnalyseMatrix) :
                         else :
                             words[word] = [1, []]
         res = [[word, words[word][0], float(sum(words[word][1])) / len(words[word][1])] for word in words if len(words[word][1]) != 0 and words[word][0] >= self.parametres['freqmin']]
                         else :
                             words[word] = [1, []]
         res = [[word, words[word][0], float(sum(words[word][1])) / len(words[word][1])] for word in words if len(words[word][1]) != 0 and words[word][0] >= self.parametres['freqmin']]
-        with open(self.pathout['table.csv'], 'w') as f :
+        with open(self.pathout['table.csv'], 'w', encoding='utf8') as f :
             f.write('\n'.join(['\t'.join(['"' + val[0] +'"', repr(val[1]), repr(val[2])]) for val in res]))
         #self.parent.tableau.parametres = self.parent.tableau.parametre
         #self.parent.tableau.save_tableau(self.pathout['analyse.db'])
             f.write('\n'.join(['\t'.join(['"' + val[0] +'"', repr(val[1]), repr(val[2])]) for val in res]))
         #self.parent.tableau.parametres = self.parent.tableau.parametre
         #self.parent.tableau.save_tableau(self.pathout['analyse.db'])
diff --git a/tree.py b/tree.py
index 6551973..67df4c3 100755 (executable)
--- a/tree.py
+++ b/tree.py
@@ -123,11 +123,7 @@ class LeftTree(CT.CustomTreeCtrl):
                  style=wx.SUNKEN_BORDER|wx.WANTS_CHARS,
                  agwStyle=CT.TR_HIDE_ROOT|CT.TR_HAS_BUTTONS|CT.TR_HAS_VARIABLE_ROW_HEIGHT):
         CT.CustomTreeCtrl.__init__(self, parent, id, pos, size, style, agwStyle)
                  style=wx.SUNKEN_BORDER|wx.WANTS_CHARS,
                  agwStyle=CT.TR_HIDE_ROOT|CT.TR_HAS_BUTTONS|CT.TR_HAS_VARIABLE_ROW_HEIGHT):
         CT.CustomTreeCtrl.__init__(self, parent, id, pos, size, style, agwStyle)
-        #FIXME : test for bigger font on HIDPI screen
-        #font = wx.Font(12, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD,
-        #       False, "", wx.FONTENCODING_DEFAULT)
-        font = wx.Font(pointSize=10, family=wx.FONTFAMILY_DEFAULT, style=wx.FONTSTYLE_NORMAL, weight=wx.FONTWEIGHT_NORMAL)
-        self.SetFont(font)
+
         ##################
         self.log = log
         alldata = dir(CT)
         ##################
         self.log = log
         alldata = dir(CT)
@@ -140,6 +136,8 @@ class LeftTree(CT.CustomTreeCtrl):
                 events.append(data)
         self.parent = parent
         self.ira = parent
                 events.append(data)
         self.parent = parent
         self.ira = parent
+        font = wx.Font(pointSize=self.ira.fontsize + 2, family=wx.FONTFAMILY_DEFAULT, style=wx.FONTSTYLE_NORMAL, weight=wx.FONTWEIGHT_NORMAL)
+        self.SetFont(font)
         self.events = events
         self.styles = treestyles
         self.item = None
         self.events = events
         self.styles = treestyles
         self.item = None
@@ -1109,10 +1107,9 @@ class LeftTree(CT.CustomTreeCtrl):
             if 'uuid' in pydata :
                 if pydata['uuid'] in ['textroot', 'matroot'] :
                     self.ira.ShowMenu('text', False)
             if 'uuid' in pydata :
                 if pydata['uuid'] in ['textroot', 'matroot'] :
                     self.ira.ShowMenu('text', False)
-                    self.ira.ShowMenu('matrix', False)             
+                    self.ira.ShowMenu('matrix', False)
             self.pydata = pydata
             if pydata['uuid'] in self.parent.history.opened :
             self.pydata = pydata
             if pydata['uuid'] in self.parent.history.opened :
-                actual = self.parent.nb.GetSelection()
                 for i in range(self.parent.nb.GetPageCount()) :
                     self.page = self.parent.nb.GetPage(i)
                     if 'parametres' in dir(self.page) :
                 for i in range(self.parent.nb.GetPageCount()) :
                     self.page = self.parent.nb.GetPage(i)
                     if 'parametres' in dir(self.page) :