From 6a21a3541a91b831e5cd2ed2bae4282410bc637c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?tr=C3=A9meur?= Date: Wed, 6 Nov 2024 23:33:39 +0000 Subject: [PATCH] Move portfolios to log --- README.org | 13 +-- build/style.css | 7 ++ collectinggen.py | 3 +- indexgen.py | 2 +- log-template.py | 1 + loggen.py | 179 +++++++++++++++++++++--------------------- portfoliosgen.py | 2 +- skel.py | 2 +- tcgcore.py | 38 ++++----- variables-template.py | 1 - 10 files changed, 125 insertions(+), 123 deletions(-) diff --git a/README.org b/README.org index 68ded3b..77a723a 100644 --- a/README.org +++ b/README.org @@ -24,9 +24,9 @@ Python scripts to generate a mobile-friendly static site for tracking tcg cards - =tradepost=: URL of your trade post on Dreamwidth - =faves=: a list of cards to showcase on the index page - =headerbackground=: an HTML colour to display behind your header image and set as a theme colour - - =british=: True if you want “grey” to display on the site, False if you want “gray” + - =british=: =True= if you want “grey” to display on the site, =False= if you want “gray” - =collectthreshold=: minimum number of owned cards for putting a deck in the “collecting” category - - =keepsig=: True if you always want to keep one copy of your signature, False if you want to make them all available for trading + - =keepsig=: =True= if you always want to keep one copy of your signature, =False= if you want to make them all available for trading - =tradestatement=: statement to place on your trading page - =maxmastered=: maximum number of most recently mastered decks to show on the index page - Run the following: @@ -39,9 +39,10 @@ Python scripts to generate a mobile-friendly static site for tracking tcg cards - Add level images manually to =build/assets/levels/= - Add custom CSS to =build/user.css= *** Updating and building -- For each transaction, add a dictionary ={}= to the =log= list like in the example (removing any of ="received"=, ="lost"=, ="crayons"= that aren’t relevant). +- For each transaction, add a dictionary ={}= to the =log= list like in the example (removing any of ="received"=, ="lost"=, ="crayons"=, ="decks"= that aren’t relevant). - Run =./build.sh= in this directory to download the relevant card images and then upload everything to the server. ** Currently unaccounted for -- Portfolios -- Duplicates -- Masteries +- Duplicates (should be fine but not checked) +- Coupons +- Card search +- Date to level – needs redone diff --git a/build/style.css b/build/style.css index 870fa33..d0d742c 100644 --- a/build/style.css +++ b/build/style.css @@ -167,6 +167,8 @@ p#masteredcarousel img { /* portfolios */ a:has(div.foliocase) { text-decoration: none; + width: 230px; + display: block; } div.foliocase { @@ -196,6 +198,11 @@ table.portfolio tr:last-of-type { text-align: right; } +table.portfolio a { + color: unset; + text-decoration: none; +} + table.portfolio.palette { background: url("/assets/portfolio/palette.png"); background-repeat: no-repeat; diff --git a/collectinggen.py b/collectinggen.py index ca9b0f4..8dbda25 100644 --- a/collectinggen.py +++ b/collectinggen.py @@ -34,8 +34,7 @@ def collectinggen(colour=False): elif deck in variables.medpriority: medpriority.append(deck) else: - if tcgcore.collecting(deck): - lowpriority.append(deck) + lowpriority.append(deck) content.write(tcgcore.filterwrite("collecting",colour)) if len(highpriority) > 0: content.write("
\n

High priority

\n") diff --git a/indexgen.py b/indexgen.py index b8c1b1f..fd2096f 100644 --- a/indexgen.py +++ b/indexgen.py @@ -226,7 +226,7 @@ def indexgen(): if sketch > 19: content.write("" + str(int(sketch / 20)) + " completed\n") content.write("\n\n") - if len(variables.portfolios) > 0: + if len(tcgcore.getpalettes()) + len(tcgcore.getmonochrome()) > 0: content.write("\n
\n") if len(tcgcore.getpalettes()) > 0: content.write(tcgcore.portfoliogen(tcgcore.getpalettes()[-1],"palette",len(tcgcore.getpalettes()))) diff --git a/log-template.py b/log-template.py index 20bcd52..b7e7658 100644 --- a/log-template.py +++ b/log-template.py @@ -7,5 +7,6 @@ log = [ "received":["card01","card02"], "lost":["card03","card04"], "crayons":{"red":1,"orange":2,"yellow":-3} + "decks":["deck1","deck2","deck3","deck4","deck5","deck6","deck7","deck8"] # only if "event":"portfolio" } ] diff --git a/loggen.py b/loggen.py index a4c3bcb..2c761e8 100644 --- a/loggen.py +++ b/loggen.py @@ -27,100 +27,101 @@ def loggen(): content.write("

log

\n") thelog = log.log[::-1] for event in thelog: - content.write("

