fix how border space is used to calculate how many tabs will fit. Fixes Avery label printing, bug #1268060

This commit is contained in:
Sumpfork 2014-01-31 10:26:54 -08:00
parent c9ba2eb2e7
commit 9d803aa17e

View File

@ -746,16 +746,19 @@ class DominionTabs:
self.tabHeight = self.tabBaseHeight + self.tabLabelHeight 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.totalTabWidth = self.tabWidth + self.horizontalBorderSpace
self.totalTabHeight = self.tabHeight + self.verticalBorderSpace self.totalTabHeight = self.tabHeight + self.verticalBorderSpace
print "Paper dimensions: %fcm (w) x %fcm (h)" % (self.paperwidth / cm, self.paperheight / cm) 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) print "Tab dimensions: %fcm (w) x %fcm (h)" % (self.totalTabWidth / cm, self.totalTabHeight / cm)
numTabsVerticalP = int ((self.paperheight - 2*minmarginheight) / self.totalTabHeight) #as we don't draw anything in the final border, it shouldn't count towards how many tabs we can fit
numTabsHorizontalP = int ((self.paperwidth - 2*minmarginwidth) / self.totalTabWidth) #so it gets added back in to the page size here
numTabsVerticalL = int ((self.paperwidth - 2*minmarginwidth) / self.totalTabHeight) numTabsVerticalP = int ((self.paperheight - 2*minmarginheight + self.verticalBorderSpace) / self.totalTabHeight)
numTabsHorizontalL = int ((self.paperheight - 2*minmarginheight) / self.totalTabWidth) 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: if numTabsVerticalL * numTabsHorizontalL > numTabsVerticalP * numTabsHorizontalP and not fixedMargins:
self.numTabsVertical, self.numTabsHorizontal\ self.numTabsVertical, self.numTabsHorizontal\