Disable renderers and select scale factor from command line
This commit is contained in:
parent
27c593ac84
commit
e544dca6c1
3 changed files with 12 additions and 1 deletions
|
@ -62,6 +62,7 @@ class RenderJob:
|
|||
|
||||
def set_generate(self, state):
|
||||
self.generate = state
|
||||
self.reporting.generate = state
|
||||
|
||||
def load_and_save(self, filename, output):
|
||||
self.m = mapnik.Map(16, 16)
|
||||
|
|
|
@ -13,6 +13,7 @@ class Reporting:
|
|||
self.passed = 0
|
||||
self.failed = 0
|
||||
self.overwrite_failures = False
|
||||
self.generate = False
|
||||
self.errors = [ #(type, actual, expected, diff, message)
|
||||
]
|
||||
|
||||
|
@ -82,7 +83,7 @@ class Reporting:
|
|||
if self.generate:
|
||||
print str(idx+1) + ") Generating reference image: '%s'" % error[2]
|
||||
else:
|
||||
print str(idx+1) + ")Could not verify %s: No reference image found!" % error[1]
|
||||
print str(idx+1) + ") Could not verify %s: No reference image found!" % error[1]
|
||||
continue
|
||||
elif error[0] == self.DIFF:
|
||||
print str(idx+1) + ") \x1b[34m%s different pixels\x1b[0m:\n\t%s (\x1b[31mactual\x1b[0m)\n\t%s (\x1b[32mexpected\x1b[0m)" % (error[3], error[1], error[2])
|
||||
|
|
|
@ -141,6 +141,9 @@ if __name__ == "__main__":
|
|||
parser.add_argument('-d', '--disable-renderer', action='append',
|
||||
help='disable a renderer (options: agg, cairo, grid)',
|
||||
choices=['agg', 'cairo', 'grid'], metavar='NAME', default=[])
|
||||
parser.add_argument('-s', '--scale-factor', action='append',
|
||||
help='use fixed scale factor',
|
||||
type=float, metavar='FACTOR', default=None)
|
||||
parser.add_argument('-o', '--output-dir', action='store',
|
||||
default=visual_output_dir, help='output directory (default: %(default)s)', metavar='DIR')
|
||||
parser.add_argument('file', nargs='*', action='store',
|
||||
|
@ -160,6 +163,12 @@ if __name__ == "__main__":
|
|||
print new_files
|
||||
files = new_files
|
||||
|
||||
for renderer in args.disable_renderer:
|
||||
defaults[renderer] = False
|
||||
|
||||
if args.scale_factor is not None:
|
||||
defaults['scales'] = args.scale_factor
|
||||
|
||||
if 'osm' not in mapnik.DatasourceCache.plugin_names():
|
||||
print "OSM plugin required"
|
||||
sys.exit(2)
|
||||
|
|
Loading…
Reference in a new issue