X-Git-Url: http://iramuteq.org/git?a=blobdiff_plain;f=webexport.py;h=800c32f7f27827652d51e34eff240db3ae97ed4b;hb=0df8fefc078c8e93342e6b7ad55a0ba0b9142498;hp=4733d854892c7411c9ea753db60b06a5094f31a1;hpb=c0e66bf79b305e620e352f3aac05b9a1cdb3f60f;p=iramuteq diff --git a/webexport.py b/webexport.py index 4733d85..800c32f 100644 --- a/webexport.py +++ b/webexport.py @@ -1,16 +1,27 @@ +# -*- coding: utf-8 -*- +#modification pour python 3 : Laurent Mérat, 6x7 - mai 2020 + +#------------------------------------ +# import des modules python +#------------------------------------ import codecs from shutil import copyfile import os -from chemins import PathOut +#------------------------------------ +# import des fichiers du projet +#------------------------------------ +from chemins import PathOut class WebExport : + def __init__(self, parent, parametres) : self.parent = parent self.parametres = parametres self.jspathin = os.path.join(self.parent.AppliPath, 'webexport','js') self.csspathin = os.path.join(self.parent.AppliPath, 'webexport', 'css') + self.imgpathin = os.path.join(self.parent.AppliPath, 'webexport', 'images') if not 'dirout' in self.parametres : self.pathout = PathOut(filename = self.parametres['gexffile'], analyse_type='webexport') dirout = self.pathout.mkdirout() @@ -22,14 +33,19 @@ class WebExport : def makedirout(self) : jss = os.listdir(self.jspathin) css = os.listdir(self.csspathin) + img = os.listdir(self.imgpathin) jspathout = os.path.join(self.pathout.dirout, 'js') cssout = os.path.join(self.pathout.dirout, 'css') + imgout = os.path.join(self.pathout.dirout, 'images') os.makedirs(jspathout) os.makedirs(cssout) + os.makedirs(imgout) for f in jss : copyfile(os.path.join(self.jspathin, f), os.path.join(jspathout, f)) for f in css : copyfile(os.path.join(self.csspathin, f), os.path.join(cssout, f)) + for f in img : + copyfile(os.path.join(self.imgpathin, f), os.path.join(imgout, f)) def exportafc(self) : copyfile(self.parametres['gexffile'], os.path.join(self.pathout.dirout, os.path.basename(self.parametres['gexffile']))) @@ -42,7 +58,7 @@ class WebExport : with open(afcout, 'w') as f : f.write(content) return afcout - + def exportsimi(self) : simifile = os.path.join(self.parent.AppliPath, 'webexport', 'graphe.html') simiout = os.path.join(self.pathout.dirout, 'graphe.html') @@ -53,4 +69,3 @@ class WebExport : with open(simiout, 'w') as f : f.write(content) return simiout - \ No newline at end of file