Merge branch 'dev'
This commit is contained in:
commit
ad748edc81
29
IFPass.py
29
IFPass.py
@ -45,7 +45,12 @@ def initialisation():
|
||||
else:
|
||||
acrinstalled = yes_or_no("Acrobat Reader est nécessaire pour imprimer les cartes. Est il installé ?")
|
||||
if acrinstalled:
|
||||
AcrobatReader = input(r"Quel est le chemin vers Acrobat Reader ? ( Ex : C:\Program Files (x86)\Adobe\Acrobat Reader DC\Reader\AcroRd32.exe) : ")
|
||||
while "Wrong path":
|
||||
AcrobatReader = input(r"Quel est le chemin vers Acrobat Reader ? ( Ex : C:\Program Files (x86)\Adobe\Acrobat Reader DC\Reader\AcroRd32.exe) : ")
|
||||
if os.path.exists(AcrobatReader):
|
||||
break
|
||||
else:
|
||||
print(colored('\nChemin invalide !', 'red'))
|
||||
else:
|
||||
print(colored('\nInstallez Acrobat Reader, puis relancez IFPass.', 'red'))
|
||||
os.system("pause")
|
||||
@ -64,9 +69,9 @@ def initialisation():
|
||||
clientsbkpfile = os.path.join(IFPassDBdir, 'Clients_IFPass_backup.csv')
|
||||
imgdir = os.path.join(IFPassDBdir, 'Cartes')
|
||||
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')
|
||||
pdftemplate = os.path.join(templatesdir, 'IFPass_PDF_Template.pdf')
|
||||
pngtemplate = os.path.join(templatesdir, 'IFPass_PNG_Template.png')
|
||||
fonttemplate = os.path.join(templatesdir, 'Roboto-Bold.ttf')
|
||||
|
||||
if not os.path.exists(imgdir): # Cartes dir creation if it doesn't exist
|
||||
os.makedirs(imgdir, 0o777)
|
||||
@ -77,7 +82,7 @@ def initialisation():
|
||||
if not os.path.exists(templatesdir):
|
||||
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():
|
||||
@ -211,7 +216,15 @@ def bkpdb():
|
||||
|
||||
def fillcard(barcode):
|
||||
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)
|
||||
|
||||
# Name embedding :
|
||||
@ -319,10 +332,10 @@ def membersearch():
|
||||
|
||||
|
||||
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":
|
||||
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')
|
||||
f = Figlet(font='big')
|
||||
|
Loading…
Reference in New Issue
Block a user