Add textareas and progress indicators

master
trémeur 5 days ago
parent c1d73d661f
commit 99ccff47c1

@ -1,13 +1,37 @@
import sys
import download,indexgen,collectinggen,ownedgen,wantedgen,loggen,levelsgen,tradegen,masteredgen,portfoliosgen,searchgen import download,indexgen,collectinggen,ownedgen,wantedgen,loggen,levelsgen,tradegen,masteredgen,portfoliosgen,searchgen
print("Checking for new decks … ",end="")
sys.stdout.flush()
download.getimg() download.getimg()
print("done\nBuilding index page …",end="")
sys.stdout.flush()
indexgen.indexgen() indexgen.indexgen()
print(" done\nBuilding collecting page …",end="")
sys.stdout.flush()
collectinggen.collectingall() collectinggen.collectingall()
print(" done\nBuilding owned page …",end="")
sys.stdout.flush()
ownedgen.ownedall() ownedgen.ownedall()
print(" done\nBuilding wanted page …",end="")
sys.stdout.flush()
wantedgen.wantedgen() wantedgen.wantedgen()
print(" done\nBuilding log page …",end="")
sys.stdout.flush()
loggen.loggen() loggen.loggen()
print(" done\nBuilding levels page …",end="")
sys.stdout.flush()
levelsgen.levelsgen() levelsgen.levelsgen()
print(" done\nBuilding trading page …",end="")
sys.stdout.flush()
tradegen.tradeall() tradegen.tradeall()
print(" done\nBuilding mastered page …",end="")
sys.stdout.flush()
masteredgen.masteredall() masteredgen.masteredall()
print(" done\nBuilding portfolios page …",end="")
sys.stdout.flush()
portfoliosgen.portfoliosgen() portfoliosgen.portfoliosgen()
print(" done\nBuilding search page …",end="")
sys.stdout.flush()
searchgen.searchgen() searchgen.searchgen()
print(" done")

@ -16,27 +16,27 @@ def tradegen(colour=False):
content = open(thefile,"a") content = open(thefile,"a")
content.write("<h1>available for trade</h1>\n") content.write("<h1>available for trade</h1>\n")
content.write(tcgcore.filterwrite("trade",colour,True)) content.write(tcgcore.filterwrite("trade",colour,True))
content.write("<p>")
if len(variables.tradestatement) > 0: if len(variables.tradestatement) > 0:
content.write(variables.tradestatement + " ") content.write(variables.tradestatement + " ")
content.write("Trade cards <a href=\"" + variables.tradepost + "\">here</a></p>\n<p>") content.write("Trade cards <a href=\"" + variables.tradepost + "\">here</a></p>\n<p>")
tradelist = []
previouscard = "" previouscard = ""
for card in tcgcore.ownedcards(): for card in tcgcore.ownedcards():
if card[0:4] != "sig_": if card[0:4] != "sig_":
if card == previouscard: if card == previouscard:
if colour: if colour:
if tcgcore.cardtype(card) == colour: if tcgcore.cardtype(card) == colour:
content.write(tcgcore.printcard(card)) tradelist.append(card)
else: else:
content.write(tcgcore.printcard(card)) tradelist.append(card)
else: else:
if not tcgcore.deckmastered(card[:-2]): if not tcgcore.deckmastered(card[:-2]):
if not tcgcore.collecting(card[:-2]): if not tcgcore.collecting(card[:-2]):
if colour: if colour:
if tcgcore.cardtype(card) == colour: if tcgcore.cardtype(card) == colour:
content.write(tcgcore.printcard(card)) tradelist.append(card)
else: else:
content.write(tcgcore.printcard(card)) tradelist.append(card)
previouscard = card previouscard = card
siglist = [] siglist = []
for card in tcgcore.ownedcards(): for card in tcgcore.ownedcards():
@ -47,10 +47,13 @@ def tradegen(colour=False):
if colour: if colour:
if colour == "sig": if colour == "sig":
for sig in siglist: for sig in siglist:
content.write(tcgcore.printcard(sig)) tradelist.append(sig)
else: else:
for sig in siglist: for sig in siglist:
content.write(tcgcore.printcard(sig)) tradelist.append(sig)
content.write("<textarea readonly>" + ", ".join(tradelist) + "</textarea>\n<p>")
for card in tradelist:
content.write(tcgcore.printcard(card))
content.write("</p>\n") content.write("</p>\n")
content.close() content.close()
skel.footerwrite(thefile) skel.footerwrite(thefile)

@ -33,7 +33,7 @@ def wantedgen():
elif tcgcore.priority(card[:-2]) == "low": elif tcgcore.priority(card[:-2]) == "low":
lowpriority.append(card) lowpriority.append(card)
if len(highpriority) > 0: if len(highpriority) > 0:
content.write("<p><b>High priority:</b> ") content.write("<h2>High priority</h2>\n<textarea readonly>" + ", ".join(highpriority) + "</textarea>\n<p>")
for card in highpriority: for card in highpriority:
content.write(tcgcore.cardtext(card)) content.write(tcgcore.cardtext(card))
if highpriority.index(card) == len(highpriority) - 1: if highpriority.index(card) == len(highpriority) - 1:
@ -42,7 +42,7 @@ def wantedgen():
content.write(", ") content.write(", ")
content.write("</p>\n") content.write("</p>\n")
if len(medpriority) > 0: if len(medpriority) > 0:
content.write("<p><b>Medium priority:</b> ") content.write("<h2>Medium priority</h2>\n<textarea readonly>" + ", ".join(medpriority) + "</textarea>\n<p>")
for card in medpriority: for card in medpriority:
content.write(tcgcore.cardtext(card)) content.write(tcgcore.cardtext(card))
if medpriority.index(card) == len(medpriority) - 1: if medpriority.index(card) == len(medpriority) - 1:
@ -51,7 +51,7 @@ def wantedgen():
content.write(", ") content.write(", ")
content.write("</p>\n") content.write("</p>\n")
if len(lowpriority) > 0: if len(lowpriority) > 0:
content.write("<p><b>Low priority:</b> ") content.write("<h2>Low priority</h2>\n<textarea readonly>" + ", ".join(lowpriority) + "</textarea>\n<p>")
for card in lowpriority: for card in lowpriority:
content.write(tcgcore.cardtext(card)) content.write(tcgcore.cardtext(card))
if lowpriority.index(card) == len(lowpriority) - 1: if lowpriority.index(card) == len(lowpriority) - 1:

Loading…
Cancel
Save