Example #1
0
def menu(numAdh=0): #numIdAdhérent
    def maj():
        # on arrive ici toutes les 1000 ms
        t=datetime.datetime.today()
        heure.set(t.strftime('%m/%d/%Y  %H:%M:%S'))
        fmenu.after(1000,maj)

    def LancePanneauAdmin():
        fmenu.destroy()
        return panneauAdmin(numAdh) 
        
    def LanceCatalogue():
        fmenu.destroy()
        return catalogue(numAdh)

    def LanceProfil():
        fmenu.destroy()
        return formulaireAdherent(numAdh)
        
    fmenu = Tk()
    fmenu.title("Menu principal")
    p = PanedWindow(fmenu,orient=HORIZONTAL, height=100, width=600)
    p.grid(row=1)
    
    heure = StringVar()
    p.add(Label(p, textvariable=heure, bg="red", anchor=CENTER,width=20))
    maj()
    
    p.add(Label(p, text="Bonjour "+Adherent.getPseudo(numAdh), bg="white", anchor=CENTER, width=20))
    if (Adherent.getEstAdministrateur(numAdh)<>None and Adherent.getEstAdministrateur(numAdh)):
        p.add(Button(p, text="Panneau d'administration", bg="orange", activebackground="orange", borderwidth=10, width=20, command=LancePanneauAdmin ))
    p.add(Button(p, text="Quitter", bg="white", activebackground="black", borderwidth=10, width=10, command = fmenu.destroy ))
    

    pd = PanedWindow(fmenu,orient=HORIZONTAL, height=350, width=600)
    pd.grid(row=2)
    pd.add(Button(pd, text="Profil", width=38, command = LanceProfil, bg="yellow", activebackground="yellow", borderwidth=10))
    pd.add(Button(pd, text="Catalogue", width=38, command = LanceCatalogue, bg="red", activebackground="red", borderwidth=10))

    
    pt = PanedWindow(fmenu,orient=HORIZONTAL, height=350, width=600)
    pt.grid(row=3)
    pt.add(Button(pt, text="Mes emprunts", command = rien, bg="green", width=38,activebackground="green", borderwidth=10))
    pt.add(Button(pt, text="Réservation", command = rien,bg="cyan", width=38,activebackground="cyan", borderwidth=10))
    
    fmenu.mainloop()
Example #2
0
def panneauAdmin(numAdh=0): #numIdAdhérent
    def maj():
        # on arrive ici toutes les 1000 ms
        t=datetime.datetime.today()
        heure.set(t.strftime('%m/%d/%Y  %H:%M:%S'))
        fpanneauadmin.after(1000,maj)

    def retourMenu():
        fpanneauadmin.destroy()
        return menu(numAdh) 
        
    if (not(Adherent.getEstAdministrateur(numAdh)<>None and Adherent.getEstAdministrateur(numAdh))):
        return menu(numAdh)
    
    fpanneauadmin = Tk()
    fpanneauadmin.title("Panneau d'aministration")
    
    p = PanedWindow(fpanneauadmin,orient=HORIZONTAL, height=100, width=600)
    p.grid(row=1)
    
    heure = StringVar()
    p.add(Label(p, textvariable=heure, bg="red", anchor=CENTER,width=20))
    maj()
    
    p.add(Label(p, text="Bonjour "+Adherent.getPseudo(numAdh), bg="white", anchor=CENTER, width=20))
    p.add(Button(p, text="Retour menu", bg="orange", activebackground="orange", borderwidth=10, width=20, command= retourMenu))
    p.add(Button(p, text="Quitter", bg="white", activebackground="black", borderwidth=10, width=10, command = fpanneauadmin.destroy ))
    
    pd = PanedWindow(fpanneauadmin,orient=HORIZONTAL, height=350, width=600)
    pd.grid(row=2)
    pd.add(Button(pd, text="Gestion des Adhérents", width=38, command = rien, bg="yellow", activebackground="yellow", borderwidth=10))
    pd.add(Button(pd, text="Gestion des Jeux", width=38, command = rien, bg="red", activebackground="red", borderwidth=10))


    pt = PanedWindow(fpanneauadmin,orient=HORIZONTAL, height=350, width=600)
    pt.grid(row=3)
    pt.add(Button(pt, text="Gestion des Emprunts", command = rien, bg="green", width=38,activebackground="green", borderwidth=10))
    pt.add(Button(pt, text="Gestion des réservations", command = rien,bg="cyan", width=38,activebackground="cyan", borderwidth=10))

    fpanneauadmin.mainloop()
