From 89a838c7180835fd32072d98f8554a09786a1e8d Mon Sep 17 00:00:00 2001 From: David Lamparter Date: Sun, 1 Dec 2013 15:05:35 +0100 Subject: fix some layout bugs --- ptlayout.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ptlayout.py b/ptlayout.py index 6c3d858..0850c62 100644 --- a/ptlayout.py +++ b/ptlayout.py @@ -113,7 +113,7 @@ class PTLQRCode(PTLayoutElem): cctx.fill() cctx.set_source_rgba(0.0, 0.0, 0.0, 1.0) - return bpp * qmlen + return bpp * qmlen + self.hborder * 2 class PTLContainer(PTLayoutElem): def __init__(self): @@ -132,7 +132,9 @@ class PTLHSeq(PTLContainer): self.spacing = 5 def prep_size(self, hh): - w, h = len(self._children) * self.spacing, 0 + if len(self._children) == 0: + return (0,0) + w, h = (len(self._children) - 1) * self.spacing, 0 for k in self._children: cw, ch = k.prep_size(hh) w += cw -- cgit v1.2.1