You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tcg/portfoliosgen.py

38 lines
1.4 KiB
Python

3 weeks ago
import datetime,os
import log,skel,tcgcore,variables
def portfoliosgen(colour=False):
if not os.path.isdir("build/portfolios"):
os.mkdir("build/portfolios")
if colour:
if not os.path.isdir("build/portfolios/" + colour):
os.mkdir("build/portfolios/" + colour)
thefile = "build/portfolios/" + colour + "/index.html"
else:
thefile = "build/portfolios/index.html"
if os.path.exists(thefile):
os.remove(thefile)
skel.headerwrite(thefile,"portfolios")
content = open(thefile,"a")
content.write("<h1>portfolios</h1>\n")
if len(tcgcore.getpalettes()) + len(tcgcore.getmonochrome()) > 0:
3 weeks ago
if len(tcgcore.getpalettes()) > 0:
content.write("<div class=\"foliocase\">\n")
portnumber = 1
for portfolio in tcgcore.getpalettes():
content.write(tcgcore.portfoliogen(portfolio,"palette",portnumber))
portnumber += 1
content.write("</div>\n")
if len(tcgcore.getmonochrome()) > 0:
content.write("<div class=\"foliocase\">\n")
portnumber = 1
for portfolio in tcgcore.getmonochrome():
content.write(tcgcore.portfoliogen(portfolio,"monochrome",portnumber))
portnumber += 1
content.write("</div>\n")
content.close()
skel.footerwrite(thefile)
if __name__ == "__main__":
portfoliosgen()