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 if not 'dirout' in self.parametres :
15 self.pathout = PathOut(filename = self.parametres['gexffile'], analyse_type='webexport')
16 dirout = self.pathout.mkdirout()
17 self.pathout.dirout = dirout
19 self.pathout = PathOut(dirout = self.parametres['dirout'])
22 def makedirout(self) :
23 jss = os.listdir(self.jspathin)
24 css = os.listdir(self.csspathin)
25 jspathout = os.path.join(self.pathout.dirout, 'js')
26 cssout = os.path.join(self.pathout.dirout, 'css')
27 os.makedirs(jspathout)
30 copyfile(os.path.join(self.jspathin, f), os.path.join(jspathout, f))
32 copyfile(os.path.join(self.csspathin, f), os.path.join(cssout, f))
35 copyfile(self.parametres['gexffile'], os.path.join(self.pathout.dirout, os.path.basename(self.parametres['gexffile'])))
36 afcfile = os.path.join(self.parent.AppliPath, 'webexport', 'afc.html')
37 afcout = os.path.join(self.pathout.dirout, 'afc.html')
38 with codecs.open(afcfile, 'r', 'utf8') as f :
40 self.parametres['gexffile'] = os.path.basename(self.parametres['gexffile'])
41 content = content % self.parametres
42 with open(afcout, 'w') as f :
46 def exportsimi(self) :
47 simifile = os.path.join(self.parent.AppliPath, 'webexport', 'graphe.html')
48 simiout = os.path.join(self.pathout.dirout, 'graphe.html')
49 with codecs.open(simifile, 'r', 'utf8') as f :
51 self.parametres['gexffile'] = os.path.basename(self.parametres['gexffile'])
52 content = content % self.parametres
53 with open(simiout, 'w') as f :