+ self.read()
+
+ def addMatrix(self, analyse) :
+ tosave = analyse
+ #tosave['matrix_name'] = analyse['matrix_name']
+ tosave['analyses'] = []
+ self.matrix.append(tosave)
+ self.write()
+ self.read()
+
+ def addMatrixAnalyse(self, analyse) :
+ tosave = {'uuid' : analyse['uuid'], 'ira': analyse['ira'], 'type' : analyse['type'], 'matrix' : analyse['matrix']}
+ tosave['name'] = analyse['name']
+ if tosave['matrix'] in self.ordermatrix :
+ self.matrix[self.ordermatrix[tosave['matrix']]]['analyses'].append(tosave)
+ self.write()
+ self.read()
+
+ def addmultiple(self, analyses) :
+ log.info('add multiple')
+ for analyse in analyses :
+ tosave = {'uuid' : analyse['uuid'], 'ira': analyse['ira'], 'type' : analyse['type']}
+ corpus = analyse['corpus']
+ tosave['corpus'] = corpus
+ tosave['name'] = analyse['name']
+ if corpus in self.corpus :
+ if 'analyses' in self.history[self.ordercorpus[corpus]] :
+ self.history[self.ordercorpus[corpus]]['analyses'].append(tosave)
+ else :
+ self.history[self.ordercorpus[corpus]]['analyses'] = [tosave]
+ self.write()
+ self.read()
+
+ def delete(self, analyse, corpus = False) :
+ log.info('delete %s' % analyse.get('name', 'noname'))
+ if corpus :
+ self.history.pop(self.ordercorpus[analyse['uuid']])
+ if analyse['uuid'] in self.openedcorpus :
+ del self.openedcorpus[analyse['uuid']]
+ log.info('delete corpus : %s' % analyse['uuid'])
+ 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()