From e286f18542c84d05ac1a2031fb09f6a348b58946 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?tr=C3=A9meur?= Date: Tue, 5 Nov 2024 22:56:10 +0000 Subject: [PATCH] Fold lower priority decks --- build/style.css | 39 ++++++++++++++++++++++++++++++--------- collectinggen.py | 2 +- indexgen.py | 6 ++++-- tcgcore.py | 30 ++++++++++++++++++++++-------- 4 files changed, 57 insertions(+), 20 deletions(-) diff --git a/build/style.css b/build/style.css index 99cc27b..870fa33 100644 --- a/build/style.css +++ b/build/style.css @@ -65,47 +65,64 @@ table.decktable { border: 1px solid CanvasText; } -table.decktable.red th { +details.deckwrap { + border: 1px solid CanvasText; + width: 297px; + display: inline; +} + +details.deckwrap summary { + margin: 2px; + font-weight: bold; + text-align: center; + cursor: pointer; +} + +details.deckwrap table.decktable { + border: none; +} + +table.decktable.red th, details.deckwrap:has(.red) summary { background-color: red; color: black; } -table.decktable.orange th { +table.decktable.orange th, details.deckwrap:has(.orange) summary { background-color: orange; color: black; } -table.decktable.yellow th { +table.decktable.yellow th, details.deckwrap:has(.yellow) summary { background-color: yellow; color: black; } -table.decktable.green th { +table.decktable.green th, details.deckwrap:has(.green) summary { background-color: green; color: white; } -table.decktable.blue th { +table.decktable.blue th, details.deckwrap:has(.blue) summary { background-color: blue; color: white; } -table.decktable.purple th { +table.decktable.purple th, details.deckwrap:has(.purple) summary { background-color: purple; color: white; } -table.decktable.brown th { +table.decktable.brown th, details.deckwrap:has(.brown) summary { background-color: brown; color: white; } -table.decktable.gray th { +table.decktable.gray th, details.deckwrap:has(.gray) summary { background-color: gray; color: white; } -table.decktable.special th { +table.decktable.special th, details.deckwrap:has(.special) summary { background: linear-gradient(90deg, hsl(0, 100%, 70%), hsl(30, 100%, 70%), hsl(60, 100%, 70%), hsl(90, 100%, 70%), hsl(120, 100%, 70%), hsl(150, 100%, 70%), hsl(180, 100%, 70%), hsl(210, 100%, 70%), hsl(240, 100%, 70%), hsl(270, 100%, 70%), hsl(300, 100%, 70%), hsl(330, 100%, 70%), hsl(360, 100%, 70%)); color: black; } @@ -143,6 +160,10 @@ h2.collectingheader { background-color: Canvas; } +p#masteredcarousel img { + vertical-align: middle; +} + /* portfolios */ a:has(div.foliocase) { text-decoration: none; diff --git a/collectinggen.py b/collectinggen.py index 6db903e..ca9b0f4 100644 --- a/collectinggen.py +++ b/collectinggen.py @@ -40,7 +40,7 @@ def collectinggen(colour=False): if len(highpriority) > 0: content.write("
\n

High priority

\n") for deck in highpriority: - content.write(tcgcore.printdeck(deck)) + content.write(tcgcore.printdeck(deck,False)) content.write("
\n") if len(medpriority) > 0: content.write("
\n

Medium priority

\n") diff --git a/indexgen.py b/indexgen.py index 7917402..b8c1b1f 100644 --- a/indexgen.py +++ b/indexgen.py @@ -218,7 +218,7 @@ def indexgen(): if sketch % 20 < 10: content.write("0" + str(sketch % 20)) else: - content.write(sketch % 20) + content.write(str(sketch % 20)) content.write(".gif\">\n") if sketch > 19: content.write("\n") @@ -244,12 +244,14 @@ def indexgen(): mastereddecks.append({"name":deck,"date":tcgcore.datemastered(deck)}) mastereddecks = sorted(mastereddecks,key=lambda d: d["date"],reverse=True) if len(mastereddecks) > 0: - content.write("

mastered decks

\n

") + content.write("

mastered decks

\n

") masteredcount = 0 for deck in mastereddecks: if masteredcount < variables.maxmastered: content.write("") masteredcount += 1 + if len(mastereddecks) > variables.maxmastered: + content.write(" see all") content.write("

\n") sigs = [] for card in tcgcore.ownedcards(): diff --git a/tcgcore.py b/tcgcore.py index 99198e2..69f6f86 100644 --- a/tcgcore.py +++ b/tcgcore.py @@ -120,16 +120,28 @@ def printcard(card): cardid = card[-2:] return "" -def printdeck(deck): - deckstring = "\n" + deck + " [" + if deckmastered(deck): + deckstring += datemastered(deck).strftime("%Y-%m-%d") + else: + deckstring += str(len(deckcards(deck))) + "/20" + deckstring += "]\n" + else: + deckstring = "" + deckstring += "
\n\n \n \n \n\n\n" + deckstring += decktype + "\">\n" + if not fold: + deckstring += "\n \n \n \n\n" + deckstring += "\n" test = 1 while test < 21: if test % 5 == 1: @@ -149,6 +161,8 @@ def printdeck(deck): if deckmastered(deck): deckstring += " \n \n" deckstring += "\n
" + deck - if deckmastered(deck): - deckstring += " [" + datemastered(deck).strftime("%Y-%m-%d") + "]" - else: - deckstring += " [" + str(len(deckcards(deck))) + "/20]" - deckstring += "
" + deck + " [" + if deckmastered(deck): + deckstring += datemastered(deck).strftime("%Y-%m-%d") + else: + deckstring += str(len(deckcards(deck))) + "/20" + deckstring += "]
\n
\n" + if fold: + deckstring += "\n" return deckstring def filterwrite(page,colour=False,sigs=False):