X-Git-Url: http://iramuteq.org/git?p=iramuteq;a=blobdiff_plain;f=tableau.py;h=71e73a78ee87880abf67ede7ee366bbe33e8de76;hp=d2044d03fa337c09e5c357668276d8929db6f91f;hb=ead6ffe8d4024e2afb3dc0c8457cd78dd15768e5;hpb=a38c33bb022324119c865d990e7ef1f087c24780 diff --git a/tableau.py b/tableau.py index d2044d0..71e73a7 100644 --- a/tableau.py +++ b/tableau.py @@ -8,7 +8,7 @@ import sys import xlrd import ooolib import os -import tempfile +from copy import copy import re import htmlentitydefs import shelve @@ -57,12 +57,12 @@ def UpdateDico(Dico, word, line): def copymatrix(tableau): log.info('copy matrix') copymat = Tableau(tableau.parent, parametres = tableau.parametres) - copymat.linecontent = tableau.linecontent - copymat.csvtable = tableau.csvtable - copymat.pathout = tableau.pathout - copymat.colnames = tableau.colnames - copymat.rownb = tableau.rownb - copymat.colnb = tableau.colnb + copymat.linecontent = copy(tableau.linecontent) + copymat.csvtable = copy(tableau.csvtable) + copymat.pathout = copy(tableau.pathout) + copymat.colnames = copy(tableau.colnames) + copymat.rownb = copy(tableau.rownb) + copymat.colnb = copy(tableau.colnb) if copymat.csvtable is None : copymat.open() return copymat @@ -160,8 +160,15 @@ class Tableau() : self.read_ods() self.parametres['csvfile'] = os.path.join(self.parametres['pathout'], 'csvfile.csv') self.make_tmpfile() + print self.parametres DoConf().makeoptions(['matrix'],[self.parametres], self.parametres['ira']) self.parent.history.addMatrix(self.parametres) + + def make_content_simple(self): + self.parametres['csvfile'] = os.path.join(self.parametres['pathout'], 'csvfile.csv') + self.make_tmpfile() + DoConf().makeoptions(['matrix'],[self.parametres], self.parametres['ira']) + self.parent.history.addMatrix(self.parametres) def read_xls(self) : #FIXME : encodage @@ -226,16 +233,17 @@ class Tableau() : def extractfrommod(self, col, val): return ([''] + self.colnames) + [line for line in self.csvtable[1:] if line[col + 1] == val] - def splitfromvar(self, col, var): + def splitfromvar(self, col): newtabs = {} for line in self.csvtable[1:] : - mod = line[col] + mod = line[col+1] if mod in newtabs : newtabs[mod].append(line) else : newtabs[mod] = [line] - return ([''] + self.colnames) + newtab - + for mod in newtabs : + newtabs[mod].insert(0, [''] + self.colnames) + return newtabs def check_rownames(self) : if len(self.rownames) == len(list(set(self.rownames))) :