...
[iramuteq] / profile_segment.py
index d3b3f46..1eeee9c 100644 (file)
@@ -6,16 +6,23 @@
 
 import tempfile
 from ProfList import *
-import agw.aui as aui
+import wx
+if wx.__version__ >= '2.11' :
+#import agw.aui as aui
+    import wx.lib.agw.aui as aui
+else :
+    import aui
 from functions import exec_rcode, check_Rresult, ReadProfileAsDico, ReadList
 from listlex import *
 from dialog import PrefSegProf, PrefProfTypes
 from time import sleep
 
 class ProfileSegment() :
-    def __init__(self, parent, corpus) :
+    def __init__(self, parent, pathout, parametres, corpus) :
         self.parent = parent
         self.corpus = corpus
+        self.dictpathout = pathout
+        self.parametres = parametres
         dial = PrefSegProf(self.parent)
         dial.CenterOnParent()
         if dial.ShowModal() == wx.ID_OK :
@@ -37,19 +44,19 @@ class ProfileSegment() :
            self.dlg.Destroy()
     
     def make_table(self) :
-        self.corpus.make_segments_profile(self.corpus.dictpathout['segments_classes'], lenmin = self.mini, lenmax = self.maxi, effmin = self.eff, lem = self.lem)
+        self.corpus.make_segments_profile(self.dictpathout['segments_classes'], lenmin = self.mini, lenmax = self.maxi, effmin = self.eff, lem = self.lem)
 
     def make_prof(self) :
         txt = """
         load("%s")
         source("%s")
-        """ % (self.corpus.dictpathout['RData'], self.parent.RscriptsPath['chdfunct'])
+        """ % (self.dictpathout['RData'], self.parent.RscriptsPath['chdfunct'])
 
         txt += """
         dt <- read.csv2("%s", row.names = 1)
         to <- build.pond.prof(dt)
         PrintProfile(n1,to[4],NULL,to[5],NULL,clnb,"%s","%s")
-        """ % (self.corpus.dictpathout['segments_classes'], self.corpus.dictpathout['prof_seg'], self.corpus.dictpathout['antiprof_seg'])
+        """ % (self.corpus.dictpathout['segments_classes'], self.dictpathout['prof_seg'], self.dictpathout['antiprof_seg'])
         fo = tempfile.mktemp(dir=self.parent.TEMPDIR)
         with open(fo, 'w') as f :
             f.write(txt)
@@ -62,8 +69,7 @@ class ProfileSegment() :
     def do_layout(self) :
         SelectTab = self.parent.nb.GetSelection()
         page = self.parent.nb.GetPage(SelectTab).TabChdSim
-        print page
-        prof_seg = ReadProfileAsDico(self, self.corpus.dictpathout['prof_seg'], True, self.corpus.parametre['syscoding'])
+        prof_seg = ReadProfileAsDico(self.dictpathout['prof_seg'], True, self.parent.syscoding)
         prof_seg_nb = aui.AuiNotebook(self.parent, -1, wx.DefaultPosition)
         for i in range(0,len(self.corpus.lc)) :
             ntab = ProfListctrlPanel(self.parent, self, prof_seg[str(i + 1)], False, i + 1)
@@ -72,9 +78,10 @@ class ProfileSegment() :
         page.SetSelection(page.GetPageCount() - 1)
 
 class ProfilType() :
-    def __init__(self, parent, corpus) :
+    def __init__(self, parent, corpus, parametres) :
         self.parent = parent
         self.corpus = corpus
+        self.parametres = parametres
         self.outprof = self.corpus.dictpathout['prof_type']
         dial = PrefProfTypes(self.parent)
         dial.fbb.SetValue(self.outprof)
@@ -85,10 +92,10 @@ class ProfilType() :
                 alceste = True
             else :
                 alceste = False
-            if 'outprof' in self.corpus.parametre :
-                self.corpus.parametre['outprof'][self.outprof] = alceste
-            else :
-                self.corpus.parametre['outprof'] = {self.outprof: alceste}
+            #if 'outprof' in self.corpus.parametre :
+            #    self.corpus.parametre['outprof'][self.outprof] = alceste
+            #else :
+            #    self.corpus.parametre['outprof'] = {self.outprof: alceste}
             self.dlg = progressbar(self, maxi = 4)
             self.dlg.Update(1, u'Recherche des types')
             self.make_table()
@@ -100,7 +107,7 @@ class ProfilType() :
             self.dlg.Destroy()
     
     def make_table(self) :
-        self.corpus.prof_type()
+        self.corpus.make_proftype(self.corpus.dictpathout['type_cl'])
 
     def make_prof(self, alceste = True) :
         txt = """
@@ -137,7 +144,7 @@ class ProfilType() :
         page = self.parent.nb.GetPage(SelectTab).TabChdSim
         prof_seg_nb = aui.AuiNotebook(self.parent, -1, wx.DefaultPosition)
         if alceste :
-            prof_seg = ReadProfileAsDico(self, self.outprof, True)
+            prof_seg = ReadProfileAsDico(self.outprof, True)
             for i in range(0,len(self.corpus.lc)) :
                 ntab = ProfListctrlPanel(self.parent, self, prof_seg[str(i + 1)], False, i + 1)
                 prof_seg_nb.AddPage(ntab, 'classe %i' % (i + 1))