" + event["date"].strftime("%Y-%m-%d") + " [" + event["event"] + "]: ") - try: - if event["received"]: - content.write("Received ") - receivedlist = sorted(event["received"]) - position = 1 - for card in receivedlist: - content.write(tcgcore.cardtext(card)) - if len(receivedlist) != position: - content.write(", ") - position += 1 - content.write(".") - try: - if event["lost"]: - content.write(" ") - except: + if event["event"] != "portfolio": + content.write("

" + event["date"].strftime("%Y-%m-%d") + " [" + event["event"] + "]: ") + try: + if event["received"]: + content.write("Received ") + receivedlist = sorted(event["received"]) + position = 1 + for card in receivedlist: + content.write(tcgcore.cardtext(card)) + if len(receivedlist) != position: + content.write(", ") + position += 1 + content.write(".") + try: + if event["lost"]: + content.write(" ") + except: + try: + if event["crayons"]: + content.write(" ") + except: + pass + except: + pass + try: + if event["lost"]: + content.write("Lost ") + lostlist = sorted(event["lost"]) + position = 1 + for card in lostlist: + content.write(tcgcore.cardtext(card)) + if len(lostlist) != position: + content.write(", ") + position += 1 + content.write(".") try: if event["crayons"]: content.write(" ") except: pass - except: - pass - try: - if event["lost"]: - content.write("Lost ") - lostlist = sorted(event["lost"]) - position = 1 - for card in lostlist: - content.write(tcgcore.cardtext(card)) - if len(lostlist) != position: - content.write(", ") - position += 1 - content.write(".") - try: - if event["crayons"]: - content.write(" ") - except: - pass - except: - pass - try: - if event["crayons"]: - content.write("Crayons: ") - try: - content.write(crayonlog("red",event)) - if list(event["crayons"])[-1] != "red": - content.write(", ") - except: - pass - try: - content.write(crayonlog("orange",event)) - if list(event["crayons"])[-1] != "orange": - content.write(", ") - except: - pass - try: - content.write(crayonlog("yellow",event)) - if list(event["crayons"])[-1] != "yellow": - content.write(", ") - except: - pass - try: - content.write(crayonlog("green",event)) - if list(event["crayons"])[-1] != "green": - content.write(", ") - except: - pass - try: - content.write(crayonlog("blue",event)) - if list(event["crayons"])[-1] != "blue": - content.write(", ") - except: - pass - try: - content.write(crayonlog("purple",event)) - if list(event["crayons"])[-1] != "purple": - content.write(", ") - except: - pass - try: - content.write(crayonlog("brown",event)) - if list(event["crayons"])[-1] != "brown": - content.write(", ") - except: - pass - try: - content.write(crayonlog("gray",event)) - except: - pass - content.write(".") - except: - pass - content.write("

\n") + except: + pass + try: + if event["crayons"]: + content.write("Crayons: ") + try: + content.write(crayonlog("red",event)) + if list(event["crayons"])[-1] != "red": + content.write(", ") + except: + pass + try: + content.write(crayonlog("orange",event)) + if list(event["crayons"])[-1] != "orange": + content.write(", ") + except: + pass + try: + content.write(crayonlog("yellow",event)) + if list(event["crayons"])[-1] != "yellow": + content.write(", ") + except: + pass + try: + content.write(crayonlog("green",event)) + if list(event["crayons"])[-1] != "green": + content.write(", ") + except: + pass + try: + content.write(crayonlog("blue",event)) + if list(event["crayons"])[-1] != "blue": + content.write(", ") + except: + pass + try: + content.write(crayonlog("purple",event)) + if list(event["crayons"])[-1] != "purple": + content.write(", ") + except: + pass + try: + content.write(crayonlog("brown",event)) + if list(event["crayons"])[-1] != "brown": + content.write(", ") + except: + pass + try: + content.write(crayonlog("gray",event)) + except: + pass + content.write(".") + except: + pass + content.write("

\n") content.close() skel.footerwrite(thefile) diff --git a/portfoliosgen.py b/portfoliosgen.py index 67e6435..8555587 100644 --- a/portfoliosgen.py +++ b/portfoliosgen.py @@ -15,7 +15,7 @@ def portfoliosgen(colour=False): skel.headerwrite(thefile,"portfolios") content = open(thefile,"a") content.write("

portfolios

\n") - if len(variables.portfolios) > 0: + if len(tcgcore.getpalettes()) + len(tcgcore.getmonochrome()) > 0: if len(tcgcore.getpalettes()) > 0: content.write("
\n") portnumber = 1 diff --git a/skel.py b/skel.py index 1351eb9..e8e056e 100644 --- a/skel.py +++ b/skel.py @@ -2,7 +2,7 @@ import variables def headerwrite(thefile,pagename): header = open(thefile,"a") - header.write("\n\n \n \n \n \n \n \n " + variables.name + "’s card collection :: " + pagename + "\n \n \n \n