maposmatic-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Maposmatic-dev] [PATCH 2/2] ocitysmap2-render: reject unsupported outpu


From: Thomas Petazzoni
Subject: [Maposmatic-dev] [PATCH 2/2] ocitysmap2-render: reject unsupported output formats
Date: Sat, 31 Mar 2012 19:31:59 +0200

Use the new get_compatible_output_formats() method to reject the
unsupported output formats depending on the selected rendering layout.

Signed-off-by: Thomas Petazzoni <address@hidden>
---
 ocitysmap2-render |   17 ++++++++++++-----
 1 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/ocitysmap2-render b/ocitysmap2-render
index 105bc1f..4961c8c 100755
--- a/ocitysmap2-render
+++ b/ocitysmap2-render
@@ -120,11 +120,6 @@ def main():
                                    or os.path.join(os.environ["HOME"],
                                                    '.ocitysmap.conf')])
 
-    # Output file formats
-    if not options.output_formats:
-        options.output_formats = ['pdf']
-    options.output_formats = set(options.output_formats)
-
     # Parse bounding box arguments when given
     bbox = None
     if options.bbox:
@@ -165,6 +160,18 @@ def main():
                           % (lo.name, lo.description),
                           ocitysmap2.layoutlib.renderers.get_renderers()))))
 
+    # Output file formats
+    if not options.output_formats:
+        options.output_formats = ['pdf']
+    options.output_formats = set(options.output_formats)
+
+    # Reject output formats that are not supported by the renderer
+    compatible_output_formats = cls_renderer.get_compatible_output_formats()
+    for format in options.output_formats:
+        if format not in compatible_output_formats:
+            parser.error("Output format %s not supported by layout %s" %
+                         (format, cls_renderer.name))
+
     # Parse paper size
     if (options.paper_format != 'first') \
             and options.paper_format not in KNOWN_PAPER_SIZE_NAMES:
-- 
1.7.4.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]