0

more indentation fixes

This commit is contained in:
Aaron Griffith
2011-08-15 15:29:36 -04:00
parent 0c523461fa
commit e618e949c9
2 changed files with 11 additions and 10 deletions

View File

@@ -118,7 +118,6 @@ def main():
parser.add_option("--skip-js", dest="skipjs", action="store_true", helptext="Don't output marker.js or regions.js")
parser.add_option("--no-signs", dest="nosigns", action="store_true", helptext="Don't output signs to markers.js")
parser.add_option("--display-config", dest="display_config", action="store_true", helptext="Display the configuration parameters, but don't render the map. Requires all required options to be specified", commandLineOnly=True)
parser.add_option("--advanced-help", dest="advanced_help", action="store_true", helptext="Display help - including advanced options", commandLineOnly=True)
#parser.add_option("--write-config", dest="write_config", action="store_true", helptext="Writes out a sample config file", commandLineOnly=True)
options, args = parser.parse_args()

View File

@@ -12,7 +12,7 @@ class ConfigOptionParser(object):
self.cmdParser = optparse.OptionParser(usage=kwargs.get("usage",""))
self.configFile = kwargs.get("config","settings.py")
self.configVars = []
self.advancedHelp = []
self.advancedHelp = []
# these are arguments not understood by OptionParser, so they must be removed
# in add_option before being passed to the OptionParser
@@ -23,7 +23,8 @@ class ConfigOptionParser(object):
self.requiredArgs = []
# add the *very* special config-file path option
# add the *very* special advanced help and config-file path options
self.add_option("--advanced-help", dest="advanced_help", action="store_true", helptext="Display help - including advanced options", commandLineOnly=True)
self.add_option("--settings", dest="config_file", helptext="Specifies a settings file to load, by name. This file's format is discussed in the README.", metavar="PATH", type="string", commandLineOnly=True)
def display_config(self):
@@ -38,10 +39,10 @@ class ConfigOptionParser(object):
self.configVars.append(kwargs.copy())
if kwargs.get("advanced"):
kwargs['help'] = optparse.SUPPRESS_HELP
self.advancedHelp.append((args, kwargs.copy()))
kwargs['help'] = optparse.SUPPRESS_HELP
self.advancedHelp.append((args, kwargs.copy()))
else:
kwargs["help"]=kwargs["helptext"]
kwargs["help"]=kwargs["helptext"]
for arg in self.customArgs:
if arg in kwargs.keys(): del kwargs[arg]
@@ -54,16 +55,17 @@ class ConfigOptionParser(object):
self.cmdParser.print_help()
def advanced_help(self):
self.cmdParser.set_conflict_handler('resolve') # Allows us to overwrite the previous definitions
for opt in self.advancedHelp:
self.cmdParser.set_conflict_handler('resolve') # Allows us to overwrite the previous definitions
for opt in self.advancedHelp:
opt[1]['help']="[!]" + opt[1]['helptext']
for arg in self.customArgs:
if arg in opt[1].keys(): del opt[1][arg]
if arg in opt[1].keys():
del opt[1][arg]
if opt[1].get("type", None):
opt[1]['type'] = 'string' # we'll do our own converting later
self.cmdParser.add_option(*opt[0], **opt[1])
self.cmdParser.epilog = "Advanced options indicated by [!]. These options should not normally be required, and may have caveats regarding their use. See README file for more details"
self.print_help()
self.print_help()
def parse_args(self):