Name now on to lines.

This commit is contained in:
Jordan ERNST 2019-02-20 17:17:45 +01:00
parent 831097aa75
commit d5c4ee5997

View File

@ -112,11 +112,11 @@ def get_fullname():
docteur = yes_or_no('Est-ce un Docteur ?')
if docteur:
titre = 'Dr.'
fullname = titre + ' ' + surname + ' ' + firstname
titrename = titre + ' ' + surname
else:
titre = ''
fullname = surname + ' ' + firstname
return titre, firstname, surname, fullname
titrename = surname
return titre, firstname, surname, titrename
def yes_or_no(question):
@ -137,7 +137,6 @@ def getclientID():
else:
clientID = str(int(lastID) + 1).zfill(10)
writeindb(clientID)
return clientID
@ -228,12 +227,13 @@ def fillcard(barcode):
draw = ImageDraw.Draw(im)
# Name embedding :
font = ImageFont.truetype(fonttemplate, 45)
draw.text((401, 310), fullname, fill=(0, 0, 0), font=font)
font = ImageFont.truetype(fonttemplate, 40)
draw.text((401, 296), titrename, fill=(0, 0, 0), font=font)
draw.text((401, 334), firstname, fill=(0, 0, 0), font=font)
# Date embedding :
font = ImageFont.truetype(fonttemplate, 30)
draw.text((401, 390), dateexp, fill=(0, 0, 0), font=font)
draw.text((401, 400), dateexp, fill=(0, 0, 0), font=font)
# ID embedding :
font = ImageFont.truetype('arial.ttf', 30)
@ -248,6 +248,7 @@ def fillcard(barcode):
# Create PDF :
im = im.convert("RGB")
im.save(imgdir + clientID + '_Front.pdf', 'PDF', resolution=299.0, quality=98)
writeindb(clientID)
print(colored('[OK]', 'green'))
@ -312,27 +313,41 @@ def membersearch():
print(colored('Choix invalide ! Veillez bien à sélectionner le numéro de la colonne "Choix"', 'red', attrs=['bold']))
os.system('cls')
print("Titre : ", colored(member[0], 'green'))
print("Prénom : ", colored(member[1], 'green'))
print("Nom : ", colored(member[2], 'green'))
print("Numéro de carte : ", colored(member[3], 'green'))
print("Date d'inscription :", member[4])
print("Date d'expiration : ", member[5])
dateexp = datetime.strptime(member[5], '%d/%m/%Y').date()
diff = (dateexp - date.today()).days
if diff > 0:
print(colored(f"L'abonnement est encore valable {diff} jours.", 'green', attrs=['bold']))
elif diff < 0:
print(colored("L'abonnement est expiré depuis {abs(diff)} jours.", 'red', attrs=['bold'])) # abs() to remove minus sign
elif diff == 0:
print(colored("Il s'agit du dernier jour de l'abonnement, il expirera demain.", 'yellow', attrs=['bold']))
while 'Choix incorect':
print("Titre : ", colored(member[0], 'green'))
print("Prénom : ", colored(member[1], 'green'))
print("Nom : ", colored(member[2], 'green'))
print("Numéro de carte : ", colored(member[3], 'green'))
print("Date d'inscription :", member[4])
print("Date d'expiration : ", member[5])
dateexp = datetime.strptime(member[5], '%d/%m/%Y').date()
diff = (dateexp - date.today()).days
if diff > 0:
print(colored(f"L'abonnement est encore valable {diff} jours.", 'green', attrs=['bold']))
elif diff < 0:
print(colored("L'abonnement est expiré depuis {abs(diff)} jours.", 'red', attrs=['bold'])) # abs() to remove minus sign
elif diff == 0:
print(colored("Il s'agit du dernier jour de l'abonnement, il expirera demain.", 'yellow', attrs=['bold']))
print('\n1 - Modifier', "2 - Renouveller l'abonnement", '3 - Menu principal', sep='\n')
choix = input('Choix : ')
if choix == '1':
print(1)
elif choix == '2':
print(2)
elif choix == '3':
return
else:
os.system('cls')
print(colored('Choix incorrect !\n', 'red', attrs=['bold']))
else:
print(colored("Aucun membre n'a été trouvé.", 'red', attrs=['bold']))
os.system("pause")
def main():
global titre, firstname, surname, fullname, dateinsc, dateexp, clientID, clientsfile, IFPassDBdir, clientsfile, imgdir, clientsbkpfile, templatesdir, pngtemplate, fonttemplate, picture, pdftemplate, printername, AcrobatReader
global titre, firstname, surname, titrename, 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, templatesdir, pdftemplate, pngtemplate, fonttemplate = initialisation()
@ -350,7 +365,7 @@ def main():
if choix == '1':
while "the informations are incorrect": # Loop Filling informations
os.system('cls')
titre, firstname, surname, fullname = get_fullname()
titre, firstname, surname, titrename = get_fullname()
dateinsc = date.today()
dateexp = dateinsc + timedelta(days=365)
@ -391,7 +406,6 @@ def main():
elif choix == '2':
os.system('cls')
membersearch()
os.system("pause")
elif choix == '3':
sys.exit()