summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@behdad.org>2016-09-19 10:05:00 +0200
committerBehdad Esfahbod <behdad@behdad.org>2016-09-19 10:05:00 +0200
commit57b5b9d49ce7066f8a21e607889dbbcce57bb1ed (patch)
tree10bc8300bb3b19c61f92d3b1e1138314e71aeda4
parentdfcd85f290e11a2edf8c28c3056e66cfdd815582 (diff)
Fix aspect ratio
-rwxr-xr-xslippy.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/slippy.py b/slippy.py
index 54fe97a..37bbd6e 100755
--- a/slippy.py
+++ b/slippy.py
@@ -333,8 +333,7 @@ class ViewerGTK (Viewer):
class ViewerFile (Viewer):
- def __init__ (self, filename, width=8.5*4/3*72, height=8.5*72):
- self.width, self.height = width, height
+ def __init__ (self, filename, **settings):
if filename.endswith (".pdf"):
Klass = cairo.PDFSurface
elif filename.endswith (".ps"):
@@ -344,6 +343,13 @@ class ViewerFile (Viewer):
else:
raise Exception ("Donno how to save as %s" % filename)
+ parts = settings.get('geometry', '').split ("+")
+ if parts[0]:
+ width, height = [int(x) for x in parts[0].split('x')]
+ else:
+ width, height = 8.5*4*72, 8.5*72
+
+ self.width, self.height = width, height
self.surface = Klass (filename, self.width, self.height)
def run (self, slides, theme=None):
@@ -813,7 +819,7 @@ Usage: slippy.py [--output output.pdf/ps/svg] [--theme theme.py] \\
usage ()
if outputfile:
- viewer = ViewerFile (outputfile)
+ viewer = ViewerFile (outputfile, **settings)
else:
viewer = ViewerGTK (**settings)
viewer.run (slides, theme=theme)