1 # -*- coding: utf-8 -*-
2 #Author: Pierre Ratinaud
3 #Copyright (c) 2008-2020 Pierre Ratinaud
4 #modification pour python 3 : Laurent Mérat, 6x7 - mai 2020
7 #------------------------------------
8 # import des modules python
9 #------------------------------------
11 from time import sleep
13 #------------------------------------
14 # import des modules wx
15 #------------------------------------
18 #------------------------------------
19 # import des fichiers du projet
20 #------------------------------------
21 from chemins import PathOut
22 from functions import exec_rcode, check_Rresult
23 from dialog import MergeDialog
24 from PrintRScript import MergeGraphes
26 def merge_graphes(lgraphes):
27 script = MergeGraphes({'lgraphes':lgraphes, 'grapheout' : '/tmp/graphe.graphml'})
33 def __init__(self, ira, parametres, dlg = None):
36 self.parametres = parametres
37 if 'pathout' not in self.parametres :
38 self.parametres['pathout'] = PathOut(self.parametres['fileout'], analyse_type = self.parametres['type'], dirout = os.path.dirname(self.parametres['fileout'])).mkdirout()
39 self.pathout = PathOut(analyse_type = self.parametres['type'], dirout = self.parametres['pathout'])
41 self.pathout = PathOut(dirout = self.parametres['pathout'], analyse_type = self.parametres['type'])
42 if self.doparametres(dlg=dlg) is not None :
43 script = merge_graphes(self.parametres['graphs'])
44 self.doR(script.scriptout, dlg=False)
47 def doparametres(self, dlg=None):
49 dial = MergeDialog(self.ira)
50 res = dial.ShowModal()
52 self.parametres['graphs'] = [graph.GetPath() for graph in dial.graphs if graph.GetPath() != '']
54 # pas besoin d'un dial.Destroy() ???
57 def doR(self, Rscript, wait = False, dlg = None, message = '') :
58 #log.info('R code...')
59 pid = exec_rcode(self.ira.RPath, Rscript, wait = wait)
60 while pid.poll() is None :
62 self.dlg.Pulse(message)
66 return check_Rresult(self.ira, pid)