Declared main() for packaging
This commit is contained in:
parent
36a4339172
commit
23b3543ba9
125
IFPass.py
125
IFPass.py
@ -28,6 +28,7 @@ config = 'IFPass.conf'
|
|||||||
|
|
||||||
|
|
||||||
def initialisation():
|
def initialisation():
|
||||||
|
global clientsfile, IFPassdir, clientsfile, clientID, imgdir, dateexp, titre, dateinsc, firstname, surname, clientsbkpfile, pngtemplate, fonttemplate, fullname, picture, pdftemplate, printername, AcrobatReader
|
||||||
conf = configparser.ConfigParser()
|
conf = configparser.ConfigParser()
|
||||||
conf.optionxform = str # For case sensitive config file
|
conf.optionxform = str # For case sensitive config file
|
||||||
|
|
||||||
@ -286,68 +287,70 @@ def membersearch():
|
|||||||
print(colored("Aucun membre n'a été trouvé.", 'red', attrs=['bold']))
|
print(colored("Aucun membre n'a été trouvé.", 'red', attrs=['bold']))
|
||||||
|
|
||||||
|
|
||||||
while "The program is running":
|
def main():
|
||||||
init() # Initialisation of colorama
|
while "The program is running":
|
||||||
IFPassdir, printername, AcrobatReader, clientsfile, clientsbkpfile, imgdir, pdftemplate, pngtemplate, fonttemplate = initialisation()
|
init() # Initialisation of colorama
|
||||||
|
IFPassdir, printername, AcrobatReader, clientsfile, clientsbkpfile, imgdir, pdftemplate, pngtemplate, fonttemplate = initialisation()
|
||||||
|
|
||||||
os.system('cls')
|
os.system('cls')
|
||||||
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)
|
||||||
if version in ('dev', 'devnocam'):
|
if version in ('dev', 'devnocam'):
|
||||||
print(colored("\nATTENTION : Il s'agit d'une version en cours de développement, potentiellement instable !", 'red'))
|
print(colored("\nATTENTION : Il s'agit d'une version en cours de développement, potentiellement instable !", 'red'))
|
||||||
print("\nLe programme IFPass à été écrit par Jordan ERNST Q1 2018 pour l'Institut Français en Hongrie.")
|
print("\nLe programme IFPass à été écrit par Jordan ERNST Q1 2018 pour l'Institut Français en Hongrie.")
|
||||||
print('Pour toute question, problème ou requête contactez-moi à pro.ernst@gmail.com.\n')
|
print('Pour toute question, problème ou requête contactez-moi à pro.ernst@gmail.com.\n')
|
||||||
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 : ')
|
||||||
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')
|
|
||||||
|
|
||||||
titre, firstname, surname, fullname = get_fullname()
|
|
||||||
dateinsc = date.today()
|
|
||||||
dateexp = dateinsc + timedelta(days=365)
|
|
||||||
|
|
||||||
dateinsc = dateinsc.strftime('%d/%m/%Y')
|
|
||||||
dateexp = dateexp.strftime('%d/%m/%Y')
|
|
||||||
changeexp = yes_or_no("Voulez-vous choisir la date d'expiration ?")
|
|
||||||
if changeexp:
|
|
||||||
while True:
|
|
||||||
dateexp = input("Quelle date d'expiration voulez-vous mettre (Format : JJ/MM/AAAA)? : ")
|
|
||||||
match = re.fullmatch(r'^(0[1-9]|1[0-9]|2[0-9]|3[0-1])/(0[1-9]|1[0-2])/([0-9]){4}$', dateexp)
|
|
||||||
if match:
|
|
||||||
break
|
|
||||||
else:
|
|
||||||
print('Mauvais format ! JJ/MM/AAAA, exemple : 01/08/2042')
|
|
||||||
|
|
||||||
os.system('cls')
|
|
||||||
print("Titre : ", colored(titre, 'green'))
|
|
||||||
print("Prénom : ", colored(firstname, 'green'))
|
|
||||||
print("Nom : ", colored(surname, 'green'))
|
|
||||||
print("Date d'inscription :", colored(dateinsc, 'green'))
|
|
||||||
print("Date d'expiration : ", colored(dateexp, 'green'))
|
|
||||||
correct = yes_or_no("Ces informations sont elles correctes ?")
|
|
||||||
|
|
||||||
if correct:
|
|
||||||
os.system('cls')
|
os.system('cls')
|
||||||
if version != 'devnocam':
|
|
||||||
picture = getpic()
|
|
||||||
clientID = getclientID()
|
|
||||||
barcode = barcode_gen(clientID)
|
|
||||||
fillcard(barcode)
|
|
||||||
cartefilename = mergepdf()
|
|
||||||
if version not in ('dev', 'devnocam'):
|
|
||||||
bkpdb()
|
|
||||||
printcard(cartefilename)
|
|
||||||
break
|
|
||||||
elif choix == '2':
|
|
||||||
os.system('cls')
|
|
||||||
membersearch()
|
|
||||||
os.system("pause")
|
|
||||||
|
|
||||||
elif choix == '3':
|
titre, firstname, surname, fullname = get_fullname()
|
||||||
sys.exit()
|
dateinsc = date.today()
|
||||||
|
dateexp = dateinsc + timedelta(days=365)
|
||||||
|
|
||||||
else:
|
dateinsc = dateinsc.strftime('%d/%m/%Y')
|
||||||
os.system('cls')
|
dateexp = dateexp.strftime('%d/%m/%Y')
|
||||||
print(colored('Choix incorrect !', 'red', attrs=['bold']))
|
changeexp = yes_or_no("Voulez-vous choisir la date d'expiration ?")
|
||||||
|
if changeexp:
|
||||||
|
while True:
|
||||||
|
dateexp = input("Quelle date d'expiration voulez-vous mettre (Format : JJ/MM/AAAA)? : ")
|
||||||
|
match = re.fullmatch(r'^(0[1-9]|1[0-9]|2[0-9]|3[0-1])/(0[1-9]|1[0-2])/([0-9]){4}$', dateexp)
|
||||||
|
if match:
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
print('Mauvais format ! JJ/MM/AAAA, exemple : 01/08/2042')
|
||||||
|
|
||||||
|
os.system('cls')
|
||||||
|
print("Titre : ", colored(titre, 'green'))
|
||||||
|
print("Prénom : ", colored(firstname, 'green'))
|
||||||
|
print("Nom : ", colored(surname, 'green'))
|
||||||
|
print("Date d'inscription :", colored(dateinsc, 'green'))
|
||||||
|
print("Date d'expiration : ", colored(dateexp, 'green'))
|
||||||
|
correct = yes_or_no("Ces informations sont elles correctes ?")
|
||||||
|
|
||||||
|
if correct:
|
||||||
|
os.system('cls')
|
||||||
|
if version != 'devnocam':
|
||||||
|
global picture
|
||||||
|
picture = getpic()
|
||||||
|
clientID = getclientID()
|
||||||
|
barcode = barcode_gen(clientID)
|
||||||
|
fillcard(barcode)
|
||||||
|
cartefilename = mergepdf()
|
||||||
|
if version not in ('dev', 'devnocam'):
|
||||||
|
bkpdb()
|
||||||
|
printcard(cartefilename)
|
||||||
|
break
|
||||||
|
elif choix == '2':
|
||||||
|
os.system('cls')
|
||||||
|
membersearch()
|
||||||
|
os.system("pause")
|
||||||
|
|
||||||
|
elif choix == '3':
|
||||||
|
sys.exit()
|
||||||
|
|
||||||
|
else:
|
||||||
|
os.system('cls')
|
||||||
|
print(colored('Choix incorrect !', 'red', attrs=['bold']))
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
[Application]
|
[Application]
|
||||||
name=IFPass
|
name=IFPass
|
||||||
version=2.2
|
version=2.2
|
||||||
target=IFPass.py
|
entry_point=IFPass:main
|
||||||
|
|
||||||
[Python]
|
[Python]
|
||||||
version=3.7.2
|
version=3.7.1
|
||||||
|
|
||||||
[Include]
|
[Include]
|
||||||
# Packages from PyPI that your application requires, one per line
|
# Packages from PyPI that your application requires, one per line
|
||||||
|
Loading…
Reference in New Issue
Block a user