0

Merge branch 'styled-controls', remote-tracking branch 'fenixin/improve-tall-grass2'

This commit is contained in:
Aaron Griffith
2011-06-08 20:16:54 -04:00
7 changed files with 57 additions and 16 deletions

View File

@@ -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:
@@ -154,12 +155,17 @@ class MapGen(object):
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")

View File

@@ -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)

View File

@@ -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:

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

BIN
web_assets/control-bg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@@ -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;
}

View File

@@ -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,8 +621,12 @@ var overviewer = {
}
});
}
// 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.
if (overviewerConfig.objectGroups.regions.length > 0) {
@@ -697,6 +706,7 @@ var overviewer = {
// add the functionality to toggle visibility of the items
$(controlText).click(function() {
$(controlBorder).toggleClass('top-active');
$(dropdownDiv).toggle();
});