1 # -*- coding: utf-8 -*-
2 #modification pour python 3 : Laurent Mérat, 6x7 - mai 2020
4 #------------------------------------
5 # import des modules python
6 #------------------------------------
8 from shutil import copyfile
11 #------------------------------------
12 # import des fichiers du projet
13 #------------------------------------
14 from chemins import PathOut
19 def __init__(self, parent, parametres) :
21 self.parametres = parametres
22 self.jspathin = os.path.join(self.parent.AppliPath, 'webexport','js')
23 self.csspathin = os.path.join(self.parent.AppliPath, 'webexport', 'css')
24 self.imgpathin = os.path.join(self.parent.AppliPath, 'webexport', 'images')
25 if not 'dirout' in self.parametres :
26 self.pathout = PathOut(filename = self.parametres['gexffile'], analyse_type='webexport')
27 dirout = self.pathout.mkdirout()
28 self.pathout.dirout = dirout
30 self.pathout = PathOut(dirout = self.parametres['dirout'])
33 def makedirout(self) :
34 jss = os.listdir(self.jspathin)
35 css = os.listdir(self.csspathin)
36 img = os.listdir(self.imgpathin)
37 jspathout = os.path.join(self.pathout.dirout, 'js')
38 cssout = os.path.join(self.pathout.dirout, 'css')
39 imgout = os.path.join(self.pathout.dirout, 'images')
40 os.makedirs(jspathout)
44 copyfile(os.path.join(self.jspathin, f), os.path.join(jspathout, f))
46 copyfile(os.path.join(self.csspathin, f), os.path.join(cssout, f))
48 copyfile(os.path.join(self.imgpathin, f), os.path.join(imgout, f))
51 copyfile(self.parametres['gexffile'], os.path.join(self.pathout.dirout, os.path.basename(self.parametres['gexffile'])))
52 afcfile = os.path.join(self.parent.AppliPath, 'webexport', 'afc.html')
53 afcout = os.path.join(self.pathout.dirout, 'afc.html')
54 with codecs.open(afcfile, 'r', 'utf8') as f :
56 self.parametres['gexffile'] = os.path.basename(self.parametres['gexffile'])
57 content = content % self.parametres
58 with open(afcout, 'w') as f :
62 def exportsimi(self) :
63 simifile = os.path.join(self.parent.AppliPath, 'webexport', 'graphe.html')
64 simiout = os.path.join(self.pathout.dirout, 'graphe.html')
65 with codecs.open(simifile, 'r', 'utf8') as f :
67 self.parametres['gexffile'] = os.path.basename(self.parametres['gexffile'])
68 content = content % self.parametres
69 with open(simiout, 'w') as f :