def read(self) :
d = shelve.open(self.filein)
self.history = d.get('history', [])
+ self.matrix = d.get('matrix', [])
self.ordercorpus = dict([[corpus['uuid'], i] for i, corpus in enumerate(self.history)])
- self.corpus = dict([[corpus['uuid'], corpus] for i, corpus in enumerate(self.history)])
+ self.corpus = dict([[corpus['uuid'], corpus] for corpus in self.history])
self.analyses = dict([[analyse['uuid'], analyse] for corpus in self.history for analyse in corpus.get('analyses', [])])
+ self.matrixanalyse = dict([[mat['uuid'], mat] for mat in self.matrix])
d.close()
def write(self) :
d = shelve.open(self.filein)
d['history'] = self.history
+ d['matrix'] = self.matrix
d.close()
def add(self, analyse) :
self.write()
self.read()
+ def addMatrix(self, analyse) :
+ tosave = {'uuid' : analyse['uuid'], 'ira': analyse['ira'], 'type' : analyse['type']}
+ tosave['name'] = analyse['name']
+ self.matrix.append(tosave)
+ self.write()
+ self.read()
+
def addmultiple(self, analyses) :
for analyse in analyses :
tosave = {'uuid' : analyse['uuid'], 'ira': analyse['ira'], 'type' : analyse['type']}
self.history.pop(self.ordercorpus[analyse['uuid']])
if analyse['uuid'] in self.openedcorpus :
del self.openedcorpus[analyse['uuid']]
- else :
+ elif analyse['uuid'] in self.analyses :
todel = [i for i, ana in enumerate(self.corpus[analyse['corpus']]['analyses']) if ana['uuid'] == analyse['uuid']][0]
self.history[self.ordercorpus[analyse['corpus']]]['analyses'].pop(todel)
+ elif analyse['uuid'] in self.matrixanalyse :
+ self.matrix = [mat for mat in self.matrix if mat['uuid'] != analyse['uuid']]
self.write()
self.read()
def formatExceptionInfo(maxTBlevel=5):
cla, exc, trbk = sys.exc_info()
- excName = cla.__name__
+ try :
+ excName = cla.__name__
+ except :
+ excName = 'None'
try:
excArgs = exc.args[0]
except :
if isinstance(pid, Popen) :
if pid.returncode != 0 :
error = pid.communicate()
- print error
error = [str(error[0]), error[1]]
if error[1] is None :
error[1] = 'None'
parent.Rerror = '\n'.join([str(pid.returncode), '\n'.join(error)])
- #try :
- raise Exception('\n'.join([u'Erreur R', '\n'.join(error[1:])]))
+ try :
+ raise Exception('\n'.join([u'Erreur R', '\n'.join(error[1:])]))
+ except :
+ BugReport(parent)
return False
- #except :
- # BugReport(parent)
else :
return True
else :
if pid != 0 :
- #try :
- raise Exception(u'Erreur R')
+ try :
+ raise Exception(u'Erreur R')
+ except :
+ BugReport(parent)
return False
- #except :
- # BugReport(parent)
else :
return True