Пример #1
0
 def verification():
     ID = Adherent.getId(pseudo.get())
     if (ID <> None):
         if (mdp.get()==Adherent.getMotDePasse(ID)):
             fconnexion.destroy()
             menu(ID)
         else:
             showwarning('Mot de passe incorrect','Mot de passe incorrect.\nVeuillez recommencer !')
             mdp.set('')
     else:
         showwarning('Pseudo inexistant','Adresse mail ou pseudo inexistant.\nVeuillez recommencer !')
         mdp.set('')
         pseudo.set('')
Пример #2
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()
Пример #3
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()
Пример #4
0
 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)
Пример #5
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()
Пример #6
0
def catalogue(numAdherent=0, Jeux=Jeu.getAllJeu(), modeAdmin=False): #idAdherent
    def maj():
        # on arrive ici toutes les 1000 ms
        t=datetime.datetime.today()
        heure.set(t.strftime('%m/%d/%Y  %H:%M:%S'))
        fcatalogue.after(1000,maj)

    def retourMenu():
        fcatalogue.destroy()
        return menu(numAdherent)

    def afficheFicheJeu(i):
        fcatalogue.destroy()
        return ficheJeu(numAdherent, i)
    
    def lancerEmprunt(i):
        fcatalogue.destroy()
        return formulaireEmprunt(i)

    def lancerReserv(i):
        fcatalogue.destroy()
        return reserver(i)

    def lanceCatalogue(n, ma):
        r = entryRecherche.get()
        fcatalogue.destroy()

    def lancerExtension(i, mode):
        fcatalogue.destroy()
        return afficheExtensions(i, mode)
        
        return catalogue(n, Jeu.getJeuByNom(r), ma)

    def afficheJeu(n, Jeux, k=0):
        n[0]=n[0]+k
        r = n[2]-n[1]
        if (r>20): r=20
        if (n[0]<n[1]):
            n[0]=n[1]
        if (n[0]+r>n[2]):
            n[0]=n[2]-r
        j=3
        
        for i in range(n[0],n[0]+r):
            Label(fcatalogue, text=str(Jeux[i][1]), bg="orange", width = 25).grid(row=j, column=1)
            Label(fcatalogue, text=str(Jeux[i][2]), bg="orange", width = 10).grid(row=j, column=2)
            Label(fcatalogue, text=str(Jeux[i][3]), bg="orange", width = 10).grid(row=j, column=3)
            Label(fcatalogue, text=str(Jeux[i][4]), bg="orange", width = 10).grid(row=j, column=4)
            Label(fcatalogue, text=str(Jeux[i][5]), bg="orange", width = 15).grid(row=j, column=5)
            Label(fcatalogue, text=str(Jeux[i][6]), bg="orange", width = 15).grid(row=j, column=6)
            Label(fcatalogue, text=str(Jeux[i][7]), bg="orange", width = 15).grid(row=j, column=7)
            Label(fcatalogue, text=str(Jeux[i][8]), bg="orange", width = 15).grid(row=j, column=8)
            if (modeAdmin):
                Button(fcatalogue, text="Modifier", command = rien,bg="blue", width=13,activebackground="blue").grid(row=j, column=9) #partial(formulaireJeu,Jeux[i][0])
                Button(fcatalogue, text="Créer extension", command = partial(formulaireExt, -1, Jeux[i][0]),bg="cyan", width=13,activebackground="cyan").grid(row=j, column=14)
            else:
                Button(fcatalogue, text="Détail", command = partial(afficheFicheJeu,Jeux[i][0]) ,bg="blue", width=13,activebackground="blue").grid(row=j, column=9)
                
            if (Jeu.aDesExtensions(Jeux[i][0])):
                Button(fcatalogue, text="Extensions", command = partial(lancerExtension, Jeux[i][0], modeAdmin),bg="red", width=13,activebackground="red").grid(row=j, column=10)
            Button(fcatalogue, text="Emprunt", command = partial(lancerEmprunt, Jeux[i][0]),bg="green", width=13,activebackground="green").grid(row=j, column=11)
            Button(fcatalogue, text="Reserv", command = partial(lancerReserv, Jeux[i][0]),bg="red", width=13,activebackground="red").grid(row=j, column=12)
            if (modeAdmin):
                Button(fcatalogue, text="Supprimer", command = rien,bg="yellow", width=13,activebackground="red").grid(row=j, column=13)
            j=j+1

    
    fcatalogue = Tk()
    fcatalogue.title("Les jeux de la ludothèque")
    fcatalogue.grid_columnconfigure(0,weight=1)
    fcatalogue.grid_rowconfigure(20,weight=21)
    
    p = PanedWindow(fcatalogue, orient = HORIZONTAL, height=100, width=1000)
    p.grid(row=1, column=1, columnspan=11)
     
    heure = StringVar()
    p.add(Label(p, textvariable=heure, bg="red", anchor=CENTER,width=30))
    maj()

    rech=StringVar()
    rech.set("Faites une recherche ici !")

    entryRecherche = Entry(p, textvariable=rech, width = 30)
    p.add(entryRecherche)
    p.add(Button(p, text="Recherchez !", bg="orange", activebackground="orange", borderwidth=10, width=10, command= partial(lanceCatalogue,numAdherent,modeAdmin)))
    
    p.add(Label(p, text="Bonjour "+Adherent.getPseudo(numAdherent), bg="white", anchor=CENTER, width=10))
    if (modeAdmin):
        p.add(Button(p, text="Ajouter un jeu", bg="cyan", activebackground="cyan", borderwidth=10, width=10, command= rien))#partial(formulaireJeu,numAdh)))
    p.add(Button(p, text="Retour au menu principal", bg="orange", activebackground="orange", borderwidth=10, width=10, command= retourMenu ))
    p.add(Button(p, text="Quitter", bg="white", activebackground="black", borderwidth=10, width=10, command = fcatalogue.destroy ))

    Label(fcatalogue, text="Nom", bg="green", width = 23).grid(row=2, column=1)
    Label(fcatalogue, text="Année", bg="green", width = 8).grid(row=2, column=2)
    Label(fcatalogue, text="Age Min.", bg="green", width = 8).grid(row=2, column=3)
    Label(fcatalogue, text="Nb Joueur", bg="green", width = 8).grid(row=2, column=4)
    Label(fcatalogue, text="Disponibilité", bg="green", width = 13).grid(row=2, column=5)
    Label(fcatalogue, text="Auteur", bg="green", width = 13).grid(row=2, column=6)
    Label(fcatalogue, text="Illustrateur", bg="green", width = 15).grid(row=2, column=7)
    Label(fcatalogue, text="Editeur", bg="green", width = 13).grid(row=2, column=8)
    if (modeAdmin):
        Label(fcatalogue, text="Que faire ?", bg="green", width = 73).grid(row=2, column=9, columnspan=5)
    else:
        Label(fcatalogue, text="Que faire ?", bg="green", width = 73).grid(row=2, column=9, columnspan=4)

    numJeu=[0,0,len(Jeux)]
    flecheH = Button(fcatalogue, text="^", command = partial(afficheJeu, numJeu, Jeux, -20), bg="blue", width=5,activebackground="blue").grid(row=3, column=14)
    flecheB = Button(fcatalogue, text="v", command = partial(afficheJeu, numJeu, Jeux, 20), bg="blue", width=5,activebackground="blue").grid(row=22, column=14)
    afficheJeu(numJeu, Jeux)
    
        
    fcatalogue.mainloop()