Example #3
0
def formulaireAdherent(numAdh, modification=0):
    fAdh = Tk()
    fAdh.title("Profil de "+Adherent.getPrenom(numAdh))

    def retourMenu(): #Fonction de confirmation DANS la fonction de fenetre.
        fAdh.destroy()
        return menu()


    def CallBackFormulaireAdh(): #Fonction de confirmation DANS la fonction de fenetre.
        #recupere les infos 
        infoAdh.append(entryNomAdh.get())
        infoAdh.append(entryPrenomAdh.get())
        infoAdh.append(entryPseudoAdh.get())
        if(modification == -1):
                infoAdh.append(entryMdpAdh.get())
        else:
            infoAdh.append(None)
        j = int(entryDnjAdh.get())
        m = int(entryDnmAdh.get())
        a = int(entryDnaAdh.get())
        d = datetime.datetime(a, m, j)
        infoAdh.append(d)
        infoAdh.append(entryAdrAdh.get())
        infoAdh.append(entryVilleAdh.get())
        infoAdh.append(entryCpAdh.get())
        infoAdh.append(entryNumAdh.get())
        infoAdh.append(entryMailAdh.get())
        if(cocher.get()==1):
            infoAdh.append(True)
        else:
            infoAdh.append(False)
        
        #ordre infoAdh : nom,prenom,pseudo,mdp,dateNaissance,adresse,ville,codepostale,numTel,@Mail,estAdmin
        #on modifie un adherent
        if(modification<>1):
            if (askyesno("Confirmation", "Enregistrer vos modification")):
                Adherent.setNom(numAdh,infoAdh[0])
                Adherent.setPrenom(numAdh,infoAdh[1])
                Adherent.setPseudo(numAdh,infoAdh[2])
                if modification == -1:
                    Adherent.setMotDePasse(numAdh,infoAdh[3])
                Adherent.setNaissance(numAdh,infoAdh[4])
                Adherent.setAdresse(numAdh,infoAdh[5])
                Adherent.setVille(numAdh,infoAdh[6])
                Adherent.setCodePostale(numAdh,infoAdh[7])
                Adherent.setNumeroTelephone(numAdh,infoAdh[8])
                Adherent.setMail(numAdh,infoAdh[9])
                if modification == 0:
                    Adherent.setAdministrateur(numAdh,infoAdh[10])
                return fAdh.quit() #Ferme si "oui"
            else:
                fAdh.destroy()
                return menu(num)
        #on creer un adherent
        else:    
            if (askyesno("Confirmation", "Creer ce nouveau adherent ?")):
                #ajoutAdherent(nomAdherent, prenomAdherent, dateNaissanceAdherent, adresseAdherent, codePostalAdherent, villeAdherent, numeroTelAdherent,  pseudoAdherent, adresseMailAdherent, estAdmin)
                Adherent.ajoutAdherent(infoAdh[0],infoAdh[1],infoAdh[4],infoAdh[5],infoAdh[7],infoAdh[6],infoAdh[8],infoAdh[2],infoAdh[9],infoAdh[10])
                return fAdh.quit() #Ferme si "oui"
            else:
                fAdh.destroy()
                return menu(num)

    #menu haut
    p = PanedWindow(fAdh, orient = HORIZONTAL, height=100, width=1000)
    p.grid(row=1, column=1, columnspan=4)
    
    p.add(Label(p, text="Bonjour "+Adherent.getPseudo(numAdh), bg="white", anchor=CENTER, width=20))
    p.add(Button(p, text="Retour au menu", bg="orange", activebackground="orange", borderwidth=10, width=20, command= partial(retourMenu)))
    p.add(Button(p, text="Quitter", bg="white", activebackground="black", borderwidth=10, width=10, command = fAdh.destroy ))
    
    Label(fAdh, text="Profil", font=("Helvetica", 30), height=4).grid(row=2, column=1, columnspan=4)

    
    #ordre : nom,prenom,pseudo,mdp,dateNaissance,adresse,ville,codepostale,numTel,@Mail,estAdmin
    infoAdh = []
    
    #nom
    Label(fAdh, text="Nom : ").grid(row=3, column=1, columnspan=2)
    if(modification == 1):
        nomAdh = ""
    else:
        nomAdh = StringVar()
        nomAdh.set(Adherent.getNom(numAdh))
    entryNomAdh = Entry(fAdh,textvariable=nomAdh,width=40)
    entryNomAdh.grid(row=3, column=3, columnspan=2)
    
    #prenom
    Label(fAdh, text="Prénom : ").grid(row=4, column=1, columnspan=2)
    if(modification == 1):
        prenomAdh = ""
    else:
        prenomAdh = StringVar()
        prenomAdh.set(Adherent.getPrenom(numAdh))
    entryPrenomAdh = Entry(fAdh,textvariable=prenomAdh,width=40)
    entryPrenomAdh.grid(row=4, column=3, columnspan=2)
    
    #pseudo
    Label(fAdh, text="Pseudo : ").grid(row=5, column=1, columnspan=2)
    if(modification == 1):
        pseudoAdh = ""
    else:
        pseudoAdh = StringVar()
        pseudoAdh.set(Adherent.getPseudo(numAdh))
    entryPseudoAdh = Entry(fAdh,textvariable=pseudoAdh,width=40)
    entryPseudoAdh.grid(row=5, column=3, columnspan=2)
    
    #mdp
    if(modification <> 1):
        Label(fAdh, text="Mot de passe : ").grid(row=6, column=1, columnspan=2)
        if modification == 0:
            Button(fAdh, text="Reinitialiser MDP", command= Adherent.reinitialiserMDPAdherent(numAdh)).grid(row=6, column=3, columnspan=2)
        else:
            mdpAdh = StringVar()
            mdpAdh.set(Adherent.getMotDePasse(numAdh))
            entryMdpAdh = Entry(fAdh,textvariable=mdpAdh,width=40,show="*")
            entryMdpAdh.grid(row=6, column=3, columnspan=2)
        
    #date Naissance
    Label(fAdh, text="Date de naissance : ").grid(row=7, column=1)
    if(modification == 1):
        dnjAdh=""
        dnmAdh=""
        dnaAdh="1900"

    else:
        dnaAdh = StringVar()
        dnaAdh.set(Adherent.getNaissance(numAdh)[0:4])
        dnmAdh = StringVar()
        dnmAdh.set(Adherent.getNaissance(numAdh)[5:7])
        dnjAdh = StringVar()
        dnjAdh.set(Adherent.getNaissance(numAdh)[8:10])
        
    entryDnjAdh = Spinbox(fAdh, textvariable=dnjAdh, from_=1, to =31)
    entryDnjAdh.grid(row=7, column=2)
    
    entryDnmAdh = Spinbox(fAdh, textvariable=dnmAdh, from_=1, to =12)
    entryDnmAdh.grid(row=7, column=3)
    
    entryDnaAdh = Spinbox(fAdh, textvariable=dnaAdh, from_=1900, to=datetime.date.today().year)
    entryDnaAdh.grid(row=7, column=4) 

    #adresse
    Label(fAdh, text="Adresse : ").grid(row=8,column=1, columnspan=2)
    if(modification == 1):
        adrAdh = ""
    else:
        adrAdh = StringVar()
        adrAdh.set(Adherent.getAdresse(numAdh))
    entryAdrAdh = Entry(fAdh,textvariable=adrAdh,width=40)
    entryAdrAdh.grid(row=8, column=3, columnspan=2)

    #ville
    Label(fAdh, text="Ville : ").grid(row=10, column=1, columnspan=2)
    if(modification == 1):
        villeAdh = ""
    else:
        villeAdh = StringVar()
        villeAdh.set(Adherent.getVille(numAdh))
    entryVilleAdh = Entry(fAdh,textvariable=villeAdh,width=40)
    entryVilleAdh.grid(row=10, column=3, columnspan=2)
    
    #code postale
    Label(fAdh, text="Code postal : ").grid(row=9, column=1, columnspan=2)
    if(modification == 1):
        cpAdh = ""
    else:
        cpAdh = StringVar()
        cpAdh.set(Adherent.getCodePostal(numAdh))
    entryCpAdh = Entry(fAdh,textvariable=cpAdh,width=40)
    entryCpAdh.grid(row=9, column=3, columnspan=2)
    
    #num telephone
    Label(fAdh, text="Numéro : ").grid(row=11, column=1, columnspan=2)
    if(modification == 1):
        numeroAdh = ""
    else:
        numeroAdh = StringVar()
        numeroAdh.set(Adherent.getNumTelephone(numAdh))
    entryNumAdh = Entry(fAdh,textvariable=numeroAdh,width=40)
    entryNumAdh.grid(row=11, column=3, columnspan=2)

    #adresse mail
    Label(fAdh, text="Adresse Mail : ").grid(row=12, column=1, columnspan=2)
    if(modification == 1):
        mailAdh = ""
    else:
        mailAdh = StringVar()
        mailAdh.set(Adherent.getMail(numAdh))
    entryMailAdh = Entry(fAdh,textvariable=mailAdh,width=40)
    entryMailAdh.grid(row=12, column=3, columnspan=2)
    

    #estAdmin
    cocher = IntVar()    
    Label(fAdh, text="Administrateur : ").grid(row=13, column=1, columnspan=2)
    if modification == -1:
       admAdh = Checkbutton(fAdh, text="", variable = cocher, state=DISABLED)
    else:
        admAdh = Checkbutton(fAdh, text="", variable = cocher)
    admAdh.grid(row=13, column=3, columnspan=2)
    if Adherent.getEstAdministrateur(numAdh)==True:
        admAdh.select()
    else:
        admAdh.deselect()
    
       
    
    Button(fAdh, text="Enregistrer", command = partial(CallBackFormulaireAdh)).grid(row=14, column=1, columnspan=4)
    
    #Lancement de la fenetre
    fAdh.mainloop()
    #Enfin on detruit la fenetre
    fAdh.destroy()
    
    menu()