From 5f102abeca13dc8bdeef7b2adb1603393e54f697 Mon Sep 17 00:00:00 2001 From: Adam Goldsmith Date: Sat, 5 Aug 2017 13:55:43 -0400 Subject: [PATCH] Add makeDoubleSidedFace function --- SotMDeckBuilder.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/SotMDeckBuilder.py b/SotMDeckBuilder.py index 68cf2da..ae44df2 100755 --- a/SotMDeckBuilder.py +++ b/SotMDeckBuilder.py @@ -77,6 +77,11 @@ def makeFace(baseImage, baseX, cardNum, deckType, cardFile, card): fig = makeSVG(path, card) addCardToBase(fig, baseImage, baseX, cardNum) +def makeDoubleSidedFace(baseImage, baseX, cardNum, deckType, cardFile, + cardFront, cardBack): + makeFace(baseImage, baseX, cardNum, deckType, cardFile, cardFront) + makeFace(baseImage, baseX, cardNum + 1, deckType, cardFile, cardBack) + def makeFaces(deckJson, outfile): baseX = math.ceil(math.sqrt(len(deckJson['deck']) + len(deckJson['character']) * 2)) baseImage = etree.ElementTree( @@ -103,15 +108,13 @@ def makeFaces(deckJson, outfile): front["name"] = card["name"] back = card["back"] back["name"] = card["name"] - makeFace(baseImage, baseX, cardNum, deckType, "character.svg", front) - cardNum += 1 - makeFace(baseImage, baseX, cardNum, deckType, "character.svg", back) - cardNum += 1 + makeDoubleSidedFace(baseImage, baseX, cardNum, deckType, + "character.svg", front, back) + cardNum += 2 - makeFace(baseImage, baseX, cardNum, deckType, "instructions.svg", front) - cardNum += 1 - makeFace(baseImage, baseX, cardNum, deckType, "instructions.svg", back) - cardNum += 1 + makeDoubleSidedFace(baseImage, baseX, cardNum, deckType, + "instructions.svg", front, back) + cardNum += 2 # Make a card for each card