parent
5d3fb7589e
commit
48c6ee0def
@ -13,7 +13,7 @@ from draw import DividerDrawer
|
|||||||
LOCATION_CHOICES = ["tab", "body-top", "hide"]
|
LOCATION_CHOICES = ["tab", "body-top", "hide"]
|
||||||
NAME_ALIGN_CHOICES = ["left", "right", "centre", "edge"]
|
NAME_ALIGN_CHOICES = ["left", "right", "centre", "edge"]
|
||||||
TAB_SIDE_CHOICES = ["left", "right", "left-alternate", "right-alternate",
|
TAB_SIDE_CHOICES = ["left", "right", "left-alternate", "right-alternate",
|
||||||
"full"]
|
"centre", "full"]
|
||||||
TEXT_CHOICES = ["card", "rules", "blank"]
|
TEXT_CHOICES = ["card", "rules", "blank"]
|
||||||
|
|
||||||
|
|
||||||
@ -101,6 +101,7 @@ def parse_opts(arglist):
|
|||||||
" left/right forces all tabs to left/right side;"
|
" left/right forces all tabs to left/right side;"
|
||||||
" left-alternate will start on the left and then toggle between left and right for the tabs;"
|
" left-alternate will start on the left and then toggle between left and right for the tabs;"
|
||||||
" right-alternate will start on the right and then toggle between right and left for the tabs;" # noqa
|
" right-alternate will start on the right and then toggle between right and left for the tabs;" # noqa
|
||||||
|
" centre will force all label tabs to the centre;"
|
||||||
" full will force all label tabs to be full width of the divider"
|
" full will force all label tabs to be full width of the divider"
|
||||||
" default:right-alternate")
|
" default:right-alternate")
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
|
|||||||
@ -42,7 +42,10 @@ class DividerDrawer(object):
|
|||||||
self.fontNameBold = 'Times-Bold'
|
self.fontNameBold = 'Times-Bold'
|
||||||
self.fontNameOblique = 'Times-Oblique'
|
self.fontNameOblique = 'Times-Oblique'
|
||||||
|
|
||||||
def getOutline(self, card, isExpansionDivider=False):
|
def wantCentreTab(self,card):
|
||||||
|
return (card.isExpansion() and self.options.centre_expansion_dividers) or self.options.tab_side == "centre"
|
||||||
|
|
||||||
|
def getOutline(self, card):
|
||||||
|
|
||||||
dividerWidth = self.options.dividerWidth
|
dividerWidth = self.options.dividerWidth
|
||||||
dividerHeight = self.options.dividerHeight
|
dividerHeight = self.options.dividerHeight
|
||||||
@ -55,7 +58,7 @@ class DividerDrawer(object):
|
|||||||
theTabHeight = dividerHeight - dividerBaseHeight
|
theTabHeight = dividerHeight - dividerBaseHeight
|
||||||
theTabWidth = self.options.labelWidth
|
theTabWidth = self.options.labelWidth
|
||||||
|
|
||||||
if isExpansionDivider:
|
if self.wantCentreTab(card):
|
||||||
side_2_tab = (dividerWidth - theTabWidth) / 2
|
side_2_tab = (dividerWidth - theTabWidth) / 2
|
||||||
else:
|
else:
|
||||||
side_2_tab = 0
|
side_2_tab = 0
|
||||||
@ -231,8 +234,7 @@ class DividerDrawer(object):
|
|||||||
x,
|
x,
|
||||||
y,
|
y,
|
||||||
rightSide,
|
rightSide,
|
||||||
isBack=False,
|
isBack=False):
|
||||||
isExpansionDivider=False):
|
|
||||||
# draw outline or cropmarks
|
# draw outline or cropmarks
|
||||||
self.canvas.saveState()
|
self.canvas.saveState()
|
||||||
self.canvas.setLineWidth(self.options.linewidth)
|
self.canvas.setLineWidth(self.options.linewidth)
|
||||||
@ -244,9 +246,6 @@ class DividerDrawer(object):
|
|||||||
if not self.options.cropmarks and not isBack:
|
if not self.options.cropmarks and not isBack:
|
||||||
# don't draw outline on back, in case lines don't line up with
|
# don't draw outline on back, in case lines don't line up with
|
||||||
# front
|
# front
|
||||||
if isExpansionDivider and self.options.centre_expansion_dividers:
|
|
||||||
self.getOutline(card, isExpansionDivider=True)
|
|
||||||
else:
|
|
||||||
self.getOutline(card)
|
self.getOutline(card)
|
||||||
|
|
||||||
elif self.options.cropmarks and not self.options.wrapper:
|
elif self.options.cropmarks and not self.options.wrapper:
|
||||||
@ -414,7 +413,7 @@ class DividerDrawer(object):
|
|||||||
def drawTab(self, card, rightSide, wrapper="no"):
|
def drawTab(self, card, rightSide, wrapper="no"):
|
||||||
# draw tab flap
|
# draw tab flap
|
||||||
self.canvas.saveState()
|
self.canvas.saveState()
|
||||||
if card.isExpansion() and self.options.centre_expansion_dividers:
|
if self.wantCentreTab(card):
|
||||||
translate_x = self.options.dividerWidth / 2 - self.options.labelWidth / 2
|
translate_x = self.options.dividerWidth / 2 - self.options.labelWidth / 2
|
||||||
translate_y = self.options.dividerHeight - self.options.labelHeight
|
translate_y = self.options.dividerHeight - self.options.labelHeight
|
||||||
elif not rightSide:
|
elif not rightSide:
|
||||||
@ -426,7 +425,7 @@ class DividerDrawer(object):
|
|||||||
|
|
||||||
if wrapper == "back":
|
if wrapper == "back":
|
||||||
translate_y = self.options.labelHeight
|
translate_y = self.options.labelHeight
|
||||||
if card.isExpansion() and self.options.centre_expansion_dividers:
|
if self.wantCentreTab(card):
|
||||||
translate_x = self.options.dividerWidth / 2 + self.options.labelWidth / 2
|
translate_x = self.options.dividerWidth / 2 + self.options.labelWidth / 2
|
||||||
elif not rightSide:
|
elif not rightSide:
|
||||||
translate_x = self.options.dividerWidth
|
translate_x = self.options.dividerWidth
|
||||||
@ -736,8 +735,7 @@ class DividerDrawer(object):
|
|||||||
|
|
||||||
# actual drawing
|
# actual drawing
|
||||||
if not self.options.tabs_only:
|
if not self.options.tabs_only:
|
||||||
self.drawOutline(card, x, y, rightSide, isBack,
|
self.drawOutline(card, x, y, rightSide, isBack)
|
||||||
card.getType().getTypeNames() == ('Expansion', ))
|
|
||||||
|
|
||||||
if self.options.wrapper:
|
if self.options.wrapper:
|
||||||
wrap = "front"
|
wrap = "front"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user