From b3bc705961fd8798f6379bad9e1d448a85f484a5 Mon Sep 17 00:00:00 2001 From: Pierre Ratinaud Date: Tue, 18 Nov 2014 00:17:13 +0100 Subject: [PATCH] ... --- functions.py | 7 +++++-- tableau.py | 21 ++++++++++++++------- textreinert.py | 5 +++-- tree.py | 7 ++++--- 4 files changed, 26 insertions(+), 14 deletions(-) diff --git a/functions.py b/functions.py index 9b1c8bf..862ea5f 100644 --- a/functions.py +++ b/functions.py @@ -519,7 +519,7 @@ def BugReport(parent, error = None): txt += u'*************************************\n' txt += '\n'.join(excTb).replace(' ', ' ') txt += excName + '\n' - txt += exc + txt += `exc` title = "Bug" dial = BugDialog(parent, **{'title' : title}) @@ -556,7 +556,10 @@ def ReadLexique(parent, lang = 'french', filein = None): else : parent.lexique = ReadDicoAsDico(filein) else : - parent.lexique = {} + if filein is None : + parent.lexique = {} + else : + parent.lexique = ReadDicoAsDico(filein) def ReadList(filein, encoding = sys.getdefaultencoding(), sep = ';'): #file = open(filein) diff --git a/tableau.py b/tableau.py index 50c0291..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 diff --git a/textreinert.py b/textreinert.py index d32f24a..b15273f 100644 --- a/textreinert.py +++ b/textreinert.py @@ -31,8 +31,9 @@ class Reinert(AnalyseText) : self.corpus.make_and_write_sparse_matrix_from_uci(self.actives, self.pathout['TableUc1'], self.pathout['listeuce1']) uci = True Rscript = self.printRscript() - self.doR(Rscript, dlg=self.dlg, message='CHD...') - + result = self.doR(Rscript, dlg=self.dlg, message='CHD...') + if not result : + return 'NOK' self.corpus.make_ucecl_from_R(self.pathout['uce']) self.corpus.make_and_write_profile(self.actives, self.corpus.lc, self.pathout['Contout'], uci = uci) self.sup, lim = self.corpus.make_actives_nb(self.parametres['max_actives'], 2) diff --git a/tree.py b/tree.py index 8718845..91f663c 100644 --- a/tree.py +++ b/tree.py @@ -953,20 +953,21 @@ class LeftTree(CT.CustomTreeCtrl): self.SetItemBold(item, bold) self.SelectItem(item) - def OnItemAppend(self, item): + def OnItemAppend(self, item, select = True): if 'corpus_name' in item : child = self.InsertItem(self.textroot, 0, item['corpus_name']) else : child = self.InsertItem(self.matroot, 0, item['matrix_name']) self.SetPyData(child, item) - self.history.addtab(item) if item['type'] in self.ild : img = self.ild[item['type']] else : img = 24 self.SetItemImage(child, img, CT.TreeItemIcon_Normal) self.SetItemImage(child, img, CT.TreeItemIcon_Expanded) - self.SetItemBold(child, True) + if select : + self.history.addtab(item) + self.SetItemBold(child, True) #dlg = wx.TextEntryDialog(self, "Please Enter The New Item Name", 'Item Naming', 'Python') -- 2.7.4