svg for afc
[iramuteq] / tabsimi.py
index faf8631..2af9792 100644 (file)
@@ -6,7 +6,8 @@
 
 from chemins import ConstructPathOut, construct_simipath, ffr
 from functions import print_liste, exec_rcode, read_list_file, check_Rresult, indices_simi, treat_var_mod
 
 from chemins import ConstructPathOut, construct_simipath, ffr
 from functions import print_liste, exec_rcode, read_list_file, check_Rresult, indices_simi, treat_var_mod
-from dialog import PrefSimi, SelectColDial, OptLexi
+from dialog import SelectColDial, OptLexi
+from guifunct import PrefSimi
 from listlex import *
 import wx
 import wx.lib.agw.aui as aui
 from listlex import *
 import wx
 import wx.lib.agw.aui as aui
@@ -16,6 +17,8 @@ import tempfile
 import datetime
 from ConfigParser import RawConfigParser
 from time import sleep
 import datetime
 from ConfigParser import RawConfigParser
 from time import sleep
+from uuid import uuid4
+
 
 class DoSimi():
     def __init__(self, parent, param = None, isopen = False, fromprof = False, pathout = False, filename ='', gparent = False, wordgraph = False, listactives = False, actives = False, cmd = False, openfromprof=False):
 
 class DoSimi():
     def __init__(self, parent, param = None, isopen = False, fromprof = False, pathout = False, filename ='', gparent = False, wordgraph = False, listactives = False, actives = False, cmd = False, openfromprof=False):
@@ -31,7 +34,7 @@ class DoSimi():
         else :
             self.paramsimi = {'coeff' : 0,
                           'layout' : 2,
         else :
             self.paramsimi = {'coeff' : 0,
                           'layout' : 2,
-                          'type' : 1,
+                          'type_graph' : 1,
                           'arbremax' : 1,
                           'coeff_tv' : 0,
                           'coeff_tv_nb' : 10,
                           'arbremax' : 1,
                           'coeff_tv' : 0,
                           'coeff_tv_nb' : 10,
@@ -181,7 +184,7 @@ class DoSimi():
 
         paramsimi = {'coeff' : self.dial.choice1.GetSelection(),
                           'layout' : self.dial.choice2.GetSelection(),
 
         paramsimi = {'coeff' : self.dial.choice1.GetSelection(),
                           'layout' : self.dial.choice2.GetSelection(),
-                          'type' : self.dial.choice3.GetSelection(),
+                          'type_graph' : self.dial.choice3.GetSelection(),
                           'arbremax' : self.dial.check1.GetValue(),
                           'coeff_tv' : self.dial.check_s_size.GetValue(),
                           'coeff_tv_nb' : self.dial.spin_tv.GetValue(),
                           'arbremax' : self.dial.check1.GetValue(),
                           'coeff_tv' : self.dial.check_s_size.GetValue(),
                           'coeff_tv_nb' : self.dial.spin_tv.GetValue(),
@@ -226,6 +229,9 @@ class DoSimi():
         if not 'simi' in conf.sections() :
             conf.add_section('simi')
         date = datetime.datetime.now().ctime()
         if not 'simi' in conf.sections() :
             conf.add_section('simi')
         date = datetime.datetime.now().ctime()
+        if self.fromprof :
+            conf.set('simi', 'corpus', self.Source.corpus.parametres['uuid'])
+        conf.set('simi', 'uuid', str(uuid4()))
         conf.set('simi', 'date', str(date))
         conf.set('simi', 'indice', self.paramsimi['coeff'])
         conf.set('simi','layout', self.paramsimi['layout'])
         conf.set('simi', 'date', str(date))
         conf.set('simi', 'indice', self.paramsimi['coeff'])
         conf.set('simi','layout', self.paramsimi['layout'])
@@ -402,15 +408,15 @@ class DoSimi():
         if self.paramsimi['layout'] == 4 : layout = 'graphopt'
         
         self.filename=''
         if self.paramsimi['layout'] == 4 : layout = 'graphopt'
         
         self.filename=''
-        if self.paramsimi['type'] == 0 : type = 'tkplot'
-        if self.paramsimi['type'] == 1 : 
+        if self.paramsimi['type_graph'] == 0 : type = 'tkplot'
+        if self.paramsimi['type_graph'] == 1 : 
             graphnb = 1
             type = 'nplot'
             dirout = os.path.dirname(self.DictPathOut['mat01'])
             while os.path.exists(os.path.join(dirout,'graph_simi_'+str(graphnb)+'.png')):
                 graphnb +=1
             self.filename = ffr(os.path.join(dirout,'graph_simi_'+str(graphnb)+'.png'))
             graphnb = 1
             type = 'nplot'
             dirout = os.path.dirname(self.DictPathOut['mat01'])
             while os.path.exists(os.path.join(dirout,'graph_simi_'+str(graphnb)+'.png')):
                 graphnb +=1
             self.filename = ffr(os.path.join(dirout,'graph_simi_'+str(graphnb)+'.png'))
-        if self.paramsimi['type'] == 2 : type = 'rgl'
+        if self.paramsimi['type_graph'] == 2 : type = 'rgl'
      
         if self.paramsimi['arbremax'] : 
             arbremax = 'TRUE'
      
         if self.paramsimi['arbremax'] : 
             arbremax = 'TRUE'