search function added
This commit is contained in:
parent
5297fd2c5a
commit
f9b62fc805
26
IFPass.py
26
IFPass.py
@ -234,13 +234,14 @@ def printcard(cartefilename):
|
|||||||
subprocess.Popen('"' + AcrobatReader + '"' + ' /h /n /t ' + cartefilename + ' '+ printername, shell=False)
|
subprocess.Popen('"' + AcrobatReader + '"' + ' /h /n /t ' + cartefilename + ' '+ printername, shell=False)
|
||||||
|
|
||||||
|
|
||||||
while True:
|
while "The program is running":
|
||||||
print('1 - Nouveau membre', '2 - Rechercher un membre', '3 - Quitter', sep='\n')
|
print('1 - Nouveau membre', '2 - Rechercher un membre', '3 - Quitter', sep='\n')
|
||||||
choix = input('Choix : ')
|
choix = input('Choix : ')
|
||||||
|
IFPassdir, printername, AcrobatReader, clientsfile, clientsbkpfile, imgdir, pdftemplate, pngtemplate, fonttemplate = initialisation()
|
||||||
|
init() # Initialisation of colorama
|
||||||
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')
|
||||||
init()
|
|
||||||
f = Figlet(font='big')
|
f = Figlet(font='big')
|
||||||
print(colored(f.renderText('IFPass'), 'cyan', attrs=['bold']))
|
print(colored(f.renderText('IFPass'), 'cyan', attrs=['bold']))
|
||||||
print('Version : ', version)
|
print('Version : ', version)
|
||||||
@ -274,7 +275,6 @@ while True:
|
|||||||
|
|
||||||
if correct:
|
if correct:
|
||||||
os.system('cls')
|
os.system('cls')
|
||||||
IFPassdir, printername, AcrobatReader, clientsfile, clientsbkpfile, imgdir, pdftemplate, pngtemplate, fonttemplate = initialisation()
|
|
||||||
if version != 'devnocam':
|
if version != 'devnocam':
|
||||||
picture = getpic()
|
picture = getpic()
|
||||||
clientID = getclientID()
|
clientID = getclientID()
|
||||||
@ -291,12 +291,20 @@ while True:
|
|||||||
with open(clientsfile, 'r', newline='', encoding='utf-8') as csvfile:
|
with open(clientsfile, 'r', newline='', encoding='utf-8') as csvfile:
|
||||||
results = []
|
results = []
|
||||||
for line in csvfile.readlines():
|
for line in csvfile.readlines():
|
||||||
resfirstname = line.split(';')[1].lower()
|
resfirstname = line.split(';')[1]
|
||||||
ressurname = line.split(';')[2].lower()
|
resfirstnamemin = resfirstname.lower()
|
||||||
|
ressurname = line.split(';')[2]
|
||||||
|
ressurnamemin = ressurname.lower()
|
||||||
resnumber = line.split(';')[3]
|
resnumber = line.split(';')[3]
|
||||||
if research in (ressurname or resfirstname):
|
if any(research in data for data in [resfirstnamemin, ressurnamemin, resnumber]):
|
||||||
results.append([resfirstname, ressurname, resnumber])
|
results.append((resfirstname, ressurname, resnumber))
|
||||||
print(results)
|
if results:
|
||||||
|
print('Prénom', 'Nom', '"Numéro de carte"')
|
||||||
|
|
||||||
|
for result in results:
|
||||||
|
print(result[0], result[1], result[2])
|
||||||
|
else:
|
||||||
|
print(colored("Aucun membre n'a été trouvé.", 'red', attrs=['bold']))
|
||||||
|
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
print('Le fichier client est inexistant.')
|
print('Le fichier client est inexistant.')
|
||||||
@ -306,4 +314,4 @@ while True:
|
|||||||
|
|
||||||
else:
|
else:
|
||||||
os.system('cls')
|
os.system('cls')
|
||||||
print('Choix incorrect !')
|
print(colored('Choix incorrect !', 'red', attrs=['bold']))
|
||||||
|
Loading…
Reference in New Issue
Block a user