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