2 from shutil import copyfile
4 from chemins import PathOut
9 def __init__(self, parent, parametres) :
11 self.parametres = parametres
12 self.jspathin = os.path.join(self.parent.AppliPath, 'webexport','js')
13 self.csspathin = os.path.join(self.parent.AppliPath, 'webexport', 'css')
14 self.imgpathin = os.path.join(self.parent.AppliPath, 'webexport', 'images')
15 if not 'dirout' in self.parametres :
16 self.pathout = PathOut(filename = self.parametres['gexffile'], analyse_type='webexport')
17 dirout = self.pathout.mkdirout()
18 self.pathout.dirout = dirout
20 self.pathout = PathOut(dirout = self.parametres['dirout'])
23 def makedirout(self) :
24 jss = os.listdir(self.jspathin)
25 css = os.listdir(self.csspathin)
26 img = os.listdir(self.imgpathin)
27 jspathout = os.path.join(self.pathout.dirout, 'js')
28 cssout = os.path.join(self.pathout.dirout, 'css')
29 imgout = os.path.join(self.pathout.dirout, 'images')
30 os.makedirs(jspathout)
34 copyfile(os.path.join(self.jspathin, f), os.path.join(jspathout, f))
36 copyfile(os.path.join(self.csspathin, f), os.path.join(cssout, f))
38 copyfile(os.path.join(self.imgpathin, f), os.path.join(imgout, f))
41 copyfile(self.parametres['gexffile'], os.path.join(self.pathout.dirout, os.path.basename(self.parametres['gexffile'])))
42 afcfile = os.path.join(self.parent.AppliPath, 'webexport', 'afc.html')
43 afcout = os.path.join(self.pathout.dirout, 'afc.html')
44 with codecs.open(afcfile, 'r', 'utf8') as f :
46 self.parametres['gexffile'] = os.path.basename(self.parametres['gexffile'])
47 content = content % self.parametres
48 with open(afcout, 'w') as f :
52 def exportsimi(self) :
53 simifile = os.path.join(self.parent.AppliPath, 'webexport', 'graphe.html')
54 simiout = os.path.join(self.pathout.dirout, 'graphe.html')
55 with codecs.open(simifile, 'r', 'utf8') as f :
57 self.parametres['gexffile'] = os.path.basename(self.parametres['gexffile'])
58 content = content % self.parametres
59 with open(simiout, 'w') as f :