From e6bfcc30333bc394affb1eba383e7af1745475d0 Mon Sep 17 00:00:00 2001 From: Alex Jurkiewicz Date: Mon, 27 Sep 2010 22:10:23 +1000 Subject: [PATCH] Write HTML file with appropriate extension config. --- quadtree.py | 6 ++++-- template.html | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/quadtree.py b/quadtree.py index fc65f2d..36d6818 100644 --- a/quadtree.py +++ b/quadtree.py @@ -112,13 +112,15 @@ class QuadtreeGen(object): print "{0}/{1} tiles complete on level {2}/{3}".format( complete, total, level, self.p) - def write_html(self, zoomlevel): + def write_html(self, zoomlevel, imgformat): """Writes out index.html""" templatepath = os.path.join(os.path.split(__file__)[0], "template.html") html = open(templatepath, 'r').read() html = html.replace( "{maxzoom}", str(zoomlevel)) + html = html.replace( + "{imgformat}", str(imgformat)) with open(os.path.join(self.destdir, "index.html"), 'w') as output: output.write(html) @@ -263,7 +265,7 @@ class QuadtreeGen(object): else: pool = multiprocessing.Pool(processes=procs) - self.write_html(self.p) + self.write_html(self.p, self.imgformat) # Render the highest level of tiles from the chunks results = collections.deque() diff --git a/template.html b/template.html index ef2868f..e6105c1 100644 --- a/template.html +++ b/template.html @@ -14,7 +14,7 @@