Revision 593 org.gvsig.scripting/trunk/org.gvsig.scripting/org.gvsig.scripting.app/org.gvsig.scripting.app.mainplugin/src/main/resources-plugin/scripting/scripts/tools/makedocs/makedocs.py
makedocs.py | ||
---|---|---|
1 | 1 |
|
2 |
execfile( script.getResource("../libs/formpanel.py").getAbsolutePath() ) |
|
2 |
from gvsig import * |
|
3 |
from commonsdialog import * |
|
3 | 4 |
|
4 | 5 |
import os |
5 | 6 |
import os.path |
... | ... | |
9 | 10 |
import threading |
10 | 11 |
import logging |
11 | 12 |
|
13 |
from libs.formpanel import FormPanel |
|
14 |
|
|
12 | 15 |
from java.awt import Dimension |
13 | 16 |
|
14 |
from gvsig import * |
|
15 |
from commonsdialog import * |
|
16 |
|
|
17 | 17 |
import pynliner |
18 | 18 |
|
19 | 19 |
|
... | ... | |
105 | 105 |
def findJavaSources(self,workspace,project): |
106 | 106 |
projectFolder = os.path.join(workspace,project) |
107 | 107 |
sources = list() |
108 |
#print projectFolder |
|
108 | 109 |
for root, dirs, files in os.walk(projectFolder): |
109 | 110 |
for file in files: |
110 | 111 |
if file == "pom.xml": |
... | ... | |
136 | 137 |
|
137 | 138 |
return countfiles, len(folders) |
138 | 139 |
|
139 |
def calculateCountOfHTMLs(self,htmlroot): |
|
140 |
def calculateHTMLFileList(self,htmlroot, listfname): |
|
141 |
listfile= open(listfname,"w") |
|
140 | 142 |
countfiles = 0 |
141 | 143 |
for root, dirs, files in os.walk(htmlroot): |
142 | 144 |
for f in files: |
... | ... | |
144 | 146 |
continue |
145 | 147 |
if f.endswith(".html"): |
146 | 148 |
countfiles+=1 |
149 |
listfile.write(os.path.join(root,f)) |
|
150 |
listfile.write("\n") |
|
147 | 151 |
self.message2("[%05d] %s" % (countfiles, os.path.join(root,f))) |
152 |
listfile.close() |
|
148 | 153 |
return countfiles |
149 | 154 |
|
150 | 155 |
def message(self,msg): |
... | ... | |
223 | 228 |
self.pgbProgreso.setValue(loadingcount) |
224 | 229 |
self.message2(line[33:]) |
225 | 230 |
|
226 |
|
|
227 | 231 |
if self.chkProcesarCSS.isSelected(): |
228 | 232 |
self.message("Preparando procesdado de HTMLs (CSS inliner)...") |
229 | 233 |
self.message2("") |
230 | 234 |
path=os.path.join(outputpath,"html","org") |
231 |
self.pgbProgreso.setMaximum(self.calculateCountOfHTMLs(path)) |
|
235 |
|
|
236 |
listfname = script.getResource("htmls.txt").getAbsolutePath() |
|
237 |
lastfname = script.getResource("lasthtml.txt").getAbsolutePath() |
|
238 |
if self.chkContinuarProcesoAnterior.isSelected() and os.path.exists(listfname) and os.path.exists(lastfname): |
|
239 |
ff = open(lastfname,"r") |
|
240 |
skipto = ff.read() |
|
241 |
ff.close() |
|
242 |
if skipto in (None,"","\n"): |
|
243 |
skipto = None |
|
244 |
ff = open(listfname,"r") |
|
245 |
htmlscount = 0 |
|
246 |
for fname in ff: |
|
247 |
htmlscount +=1 |
|
248 |
ff.close() |
|
249 |
else: |
|
250 |
skipto = None |
|
251 |
htmlscount = self.calculateHTMLFileList(path,listfname) |
|
252 |
|
|
253 |
self.pgbProgreso.setMaximum(htmlscount) |
|
232 | 254 |
self.pgbProgreso.setValue(0) |
233 | 255 |
self.pgbProgreso.setIndeterminate(False) |
234 | 256 |
self.message("Procesando HTMLs (CSS inliner)...") |
235 | 257 |
cssinliner = CSSInliner() |
236 | 258 |
htmlscount = 0 |
237 |
for root, dirs, files in os.walk(path): |
|
238 |
for f in files: |
|
239 |
if self.canceled: |
|
240 |
break |
|
241 |
if f.startswith("package-"): |
|
259 |
listfile = open(listfname,"r") |
|
260 |
for fname in listfile: |
|
261 |
htmlscount+=1 |
|
262 |
self.message2(fname) |
|
263 |
self.pgbProgreso.setValue(htmlscount) |
|
264 |
if skipto != None: |
|
265 |
if skipto != fname: |
|
242 | 266 |
continue |
243 |
if f.endswith(".html"): |
|
244 |
htmlscount+=1 |
|
245 |
fname = os.path.join(root,f) |
|
246 |
self.message2(fname) |
|
247 |
cssinliner.process(fname) |
|
248 |
self.pgbProgreso.setValue(htmlscount) |
|
267 |
skipto = None |
|
268 |
if self.canceled: |
|
269 |
ff = open(lastfname,"w") |
|
270 |
ff.write(fname) |
|
271 |
ff.close() |
|
272 |
break |
|
273 |
cssinliner.process(fname) |
|
249 | 274 |
|
250 | 275 |
self.message("Proceso terminado") |
251 | 276 |
self.message2("") |
... | ... | |
293 | 318 |
|
294 | 319 |
|
295 | 320 |
def main(*args): |
296 |
workspace = "/home/jjdelcerro/data/devel"
|
|
297 |
outputfolder = "/home/jjdelcerro/data/temp/javadocs"
|
|
321 |
workspace = "/home/jjdelcerro/datos/devel"
|
|
322 |
outputfolder = "/home/jjdelcerro/datos/temp/javadocs"
|
|
298 | 323 |
projects = ( |
299 | 324 |
("org.gvsig.app.document.layout2.app",None), |
300 | 325 |
("org.gvsig.attributeeditor",None), |
Also available in: Unified diff