* fixes for #284 #295 #296
Also added option --full-expansion-dividers
* Add front offsets for issue #248
Added options to offset front (similar to what existed for the backside).
This commit is contained in:
Wendel Voigt 2020-03-23 00:11:29 -05:00 committed by GitHub
parent 9a7a5938f8
commit 1bd731222e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 45 additions and 4 deletions

View File

@ -642,7 +642,11 @@ class DividerDrawer(object):
def wantCentreTab(self, card):
return (
card.isExpansion() and self.options.centre_expansion_dividers
card.isExpansion()
and (
self.options.centre_expansion_dividers
or self.options.full_expansion_dividers
)
) or self.options.tab_side == "centre"
def drawOutline(self, item, isBack=False):
@ -672,7 +676,9 @@ class DividerDrawer(object):
theTabWidth = item.tabWidth
theTabHeight = item.tabHeight
left2tab = item.getTabOffset(backside=isBack)
left2tab = item.getTabOffset(
backside=False
) # translate/scale above takes care of backside
right2tab = dividerWidth - tabLabelWidth - left2tab
nearZero = 0.01
left2tab = left2tab if left2tab > nearZero else 0
@ -1551,6 +1557,10 @@ class DividerDrawer(object):
self.options.back_offset, self.options.back_offset_height
)
pageWidth -= 2 * self.options.back_offset
else:
self.canvas.translate(
self.options.front_offset, self.options.front_offset_height
)
item.translate(self.canvas, pageWidth, isBack)
@ -1908,7 +1918,11 @@ class DividerDrawer(object):
if lastCardSet != card.cardset_tag:
# In a new expansion, so reset the tabs to start over
nextTabIndex = CardPlot.tabRestart()
if options.tab_number > Card.sets[card.cardset_tag]["count"]:
if (
options.tab_number > Card.sets[card.cardset_tag]["count"]
and Card.sets[card.cardset_tag]["count"] > 0
):
# Limit to the number of tabs to the number of dividers in the expansion
CardPlot.tabSetup(
tabNumber=Card.sets[card.cardset_tag]["count"]
@ -1932,6 +1946,13 @@ class DividerDrawer(object):
textTypeBack=options.text_back,
stackHeight=card.getStackHeight(options.thickness),
)
if card.isExpansion() and options.full_expansion_dividers:
# Fix up the item to have a full tab with text centred
item.tabWidth = cardWidth
item.tabNumber = 1
item.tabOffset = 0
if (
options.flip
and (options.tab_number == 2)

View File

@ -344,7 +344,13 @@ def parse_opts(cmdline_args=None):
"--centre-expansion-dividers",
action="store_true",
dest="centre_expansion_dividers",
help="Centre the tabs on expansion dividers.",
help="Centre the tabs on expansion dividers (same width as dividers.)",
)
group_expansion.add_argument(
"--full-expansion-dividers",
action="store_true",
dest="full_expansion_dividers",
help="Full width expansion dividers.",
)
group_expansion.add_argument(
"--expansion-reset-tabs",
@ -589,6 +595,20 @@ def parse_opts(cmdline_args=None):
default=0.1,
help="Width of lines for card outlines and crop marks.",
)
group_printing.add_argument(
"--front-offset",
type=float,
dest="front_offset",
default=0,
help="Front page horizontal offset points to shift to the right. Only needed for some printers.",
)
group_printing.add_argument(
"--front-offset-height",
type=float,
dest="front_offset_height",
default=0,
help="Front page vertical offset points to shift upward. Only needed for some printers.",
)
group_printing.add_argument(
"--back-offset",
type=float,