Catch exception when Templates not available.
This commit is contained in:
parent
07ec96d33a
commit
831097aa75
16
IFPass.py
16
IFPass.py
@ -82,7 +82,7 @@ def initialisation():
|
|||||||
if not os.path.exists(templatesdir):
|
if not os.path.exists(templatesdir):
|
||||||
move('Templates', IFPassDBdir)
|
move('Templates', IFPassDBdir)
|
||||||
|
|
||||||
return IFPassDBdir, printername, AcrobatReader, clientsfile, clientsbkpfile, imgdir, pdftemplate, pngtemplate, fonttemplate
|
return IFPassDBdir, printername, AcrobatReader, clientsfile, clientsbkpfile, imgdir, templatesdir, pdftemplate, pngtemplate, fonttemplate
|
||||||
|
|
||||||
|
|
||||||
def get_fullname():
|
def get_fullname():
|
||||||
@ -216,7 +216,15 @@ def bkpdb():
|
|||||||
|
|
||||||
def fillcard(barcode):
|
def fillcard(barcode):
|
||||||
print("Création de la carte avec les informations...", end='')
|
print("Création de la carte avec les informations...", end='')
|
||||||
im = Image.open(pngtemplate)
|
try:
|
||||||
|
im = Image.open(pngtemplate)
|
||||||
|
except FileNotFoundError:
|
||||||
|
os.system('cls')
|
||||||
|
print(colored('Vous avez besoin de 2 fichiers dans le dossier Templates pour générer des cartes :', 'red'))
|
||||||
|
print(templatesdir + '\\IFPass_PDF_Template.pdf : Modèle de la carte (recto et verso)')
|
||||||
|
print(templatesdir + '\\IFPass_PNG_Template.png : La face avant de la carte (celle à remplir)')
|
||||||
|
os.system("pause")
|
||||||
|
sys.exit()
|
||||||
draw = ImageDraw.Draw(im)
|
draw = ImageDraw.Draw(im)
|
||||||
|
|
||||||
# Name embedding :
|
# Name embedding :
|
||||||
@ -324,10 +332,10 @@ def membersearch():
|
|||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
global titre, firstname, surname, fullname, dateinsc, dateexp, clientID, clientsfile, IFPassDBdir, clientsfile, imgdir, clientsbkpfile, pngtemplate, fonttemplate, picture, pdftemplate, printername, AcrobatReader
|
global titre, firstname, surname, fullname, dateinsc, dateexp, clientID, clientsfile, IFPassDBdir, clientsfile, imgdir, clientsbkpfile, templatesdir, pngtemplate, fonttemplate, picture, pdftemplate, printername, AcrobatReader
|
||||||
while "The program is running":
|
while "The program is running":
|
||||||
init() # Initialisation of colorama
|
init() # Initialisation of colorama
|
||||||
IFPassDBdir, printername, AcrobatReader, clientsfile, clientsbkpfile, imgdir, pdftemplate, pngtemplate, fonttemplate = initialisation()
|
IFPassDBdir, printername, AcrobatReader, clientsfile, clientsbkpfile, imgdir, templatesdir, pdftemplate, pngtemplate, fonttemplate = initialisation()
|
||||||
|
|
||||||
os.system('cls')
|
os.system('cls')
|
||||||
f = Figlet(font='big')
|
f = Figlet(font='big')
|
||||||
|
Loading…
Reference in New Issue
Block a user