Fixed templates move

This commit is contained in:
Jordan ERNST 2019-02-07 16:20:08 +01:00
parent d77465265c
commit e57800daa2

View File

@ -39,7 +39,6 @@ def initialisation():
conf['DEFAULT'] = {'IFPassDBdir': IFPassDBdir, 'printername': printername, 'AcrobatReader': AcrobatReader}
with open(config, 'w') as configfile:
conf.write(configfile)
move('Templates', IFPassDBdir)
else:
conf.read(config)
IFPassDBdir = conf['DEFAULT']['IFPassDBdir']
@ -49,9 +48,10 @@ def initialisation():
clientsfile = os.path.join(IFPassDBdir, 'Clients_IFPass.csv')
clientsbkpfile = os.path.join(IFPassDBdir, 'Clients_IFPass_backup.csv')
imgdir = os.path.join(IFPassDBdir, 'Cartes')
pdftemplate = os.path.join(IFPassDBdir, 'Templates', 'IFPass_PDF_Template.pdf')
pngtemplate = os.path.join(IFPassDBdir, 'Templates', 'IFPass_PNG_Template.png')
fonttemplate = os.path.join(IFPassDBdir, 'Templates', 'Roboto-Bold.ttf')
templatesdir = os.path.join(IFPassDBdir, 'Templates')
pdftemplate = os.path.join(templatesdir, 'Templates', 'IFPass_PDF_Template.pdf')
pngtemplate = os.path.join(templatesdir, 'Templates', 'IFPass_PNG_Template.png')
fonttemplate = os.path.join(templatesdir, 'Templates', 'Roboto-Bold.ttf')
if not os.path.exists(imgdir): # Cartes dir creation if it doesn't exist
os.makedirs(imgdir)
@ -59,6 +59,9 @@ def initialisation():
with open(clientsfile, 'w', newline='', encoding='utf-8') as csvfile:
writer = csv.writer(csvfile, delimiter=';')
writer.writerow(['Titre', 'Prénom', 'Nom', 'Numéro de client', "Date d'inscription", "Date d'expiration"])
if not os.path.exists(templatesdir):
move('Templates', IFPassDBdir)
return IFPassDBdir, printername, AcrobatReader, clientsfile, clientsbkpfile, imgdir, pdftemplate, pngtemplate, fonttemplate