Merge remote-tracking branch 'origin/rewrite' into anvil
This commit is contained in:
@@ -141,6 +141,8 @@ directory.
|
||||
|
||||
# create overviewer.js from the source js files
|
||||
js_src = os.path.join(util.get_program_path(), "overviewer_core", "data", "js_src")
|
||||
if not os.path.isdir(js_src):
|
||||
js_src = os.path.join(util.get_program_path(), "js_src")
|
||||
with open(os.path.join(self.outputdir, "overviewer.js"), "w") as fout:
|
||||
# first copy in js_src/overviewer.js
|
||||
with open(os.path.join(js_src, "overviewer.js")) as f:
|
||||
|
||||
@@ -239,7 +239,7 @@ overviewer.util = {
|
||||
|
||||
var zoomLevels = model.get("zoomLevels");
|
||||
var north_direction = model.get('north_direction');
|
||||
console.log("fromWorldToLatLng: north_direction is %r", north_direction);
|
||||
//console.log("fromWorldToLatLng: north_direction is %r", north_direction);
|
||||
|
||||
// the width and height of all the highest-zoom tiles combined,
|
||||
// inverted
|
||||
@@ -404,7 +404,7 @@ overviewer.util = {
|
||||
// save this info is a nice easy to parse format
|
||||
var currentWorldView = overviewer.mapModel.get("currentWorldView");
|
||||
currentWorldView.options.lastViewport = [x,y,z,zoom];
|
||||
console.log("Updated lastViewport: %r" , [x,y,z,zoom]);
|
||||
//console.log("Updated lastViewport: %r" , [x,y,z,zoom]);
|
||||
window.location.replace("#/" + Math.floor(x) + "/" + Math.floor(y) + "/" + Math.floor(z) + "/" + zoom + "/" + w + "/" + maptype);
|
||||
},
|
||||
'updateHash': function() {
|
||||
|
||||
@@ -3,13 +3,13 @@ overviewer.views= {}
|
||||
|
||||
overviewer.views.WorldView = Backbone.View.extend({
|
||||
initialize: function(opts) {
|
||||
console.log("WorldView::initialize()");
|
||||
console.log(this.model.get("tileSets"));
|
||||
//console.log("WorldView::initialize()");
|
||||
//console.log(this.model.get("tileSets"));
|
||||
this.options.mapTypes = [];
|
||||
this.options.mapTypeIds = [];
|
||||
this.model.get("tileSets").each(function(tset, index, list) {
|
||||
console.log(" eaching");
|
||||
console.log(" Working on tileset %s" , tset.get("name"));
|
||||
//console.log(" eaching");
|
||||
//console.log(" Working on tileset %s" , tset.get("name"));
|
||||
var ops = {
|
||||
getTileUrl: overviewer.gmap.getTileUrlGenerator(tset.get("path"), tset.get("base"), tset.get("imgextension")),
|
||||
'tileSize': new google.maps.Size(
|
||||
@@ -55,7 +55,7 @@ overviewer.views.WorldSelectorView = Backbone.View.extend({
|
||||
"change select": "changeWorld"
|
||||
},
|
||||
changeWorld: function() {
|
||||
console.log("change world!");
|
||||
//console.log("change world!");
|
||||
var selectObj = this.$("select")[0];
|
||||
var selectedOption = selectObj.options[selectObj.selectedIndex];
|
||||
|
||||
@@ -63,7 +63,7 @@ overviewer.views.WorldSelectorView = Backbone.View.extend({
|
||||
//
|
||||
},
|
||||
render: function(t) {
|
||||
console.log("WorldSelectorView::render() TODO implement this (low priority)");
|
||||
//console.log("WorldSelectorView::render() TODO implement this (low priority)");
|
||||
}
|
||||
});
|
||||
|
||||
@@ -118,11 +118,11 @@ overviewer.views.CoordboxView = Backbone.View.extend({
|
||||
|
||||
overviewer.views.GoogleMapView = Backbone.View.extend({
|
||||
initialize: function(opts) {
|
||||
console.log(this);
|
||||
//console.log(this);
|
||||
this.options.map = null;
|
||||
var curWorld = this.model.get("currentWorldView").model;
|
||||
console.log("Current world:");
|
||||
console.log(curWorld);
|
||||
//console.log("Current world:");
|
||||
//console.log(curWorld);
|
||||
|
||||
var curTset = curWorld.get("tileSets").at(0);
|
||||
|
||||
@@ -144,9 +144,9 @@ overviewer.views.GoogleMapView = Backbone.View.extend({
|
||||
var mapOptions = {};
|
||||
//
|
||||
curWorld.get("tileSets").each(function(elem, index, list) {
|
||||
console.log("Setting up map for:");
|
||||
console.log(elem);
|
||||
console.log("for %s generating url func with %s and %s", elem.get("name"), elem.get("path"), elem.get("base"));
|
||||
//console.log("Setting up map for:");
|
||||
//console.log(elem);
|
||||
//console.log("for %s generating url func with %s and %s", elem.get("name"), elem.get("path"), elem.get("base"));
|
||||
|
||||
});
|
||||
// init the map with some default options. use the first tileset in the first world
|
||||
@@ -172,7 +172,7 @@ overviewer.views.GoogleMapView = Backbone.View.extend({
|
||||
// register every ImageMapType with the map
|
||||
$.each(overviewer.collections.worldViews, function( index, worldView) {
|
||||
$.each(worldView.options.mapTypes, function(i_index, maptype) {
|
||||
console.log("registered %s with the maptype registery", worldView.model.get("name") + maptype.shortname);
|
||||
//console.log("registered %s with the maptype registery", worldView.model.get("name") + maptype.shortname);
|
||||
overviewer.map.mapTypes.set(overviewerConfig.CONST.mapDivId +
|
||||
worldView.model.get("name") + maptype.shortname , maptype);
|
||||
});
|
||||
@@ -183,7 +183,7 @@ overviewer.views.GoogleMapView = Backbone.View.extend({
|
||||
* Should be called when the current world has changed in GoogleMapModel
|
||||
*/
|
||||
render: function() {
|
||||
console.log("GoogleMapView::render()");
|
||||
//console.log("GoogleMapView::render()");
|
||||
var view = this.model.get("currentWorldView");
|
||||
this.options.mapOptions.mapTypeControlOptions = {
|
||||
mapTypeIds: view.options.mapTypeIds};
|
||||
@@ -198,14 +198,14 @@ overviewer.views.GoogleMapView = Backbone.View.extend({
|
||||
* Keeps track of the currently visible tileset
|
||||
*/
|
||||
updateCurrentTileset: function() {
|
||||
console.log("GoogleMapView::updateCurrentTileset()");
|
||||
//console.log("GoogleMapView::updateCurrentTileset()");
|
||||
var currentWorldView = this.model.get("currentWorldView");
|
||||
var gmapCurrent = overviewer.map.getMapTypeId();
|
||||
for (id in currentWorldView.options.mapTypeIds) {
|
||||
if (currentWorldView.options.mapTypeIds[id] == gmapCurrent) {
|
||||
console.log("updating currenttileset");
|
||||
//console.log("updating currenttileset");
|
||||
this.options.currentTileSet = currentWorldView.model.get("tileSets").at(id);
|
||||
console.log(this);
|
||||
//console.log(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,35 @@ class Setting(object):
|
||||
self.validator = validator
|
||||
self.default = default
|
||||
|
||||
def checkBadEscape(s):
|
||||
fixed = False
|
||||
fixed_string = s
|
||||
if "\a" in fixed_string:
|
||||
fixed_string = s.replace("\a", r"\a")
|
||||
fixed = True
|
||||
if "\b" in fixed_string:
|
||||
fixed_string = s.replace("\b", r"\b")
|
||||
fixed = True
|
||||
if "\t" in fixed_string:
|
||||
fixed_string = s.replace("\t", r"\t")
|
||||
fixed = True
|
||||
if "\n" in fixed_string:
|
||||
fixed_string = s.replace("\n", r"\n")
|
||||
fixed = True
|
||||
if "\v" in fixed_string:
|
||||
fixed_string = s.replace("\v", r"\v")
|
||||
fixed = True
|
||||
if "\f" in fixed_string:
|
||||
fixed_string = s.replace("\f", r"\f")
|
||||
fixed = True
|
||||
if "\r" in fixed_string:
|
||||
fixed_string = s.replace("\r", r"\r")
|
||||
fixed = True
|
||||
return (fixed, fixed_string)
|
||||
|
||||
|
||||
def validateWorldPath(worldpath):
|
||||
_, worldpath = checkBadEscape(worldpath)
|
||||
abs_path = os.path.abspath(worldpath)
|
||||
if not os.path.exists(os.path.join(abs_path, "level.dat")):
|
||||
raise ValidationException("No level.dat file in '%s'. Are you sure you have the right path?" % (abs_path,))
|
||||
@@ -133,6 +161,7 @@ def validateDimension(d):
|
||||
raise ValidationException("%r is not a valid dimension" % d)
|
||||
|
||||
def validateOutputDir(d):
|
||||
_, d = checkBadEscape(d)
|
||||
if not d.strip():
|
||||
raise ValidationException("You must specify a valid output directory")
|
||||
return os.path.abspath(d)
|
||||
|
||||
@@ -398,7 +398,8 @@ class TileSet(object):
|
||||
path = self.options.get('name'),
|
||||
base = '',
|
||||
bgcolor = bgcolorformat(self.options.get('bgcolor')),
|
||||
world = self.options.get('worldname_orig') + " - " + self.options.get('dimension'),
|
||||
world = self.options.get('worldname_orig') +
|
||||
(" - " + self.options.get('dimension') if self.options.get('dimension') != 'default' else ''),
|
||||
last_rendertime = self.this_rendertime,
|
||||
imgextension = self.imgextension,
|
||||
)
|
||||
|
||||
@@ -64,7 +64,7 @@ def findGitHash():
|
||||
|
||||
def findGitVersion():
|
||||
try:
|
||||
p = Popen(['git', 'describe', '--tags'], stdout=PIPE, stderr=PIPE)
|
||||
p = Popen(['git', 'describe', '--tags'], stdout=PIPE, stderr=PIPE, shell=True)
|
||||
p.stderr.close()
|
||||
line = p.stdout.readlines()[0]
|
||||
if line.startswith('release-'):
|
||||
|
||||
Reference in New Issue
Block a user