From 14306f7e8ad811fdf21e56afcbda49ad305b37a2 Mon Sep 17 00:00:00 2001 From: Andrew Chin Date: Sun, 12 Feb 2012 13:45:43 -0500 Subject: [PATCH] Bring docs and code in sync --- docs/config.rst | 43 +++++++++++++++------------ overviewer.py | 12 ++++---- overviewer_core/settingsDefinition.py | 10 +++---- 3 files changed, 35 insertions(+), 30 deletions(-) diff --git a/docs/config.rst b/docs/config.rst index bd6a670..45f2ce0 100644 --- a/docs/config.rst +++ b/docs/config.rst @@ -22,7 +22,7 @@ A Simple Example worlds["My world"] = "/home/username/server/world" render["normalrender"] = { - "world": "My world", + "worldname": "My world", "title": "Normal Render of My World", } @@ -38,7 +38,7 @@ The ``worlds`` dictionary dictionary. If you want to render more than one world, you would put more lines like this one. Otherwise, one is sufficient. -The ``render`` dictionary +The ``renders`` dictionary Each item here declares a "render" which is a map of a world rendered with a set of options. If you have more than one, when viewing the maps, you will get a dropdown box to choose which map you want to look at. @@ -59,37 +59,37 @@ A more complicated example worlds["survival"] = "/home/username/server/survivalworld" worlds["creative"] = "/home/username/server/creativeworld" - render["survivalday"] = { - "world": "survival", + renders["survivalday"] = { + "worldname": "survival", "title": "Survival Daytime", "rendermode": smooth_lighting, "dimension": "overworld", } - render["survivalnight"] = { - "world": "survival", + renders["survivalnight"] = { + "worldname": "survival", "title": "Survival Daytime", "rendermode": smooth_night, "dimension": "overworld", } - render["survivalnether"] = { - "world": "survival", + renders["survivalnether"] = { + "worldname": "survival", "title": "Survival Nether", "rendermode": nether_smooth_lighting, "dimension": "nether", } - render["survivalspawnoverlay"] = { - "world": "survival", + renders["survivalspawnoverlay"] = { + "worldname": "survival", "title": "Spawn Overlay", "rendermode": spawn_overlay, "dimension": "overworld", "overlay": ["survivalday", "survivalnight"], } - render["creative"] = { - "world": "creative", + renders["creative"] = { + "worldname": "creative", "title": "Creative", "rendermode": smooth_lighting, "dimension": "overworld", @@ -123,7 +123,7 @@ This means you can put arbitrary logic in this file. The Overviewer gives the execution of the file a local dict with a few pre-defined items (everything in the overviewer_core.rendermodes module). -After the config file is evaluated, the ``worlds`` and ``render`` dictionaries, +After the config file is evaluated, the ``worlds`` and ``renders`` dictionaries, along with other global level configuration options, are used to configure The Overviewer's rendering. @@ -131,12 +131,12 @@ Overviewer's rendering. This is pre-defined as an empty dictionary. The config file is expected to add at least one item to it. - Keys are arbitrary strings used to identify the worlds in the ``render`` + Keys are arbitrary strings used to identify the worlds in the ``renders`` dictionary. Values are paths to worlds (directories with a level.dat) -``render`` +``renders`` This is also pre-defined as an empty dictionary. The config file is expected to add at least one item to it. @@ -152,7 +152,7 @@ Overviewer's rendering. Render Dictonary Keys --------------------- -``world`` +``worldname`` Specifies which world this render corresponds to. Its value should be a string from the appropriate key in the worlds dictionary. @@ -172,9 +172,8 @@ Render Dictonary Keys ``title`` This is the display name used in the user interface. Set this to whatever - you want to see under the dropdown box for map selection. - - **Deafult: Worldname - Dimension** + you want to see displayed in the Map Type control (the buttons in the upper- + right). ``rendermode`` This is which rendermode to use for this render. There are many rendermodes @@ -242,6 +241,12 @@ These values are set directly in the config file. Example:: This can also be specified with :option:`--processes <-p>` +.. _outputdir: + +``outputdir = ""`` + This is the path to the output directory where the rendered tiles will + be saved. + TODO: More to come here .. _customrendermodes: diff --git a/overviewer.py b/overviewer.py index 0d1bf19..1669c91 100755 --- a/overviewer.py +++ b/overviewer.py @@ -223,10 +223,10 @@ dir but you forgot to put quotes around the directory, since it contains spaces. logging.debug("Using %r as the world directory", worldpath) logging.debug("Using %r as the output directory", destdir) - mw_parser.set_config_item("world", {'world': worldpath}) + mw_parser.set_config_item("worlds", {'world': worldpath}) mw_parser.set_config_item("outputdir", destdir) # Now for some good defaults - mw_parser.set_config_item("render", {'world': { + mw_parser.set_config_item("renders", {'world': { 'worldname': 'world', 'title': 'Overviewer Render', 'rendermode': 'normal', @@ -252,15 +252,15 @@ dir but you forgot to put quotes around the directory, since it contains spaces. ############################################################ # Final validation steps and creation of the destination directory - if not config['render']: + if not config['renders']: logging.error("You must specify at least one render in your config file. See the docs if you're having trouble") return 1 - for rname, render in config['render'].iteritems(): + for rname, render in config['renders'].iteritems(): # Convert render['worldname'] to the world path, and store the original # in render['worldname_orig'] try: - worldpath = config['world'][render['worldname']] + worldpath = config['worlds'][render['worldname']] except KeyError: logging.error("Render %s's world is '%s', but I could not find a corresponding entry in the worlds dictionary.", rname, render['worldname']) @@ -297,7 +297,7 @@ dir but you forgot to put quotes around the directory, since it contains spaces. # same for textures texcache = {} - renders = config['render'] + renders = config['renders'] for render_name, render in renders.iteritems(): logging.debug("Found the following render thing: %r", render) diff --git a/overviewer_core/settingsDefinition.py b/overviewer_core/settingsDefinition.py index c34073d..7b387ba 100644 --- a/overviewer_core/settingsDefinition.py +++ b/overviewer_core/settingsDefinition.py @@ -45,8 +45,8 @@ from settingsValidators import * -# render is a dictionary mapping strings to dicts. These dicts describe the -# configuration for that render. Therefore, the validator for 'render' is set +# renders is a dictionary mapping strings to dicts. These dicts describe the +# configuration for that render. Therefore, the validator for 'renders' is set # to a dict validator configured to validate keys as strings and values as... # values are set to validate as a "configdict", which is a dict mapping a set @@ -55,7 +55,7 @@ from settingsValidators import * # objects with their respective validators. # config file. -render = Setting(required=True, default={}, +renders = Setting(required=True, default={}, validator=make_dictValidator(validateStr, make_configDictValidator( { "worldname": Setting(required=True, validator=validateStr, default=None), @@ -77,8 +77,8 @@ render = Setting(required=True, default={}, } ))) -# The world dict, mapping world names to world paths -world = Setting(required=True, validator=make_dictValidator(validateStr, validateWorldPath), default={}) +# The worlds dict, mapping world names to world paths +worlds = Setting(required=True, validator=make_dictValidator(validateStr, validateWorldPath), default={}) outputdir = Setting(required=True, validator=validateOutputDir, default=None)