Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
CardPlot.cardWidth = cardWidth if cardWidth is not None else CardPlot.cardWidth
CardPlot.cardHeight = cardHeight if cardHeight is not None else CardPlot.cardHeight
CardPlot.tabWidth = tabWidth if tabWidth is not None else CardPlot.tabWidth
CardPlot.tabHeight = tabHeight if tabHeight is not None else CardPlot.tabHeight
CardPlot.lineType = lineType if lineType is not None else CardPlot.lineType
CardPlot.tabStartSide = start if start is not None else CardPlot.tabStartSide
CardPlot.tabSerpentine = serpentine if serpentine is not None else CardPlot.tabSerpentine
CardPlot.wrapper = wrapper if wrapper is not None else CardPlot.wrapper
# LEFT tabs RIGHT
# +---+ +---+ +---+ +---+ +---+
# | 1 | | 2 | | 3 | |...| | N | Note: tabNumber = N, N >=1, 0 is for centred tabs
# + +-+ +-+ +-+ +-+ +
# Setup first tab as well as starting point and direction of increment for tabs.
if CardPlot.tabStartSide == CardPlot.RIGHT:
CardPlot.tabStart = CardPlot.tabNumber
CardPlot.tabIncrementStart = -1
elif CardPlot.tabStartSide == CardPlot.CENTRE:
# Get as close to centre as possible
CardPlot.tabStart = (CardPlot.tabNumber + 1) // 2
CardPlot.tabIncrementStart = 1
else:
# LEFT and anything else
CardPlot.tabStartSide = CardPlot.LEFT
CardPlot.tabStart = 1
CardPlot.tabIncrementStart = 1
if CardPlot.tabNumber == 1:
CardPlot.tabIncrementStart = 0
CardPlot.tabIncrement = CardPlot.tabIncrementStart
# +---+ +---+ +---+ +---+ +---+
# | 1 | | 2 | | 3 | |...| | N | Note: tabNumber = N, N >=1, 0 is for centred tabs
# + +-+ +-+ +-+ +-+ +
# Setup first tab as well as starting point and direction of increment for tabs.
if CardPlot.tabStartSide == CardPlot.RIGHT:
CardPlot.tabStart = CardPlot.tabNumber
CardPlot.tabIncrementStart = -1
elif CardPlot.tabStartSide == CardPlot.CENTRE:
# Get as close to centre as possible
CardPlot.tabStart = (CardPlot.tabNumber + 1) // 2
CardPlot.tabIncrementStart = 1
else:
# LEFT and anything else
CardPlot.tabStartSide = CardPlot.LEFT
CardPlot.tabStart = 1
CardPlot.tabIncrementStart = 1
if CardPlot.tabNumber == 1:
CardPlot.tabIncrementStart = 0
CardPlot.tabIncrement = CardPlot.tabIncrementStart
CardPlot.lineType = lineType if lineType is not None else CardPlot.lineType
CardPlot.tabStartSide = start if start is not None else CardPlot.tabStartSide
CardPlot.tabSerpentine = serpentine if serpentine is not None else CardPlot.tabSerpentine
CardPlot.wrapper = wrapper if wrapper is not None else CardPlot.wrapper
# LEFT tabs RIGHT
# +---+ +---+ +---+ +---+ +---+
# | 1 | | 2 | | 3 | |...| | N | Note: tabNumber = N, N >=1, 0 is for centred tabs
# + +-+ +-+ +-+ +-+ +
# Setup first tab as well as starting point and direction of increment for tabs.
if CardPlot.tabStartSide == CardPlot.RIGHT:
CardPlot.tabStart = CardPlot.tabNumber
CardPlot.tabIncrementStart = -1
elif CardPlot.tabStartSide == CardPlot.CENTRE:
# Get as close to centre as possible
CardPlot.tabStart = (CardPlot.tabNumber + 1) // 2
CardPlot.tabIncrementStart = 1
else:
# LEFT and anything else
CardPlot.tabStartSide = CardPlot.LEFT
CardPlot.tabStart = 1
CardPlot.tabIncrementStart = 1
if CardPlot.tabNumber == 1:
CardPlot.tabIncrementStart = 0
CardPlot.tabIncrement = CardPlot.tabIncrementStart
def tabRestart():
# Resets the tabIncrement to the starting value and returns the starting tabIndex number.
CardPlot.tabIncrement = CardPlot.tabIncrementStart
return CardPlot.tabStart
lastCardSet = card.cardset_tag
if self.wantCentreTab(card):
# If we want centred expansion cards, then force this divider to centre
thisTabIndex = 0
else:
thisTabIndex = nextTabIndex
item = CardPlot(card,
rotation=options.spin if options.spin != 0 else options.rotate,
tabIndex=thisTabIndex,
textTypeFront=options.text_front,
textTypeBack=options.text_back,
stackHeight=card.getStackHeight(options.thickness)
)
if options.flip and (options.tab_number == 2) and (thisTabIndex != CardPlot.tabStart):
item.flipFront2Back() # Instead of flipping the tab, flip the whole divider front to back
# Before moving on, setup the tab for the next item if this tab slot was used
if thisTabIndex == nextTabIndex:
nextTabIndex = item.nextTab(nextTabIndex) # already used, so move on to the next tab
items.append(item)
return items