Declared main() for packaging
This commit is contained in:
		
							
								
								
									
										125
									
								
								IFPass.py
									
									
									
									
									
								
							
							
						
						
									
										125
									
								
								IFPass.py
									
									
									
									
									
								
							@@ -28,6 +28,7 @@ config = 'IFPass.conf'
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
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.optionxform = str                # For case sensitive config file
 | 
			
		||||
 | 
			
		||||
@@ -286,68 +287,70 @@ def membersearch():
 | 
			
		||||
        print(colored("Aucun membre n'a été trouvé.", 'red', attrs=['bold']))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
while "The program is running":
 | 
			
		||||
    init()                      # Initialisation of colorama
 | 
			
		||||
    IFPassdir, printername, AcrobatReader, clientsfile, clientsbkpfile, imgdir, pdftemplate, pngtemplate, fonttemplate = initialisation()
 | 
			
		||||
def main():
 | 
			
		||||
    while "The program is running":
 | 
			
		||||
        init()                      # Initialisation of colorama
 | 
			
		||||
        IFPassdir, printername, AcrobatReader, clientsfile, clientsbkpfile, imgdir, pdftemplate, pngtemplate, fonttemplate = initialisation()
 | 
			
		||||
 | 
			
		||||
    os.system('cls')
 | 
			
		||||
    f = Figlet(font='big')
 | 
			
		||||
    print(colored(f.renderText('IFPass'), 'cyan', attrs=['bold']))
 | 
			
		||||
    print('Version : ', version)
 | 
			
		||||
    if version in ('dev', 'devnocam'):
 | 
			
		||||
        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('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')
 | 
			
		||||
    choix = input('Choix : ')
 | 
			
		||||
    if choix == '1':
 | 
			
		||||
        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')
 | 
			
		||||
        f = Figlet(font='big')
 | 
			
		||||
        print(colored(f.renderText('IFPass'), 'cyan', attrs=['bold']))
 | 
			
		||||
        print('Version : ', version)
 | 
			
		||||
        if version in ('dev', 'devnocam'):
 | 
			
		||||
            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('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')
 | 
			
		||||
        choix = input('Choix : ')
 | 
			
		||||
        if choix == '1':
 | 
			
		||||
            while "the informations are incorrect":              # Loop Filling informations
 | 
			
		||||
                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':
 | 
			
		||||
        sys.exit()
 | 
			
		||||
                titre, firstname, surname, fullname = get_fullname()
 | 
			
		||||
                dateinsc = date.today()
 | 
			
		||||
                dateexp = dateinsc + timedelta(days=365)
 | 
			
		||||
 | 
			
		||||
    else:
 | 
			
		||||
        os.system('cls')
 | 
			
		||||
        print(colored('Choix incorrect !', 'red', attrs=['bold']))
 | 
			
		||||
                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')
 | 
			
		||||
                    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']))
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user