From b7baf57eb1adba21251ff00b0b026a1b8fb41259 Mon Sep 17 00:00:00 2001 From: sumpfork Date: Fri, 31 Jan 2014 10:26:54 -0800 Subject: [PATCH] fix how border space is used to calculate how many tabs will fit. Fixes Avery label printing, bug #1268060 --- dominion_tabs.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/dominion_tabs.py b/dominion_tabs.py index a8a29fe..78fb6f5 100644 --- a/dominion_tabs.py +++ b/dominion_tabs.py @@ -746,16 +746,19 @@ class DominionTabs: self.tabHeight = self.tabBaseHeight + self.tabLabelHeight + #note: this is convenient, but somewhat inaccurate as the border space isn't actually part of the tab width self.totalTabWidth = self.tabWidth + self.horizontalBorderSpace self.totalTabHeight = self.tabHeight + self.verticalBorderSpace print "Paper dimensions: %fcm (w) x %fcm (h)" % (self.paperwidth / cm, self.paperheight / cm) print "Tab dimensions: %fcm (w) x %fcm (h)" % (self.totalTabWidth / cm, self.totalTabHeight / cm) - numTabsVerticalP = int ((self.paperheight - 2*minmarginheight) / self.totalTabHeight) - numTabsHorizontalP = int ((self.paperwidth - 2*minmarginwidth) / self.totalTabWidth) - numTabsVerticalL = int ((self.paperwidth - 2*minmarginwidth) / self.totalTabHeight) - numTabsHorizontalL = int ((self.paperheight - 2*minmarginheight) / self.totalTabWidth) + #as we don't draw anything in the final border, it shouldn't count towards how many tabs we can fit + #so it gets added back in to the page size here + numTabsVerticalP = int ((self.paperheight - 2*minmarginheight + self.verticalBorderSpace) / self.totalTabHeight) + numTabsHorizontalP = int ((self.paperwidth - 2*minmarginwidth + self.horizontalBorderSpace) / self.totalTabWidth) + numTabsVerticalL = int ((self.paperwidth - 2*minmarginwidth + self.verticalBorderSpace) / self.totalTabHeight) + numTabsHorizontalL = int ((self.paperheight - 2*minmarginheight + self.horizontalBorderSpace) / self.totalTabWidth) if numTabsVerticalL * numTabsHorizontalL > numTabsVerticalP * numTabsHorizontalP and not fixedMargins: self.numTabsVertical, self.numTabsHorizontal\