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("
portfolios
\n")
if len(variables.portfolios) > 0:
if len(tcgcore.getpalettes()) > 0:
content.write("\n")
portnumber = 1
for portfolio in tcgcore.getpalettes():
content.write(tcgcore.portfoliogen(portfolio,"palette",portnumber))
portnumber += 1
content.write("
\n")
if len(tcgcore.getmonochrome()) > 0:
content.write("\n")
portnumber = 1
for portfolio in tcgcore.getmonochrome():
content.write(tcgcore.portfoliogen(portfolio,"monochrome",portnumber))
portnumber += 1
content.write("
\n")
content.close()
skel.footerwrite(thefile)
if __name__ == "__main__":
portfoliosgen()