diff --git a/googlemap.py b/googlemap.py index daf0e0e..48fede1 100644 --- a/googlemap.py +++ b/googlemap.py @@ -19,7 +19,7 @@ import stat import cPickle import Image import shutil -from time import strftime, gmtime +from time import strftime, localtime import json import util @@ -66,7 +66,8 @@ class MapGen(object): image format, and world. Note:tiledir for each quadtree should be unique. By default the tiledir is determined by the rendermode""" - self.skipjs = configInfo.get('skipjs', None) + self.skipjs = configInfo.get('skipjs', False) + self.nosigns = configInfo.get('nosigns', False) self.web_assets_hook = configInfo.get('web_assets_hook', None) self.web_assets_path = configInfo.get('web_assets_path', None) self.bg_color = configInfo.get('bg_color') @@ -131,7 +132,7 @@ class MapGen(object): index = open(indexpath, 'r').read() index = index.replace( - "{time}", str(strftime("%a, %d %b %Y %H:%M:%S +0000", gmtime()))) + "{time}", str(strftime("%a, %d %b %Y %H:%M:%S %Z", localtime()))) index = index.replace("{version}", util.findGitVersion()) with open(os.path.join(self.destdir, "index.html"), 'w') as output: @@ -153,13 +154,18 @@ class MapGen(object): # we need to merge self.world.POI with the persistant data in world.PersistentData self.world.POI += filter(lambda x: x['type'] != 'spawn', self.world.persistentData['POI']) + + if self.nosigns: + markers = filter(lambda x: x['type'] != 'sign', self.world.POI) + else: + markers = self.world.POI # write out the default marker table with open(os.path.join(self.destdir, "markers.js"), 'w') as output: output.write("overviewer.collections.markerDatas.push([\n") - for marker in self.world.POI: + for marker in markers: output.write(json.dumps(marker)) - if marker != self.world.POI[-1]: + if marker != markers[-1]: output.write(",") output.write("\n") output.write("]);\n") diff --git a/overviewer.py b/overviewer.py index 22a103c..1bf6790 100755 --- a/overviewer.py +++ b/overviewer.py @@ -107,6 +107,7 @@ def main(): parser.add_option("-q", "--quiet", dest="quiet", action="count", default=0, help="Print less output. You can specify this option multiple times.") parser.add_option("-v", "--verbose", dest="verbose", action="count", default=0, help="Print more output. You can specify this option multiple times.") parser.add_option("--skip-js", dest="skipjs", action="store_true", help="Don't output marker.js or regions.js") + parser.add_option("--no-signs", dest="nosigns", action="store_true", help="Don't output signs to markers.js") parser.add_option("--display-config", dest="display_config", action="store_true", help="Display the configuration parameters, but don't render the map. Requires all required options to be specified", commandLineOnly=True) #parser.add_option("--write-config", dest="write_config", action="store_true", help="Writes out a sample config file", commandLineOnly=True) diff --git a/sample.settings.py b/sample.settings.py index 863b266..8c85a3e 100644 --- a/sample.settings.py +++ b/sample.settings.py @@ -92,9 +92,11 @@ imgformat = "jpg" ################################################################################ ### optimizeimg ## If using png, perform image file size optimizations on the output. Specify 1 -## for pngcrush, 2 for pngcrush+optipng+advdef. This may double (or more) -## render times, but will produce up to 30% smaller images. NOTE: requires -## corresponding programs in $PATH or %PATH% +## for pngcrush, 2 for pngcrush+advdef, 3 for pngcrush+advdef with more agressive +## options. Option 1 gives around 19% of reduction, option 2 gives around 21% +## (it doubles the optimizing time) and option 3 gives around 23% (it doubles, +## again, the optimizing time). Using this option may double (or more) +## render times. NOTE: requires corresponding programs in $PATH or %PATH% ## Default: not set ## Type: integer ## Example: diff --git a/web_assets/control-bg-active.png b/web_assets/control-bg-active.png new file mode 100644 index 0000000..67fb915 Binary files /dev/null and b/web_assets/control-bg-active.png differ diff --git a/web_assets/control-bg.png b/web_assets/control-bg.png new file mode 100644 index 0000000..b638717 Binary files /dev/null and b/web_assets/control-bg.png differ diff --git a/web_assets/overviewer.css b/web_assets/overviewer.css index 14585e6..dc435fa 100644 --- a/web_assets/overviewer.css +++ b/web_assets/overviewer.css @@ -32,23 +32,45 @@ body { .customControl { padding: 5px; height: 15px; + color: black; font-family: Arial, sans-serif; } .customControl > div.top { - background-color: #fff; - border: 2px solid #000; - text-align: center; - width: 70px; font-size: 12px; - width: 70px; + line-height: 160%; + text-align: center; + padding: 0px 6px; + + background-image: url('control-bg.png'); + background-repeat: repeat-x; + + border: 1px solid #A9BBDF; + border-radius: 2px 2px; + box-shadow: rgba(0, 0, 0, 0.347656) 2px 2px 3px; cursor: pointer; } +.customControl > div.top:hover { + border: 1px solid #678AC7; +} + +.customControl > div.top-active { + color: white; + font-weight: bold; + padding: 0px 5px; + border: 1px solid #678AC7; + background-image: url('control-bg-active.png'); +} + .customControl > div.dropDown { - border: 1px solid #000; font-size: 12px; - background-color: #fff; + background-color: white; + + border: 1px solid #A9BBDF; + border-radius: 2px 2px; + box-shadow: rgba(0, 0, 0, 0.347656) 2px 2px 3px; + display: none; } diff --git a/web_assets/overviewer.js b/web_assets/overviewer.js index 467affb..ceeb7dc 100644 --- a/web_assets/overviewer.js +++ b/web_assets/overviewer.js @@ -598,6 +598,11 @@ var overviewer = { var items = []; for (i in overviewerConfig.objectGroups.signs) { var signGroup = overviewerConfig.objectGroups.signs[i]; + // don't create an option for this group if empty + if (overviewer.collections.markers[signGroup.label].length == 0) { + continue; + } + var iconURL = signGroup.icon; if(!iconURL) { iconURL = overviewerConfig.CONST.image.defaultMarker; @@ -616,7 +621,11 @@ var overviewer = { } }); } - overviewer.util.createDropDown('Signposts', items); + + // only create drop down if there's used options + if (items.length > 0) { + overviewer.util.createDropDown('Signposts', items); + } } // if there are any regions data, lets show the option to hide/show them. @@ -697,6 +706,7 @@ var overviewer = { // add the functionality to toggle visibility of the items $(controlText).click(function() { + $(controlBorder).toggleClass('top-active'); $(dropdownDiv).toggle(); });