From 6c7423d37da627d494011d6b95053d44f6021d6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Mon, 24 Feb 2020 22:29:44 +0100 Subject: [PATCH] Added usage info + made the mapgen script work with python2 --- index.html | 9 +++++++-- scripts/mapgen.py | 44 ++++++++++++++++++++++++++------------------ style.css | 5 +++++ 3 files changed, 38 insertions(+), 20 deletions(-) diff --git a/index.html b/index.html index 868561b..6026e11 100644 --- a/index.html +++ b/index.html @@ -9,7 +9,13 @@

GPXSee Online Maps

- +

GPXSee online map definition files ready to use. Simply download the XML file +and open it in GPXSee as a map file. To use the map permanently, copy the file +to the "maps" directory as found under Help->Paths.

+

Some maps require API keys or user credentials. Such map definition +files have a ".tpl" extension instead of the usual ".xml" +extension. You must fill in the required info and rename the file before you can +use it in GPXSee.

Worldwide

@@ -230,4 +236,3 @@ - diff --git a/scripts/mapgen.py b/scripts/mapgen.py index f14f228..a137345 100755 --- a/scripts/mapgen.py +++ b/scripts/mapgen.py @@ -1,9 +1,11 @@ #!/usr/bin/env python +# -*- coding: utf-8 -*- import os import sys import re import shutil +import codecs import xml.etree.ElementTree as ET COUNTRYCODES = { @@ -262,7 +264,7 @@ def sectionname(name): return name def header(name, level): - return "" + name + "" + return "" + name + "\n" def tile(xmlfile, suffix): base = os.path.splitext(os.path.basename(xmlfile))[0] @@ -294,22 +296,21 @@ def mapinfo(xmlfile): return info def processmaps(maps, htmlfile): - print("
", file=htmlfile) - print("", file=htmlfile) - + htmlfile.write("
\n\n") + i = 0 for xmlfile in maps: shutil.copyfile(xmlfile, "../maps/" + os.path.basename(xmlfile)) info = mapinfo(xmlfile) if i and i % 4 == 0: - print("", file=htmlfile) - print("", file=htmlfile) + htmlfile.write("\n") + htmlfile.write("\n") i = i + 1 - print("", file=htmlfile) - print("
" + "\"Map
" - + info["name"] + "
" + "\"Map
" + + info["name"] + "
", file=htmlfile) + htmlfile.write("\n\n") def processdir(path, level, name, htmlfile): maps = [] @@ -327,17 +328,17 @@ def processdir(path, level, name, htmlfile): processmaps(maps, htmlfile) sections.sort() for section in sections: - print(header(section[0], level + 1), file=htmlfile) + htmlfile.write(header(section[0], level + 1)) processdir(section[1], level + 1, section[0], htmlfile) if len(sys.argv) < 2: - print("Usage: " + os.path.basename(sys.argv[0]) + " DIR", file=sys.stderr) + sys.stderr.write("Usage: " + os.path.basename(sys.argv[0]) + " WORLDDIR\n") sys.exit(-1) -htmlfile = open("../index.html", "w") +htmlfile = codecs.open("../index.html", "w", encoding='utf-8') -print(""" +htmlfile.write(""" GPXSee Online Maps @@ -348,15 +349,22 @@ print("""

GPXSee Online Maps

-""", file = htmlfile) +

GPXSee online map definition files ready to use. Simply download the XML file +and open it in GPXSee as a map file. To use the map permanently, copy the file +to the "maps" directory as found under Help->Paths.

+

Some maps require API keys or user credentials. Such map definition +files have a ".tpl" extension instead of the usual ".xml" +extension. You must fill in the required info and rename the file before you can +use it in GPXSee.

+""") -print(header("Worldwide", 2), file=htmlfile) +htmlfile.write(header("Worldwide", 2)) processdir(sys.argv[1], 1, os.path.basename(sys.argv[1]), htmlfile) -print(""" +htmlfile.write("""
-""", file=htmlfile) +""") htmlfile.close() diff --git a/style.css b/style.css index 8d2c8ce..52f4752 100644 --- a/style.css +++ b/style.css @@ -34,3 +34,8 @@ h3 { background:#000000; border-radius:5px; } +.center p { + margin-left:10px; + width:60%; + color:#ffffff; +} \ No newline at end of file