Example #1
0
    def __init__(self):
        QDialog.__init__(self)
        self.setWindowTitle("IkeoOoooooo")
        self.setGeometry(500, 150, 300, 250)
        self.setStyleSheet("background-color: #003399; color: #FFFFFF")
        try:
            self.data = Bdd()
        except mysql.connector.errors.InterfaceError:
            self.pop = Popup()
            self.pop.connex_err()

        self.label = QLabel()
        self.label2 = QLabel()
        self.label3 = QLabel()
        self.label.setText("Voici la liste de nos sites de production :")
        self.label2.setText(self.affichage5())
        self.label.setAlignment(Qt.AlignCenter)
        self.label2.setAlignment(Qt.AlignCenter)
        self.label2.setStyleSheet(
            "border: 4px solid #FFCC00; font: 10pt Tahoma; color: #FFCC00")
        layout = QVBoxLayout()
        layout.addWidget(self.label)
        layout.addWidget(self.label2)
        layout.addWidget(self.label3)
        self.setLayout(layout)
Example #2
0
 def recup_prod_infos(self, product):
     if product != 'Liste des produits':
         self.products = Bdd.recup_products()
         self.usines = Bdd.recup_site_prod(self.products[product][0])
         if len(self.usines) > 1:
             return f"{product} | réf: {self.products[product][1]} | {self.products[product][2]} | produit dans les usines de {', '.join(self.usines)}"
         else :
             return f"{product} | réf: {self.products[product][1]} | {self.products[product][2]} | produit dans l'usine de {self.usines[0]}"
Example #3
0
class Fen2(QDialog):  #     	afficher la facture d'un client à une date choisie
    def __init__(self):
        QDialog.__init__(self)
        self.setWindowTitle("IkeoOoooooo")
        self.setGeometry(500, 50, 400, 450)
        self.setStyleSheet("background-color: #003399; color: #FFFFFF")
        try:
            self.data = Bdd()
        except mysql.connector.errors.InterfaceError:
            self.pop = Popup()
            self.pop.connex_err()

        self.vide = QLabel()
        self.texte_invit = QLabel()
        self.texte_invit.setText("Choisir un client :")
        self.texte_invit2 = QLabel()
        self.texte_invit2.setText("Date de facturation (AAAA-MM-JJ) :")
        self.listeclients = QComboBox()
        self.listeclients.addItems(self.data.lister_clients())
        self.champ = QLineEdit()
        self.btok = QPushButton("Rechercher")
        self.btok.clicked.connect(self.appui_ok2)
        self.label = QLabel()
        self.label.setStyleSheet("font: 10pt Tahoma; color: #FFCC00")

        layout = QVBoxLayout()
        layout.addWidget(self.vide)
        layout.addWidget(self.texte_invit)
        layout.addWidget(self.listeclients)
        layout.addWidget(self.texte_invit2)
        layout.addWidget(self.champ)
        layout.addWidget(self.vide)
        layout.addWidget(self.btok)
        layout.addWidget(self.vide)
        layout.addWidget(self.label)
        layout.addWidget(self.vide)
        self.setLayout(layout)

    def appui_ok2(self):
        date = self.champ.text()
        client = self.listeclients.currentText()
        client = client.split(", ")
        idclient = client[-1]
        if date:
            try:
                achats = self.data.afficher_facture_date(idclient, date)
                aff1 = " \t{:<23}\t>:\t{:<25} \n".format("Article", "Quantité")
                for i in achats:
                    aff1 += " \t{:<23}\t>:\t{:<25} \n".format(i[0], i[1])
                self.label.setText(aff1)
            except:
                self.label.setText(
                    "Une erreur est survenue. Veuillez vérifier votre connexion au serveur et réessayer."
                )
Example #4
0
    def __init__(self):
        QDialog.__init__(self)
        self.setWindowTitle("IkeoOoooooo")
        self.setGeometry(500, 50, 500, 450)
        self.setStyleSheet("background-color: #003399; color: #FFFFFF")
        try:
            self.data = Bdd()
        except mysql.connector.errors.InterfaceError:
            self.pop = Popup()
            self.pop.connex_err()

        self.vide = QLabel()
        self.invit0 = QLabel()
        self.invit0.setText("Nom du produit :")
        self.invit1 = QLabel()
        self.invit1.setText("Référence :")
        self.invit2 = QLabel()
        self.invit2.setText("Description :")
        self.invit3 = QLabel()
        self.invit3.setText("Statut du produit :")
        self.invit4 = QLabel()
        self.invit4.setText("Site de production :")
        self.affect_statut = QComboBox(self)
        self.affect_statut.addItems(
            ['Commercialisation abandonnée', 'Commercialisé'])
        self.affect_site = QComboBox(self)
        self.affect_site.addItems(self.data.lister_sites())
        self.champ0 = QLineEdit()
        self.champ1 = QLineEdit()
        self.champ2 = QLineEdit()
        self.btok = QPushButton("Entrer dans la base")
        self.btok.resize(100, 30)
        self.btok.clicked.connect(self.appui_ok6)
        self.label = QLabel()

        layout = QVBoxLayout()
        layout.addWidget(self.invit0)
        layout.addWidget(self.champ0)
        layout.addWidget(self.invit1)
        layout.addWidget(self.champ1)
        layout.addWidget(self.invit2)
        layout.addWidget(self.champ2)
        layout.addWidget(self.invit3)
        layout.addWidget(self.affect_statut)
        layout.addWidget(self.invit4)
        layout.addWidget(self.affect_site
                         )  ## ajouter possibilité d'affecter plusieurs sites
        layout.addWidget(self.vide)
        layout.addWidget(self.btok)
        layout.addWidget(self.label)
        self.setLayout(layout)
Example #5
0
    def __init__(self):
        QDialog.__init__(self)
        self.setWindowTitle("IkeoOoooooo")
        self.setGeometry(500, 50, 500, 450)
        self.setStyleSheet("background-color: #003399; color: #FFFFFF")
        try:
            self.data = Bdd()
        except mysql.connector.errors.InterfaceError:
            self.pop = Popup()
            self.pop.connex_err()

        self.vide = QLabel()
        self.invit1 = QLabel()
        self.invit1.setText("Choisir le type de client :")
        self.invit2 = QLabel()
        self.invit2.setText("Nom du client :")
        self.invit3 = QLabel()
        self.invit3.setText("Adresse :")
        self.invit4 = QLabel()
        self.invit4.setText("Ville :")
        self.invit5 = QLabel()
        self.invit5.setText("Pays :")
        self.affect_typecl = QComboBox(self)
        self.affect_typecl.addItems(['Magasin', 'Central d\'achat'])
        self.affect_pays = QComboBox(self)
        self.affect_pays.addItems(self.data.lister_pays())
        self.champ2 = QLineEdit()
        self.champ3 = QLineEdit()
        self.champ4 = QLineEdit()
        self.btok = QPushButton("Entrer dans la base")
        self.btok.resize(100, 30)
        self.btok.clicked.connect(self.appui_ok4)
        self.label = QLabel()

        layout = QVBoxLayout()
        layout.addWidget(self.invit1)
        layout.addWidget(self.affect_typecl)
        layout.addWidget(self.invit2)
        layout.addWidget(self.champ2)
        layout.addWidget(self.invit3)
        layout.addWidget(self.champ3)
        layout.addWidget(self.invit4)
        layout.addWidget(self.champ4)
        layout.addWidget(self.invit5)
        layout.addWidget(self.affect_pays)
        layout.addWidget(self.vide)
        layout.addWidget(self.btok)
        layout.addWidget(self.label)
        self.setLayout(layout)
Example #6
0
class Fen1(QDialog
           ):  # afficher tous les produits ainsi que leurs sites de production
    def __init__(self):
        QDialog.__init__(self)
        self.setWindowTitle("IkeoOoooooo")
        self.setGeometry(500, 140, 400, 270)
        self.setStyleSheet("background-color: #003399; color: #FFFFFF")
        try:
            self.data = Bdd()
        except mysql.connector.errors.InterfaceError:
            self.pop = Popup()
            self.pop.connex_err()

        self.label = QLabel()
        self.label.setText(
            "Voici la liste des produits ainsi que leurs sites de production :"
        )
        self.label.setAlignment(Qt.AlignCenter)
        self.table = QLabel()
        self.table.setStyleSheet(
            "border: 1px solid #FFCC00; font: 10pt Tahoma; color: #FFCC00")
        self.table.setText(self.affichage1())
        layout = QVBoxLayout()
        layout.addWidget(self.label)
        layout.addWidget(self.table)
        self.setLayout(layout)

    def affichage1(self):
        dps = self.data.lister_produits_sites()
        aff1 = "\n"
        for key, values in dps.items():
            aff2 = "\t".join(values)
            aff1 += " {:<23}\t>:\t{:<25} \n".format(key, aff2)
        return aff1
Example #7
0
 def __init__(self):
     QDialog.__init__(self)
     self.setWindowTitle("IkeoOoooooo")
     self.setGeometry(500, 50, 500, 450)
     self.setStyleSheet("background-color: #003399; color: #FFFFFF")
     try:
         self.data = Bdd()
     except mysql.connector.errors.InterfaceError:
         self.pop = Popup()
         self.pop.connex_err()
Example #8
0
def main():

    #os.chdir("..\\..\\Mail apprenants")
    monfichier = Traitement("apprenantmail.txt")
    mailing = monfichier.lire_fichier()

    donnees = Bdd()
    donnees_apprenants = donnees.lire_data()

    donnees.ajouter_colonne()
    for ligne in donnees_apprenants:
        ligne.mail = definir_mail(mailing, ligne.pseudo)
        print(ligne.nom_etudiant, ligne.prenom_etudiant, ligne.id_etudiant,
              ligne.pseudo, ligne.mail)
        donnees.ecrire_mail(ligne.mail, ligne.id_etudiant)

    donnees.fermer_bdd()
Example #9
0
    def __init__(self):
        QDialog.__init__(self)
        self.setWindowTitle("IkeoOoooooo")
        self.setGeometry(500, 50, 400, 450)
        self.setStyleSheet("background-color: #003399; color: #FFFFFF")
        try:
            self.data = Bdd()
        except mysql.connector.errors.InterfaceError:
            self.pop = Popup()
            self.pop.connex_err()

        self.vide = QLabel()
        self.texte_invit = QLabel()
        self.texte_invit.setText("Choisir un client :")
        self.texte_invit2 = QLabel()
        self.texte_invit2.setText("Date de facturation (AAAA-MM-JJ) :")
        self.listeclients = QComboBox()
        self.listeclients.addItems(self.data.lister_clients())
        self.champ = QLineEdit()
        self.btok = QPushButton("Rechercher")
        self.btok.clicked.connect(self.appui_ok2)
        self.label = QLabel()
        self.label.setStyleSheet("font: 10pt Tahoma; color: #FFCC00")

        layout = QVBoxLayout()
        layout.addWidget(self.vide)
        layout.addWidget(self.texte_invit)
        layout.addWidget(self.listeclients)
        layout.addWidget(self.texte_invit2)
        layout.addWidget(self.champ)
        layout.addWidget(self.vide)
        layout.addWidget(self.btok)
        layout.addWidget(self.vide)
        layout.addWidget(self.label)
        layout.addWidget(self.vide)
        self.setLayout(layout)
Example #10
0
File: model.py Project: L3nn0x/tags
class   Model:
    def __init__(self, dbname, eventManager):
        self.bdd = Bdd(dbname)
        self.manager = eventManager
        self.manager.addObserver(self)

    def notify(self, e):
        if type(e) is NewDataEvent:
            self.bdd.addEntry(e.data, e.tags)
            self.manager.notify(UpdateListEvent(self.bdd.findData(e.data)[0], True))
        elif type(e) is GetAllEvent:
            r = sortByDate(self.bdd.findData())
            for i in r:
                self.manager.notify(UpdateListEvent(i, True))
        elif type(e) is SearchEvent:
            r = self.bdd.getTagFilter(e.s)
            tags = self.bdd.findTags(e.s)   # Recherche les tags suggérés et les ajoute aux tags exacts trouvés
            for i in tags:
                for j in self.bdd.getTagFilter(i):
                    if not j in r:
                        r.append(j)
            r = sortByDate(r)
            for i in r:
                self.manager.notify(UpdateListEvent(i, True))
Example #11
0
File: model.py Project: L3nn0x/tags
 def __init__(self, dbname, eventManager):
     self.bdd = Bdd(dbname)
     self.manager = eventManager
     self.manager.addObserver(self)
Example #12
0
# Recurrent Neural Networks

# Partie 1 - Préparation des données
# Librairies
import pandas as pd
import numpy as np
import sys
from bdd import Bdd
from data import Data
from ai import AI

folder = sys.argv[1]
#folder = ""
filename = "predict_fuel_dep_and_pdv.h5"

idpdv = 33700023
idcarburant = 1

training_set = pd.DataFrame(columns=['A', 'B', 'C', 'D'])

bdd = Bdd(True)
training_set = bdd.filledTrainingSetFuelDepAndPdv(training_set, idpdv,
                                                  idcarburant)
training_set = np.flip(training_set, 0)

data = Data(400)
data.filledDataFuelDepAndPdv(training_set)

ai = AI(folder, filename)
ai.prepetualTraining(data.getXTrain(), data.getYTrain())
ai.save()
Example #13
0
def decrypt():
    sqlite = Bdd()
    reading = sqlite.hash_bdd()
    global mail
    global identify
    global title2
    global police2
    global anti_brute_force
    global voice
    title2.pack()
    a = 0
    b = 0
    mot_finale = []
    identify_encode = identify.get().encode("utf-8")
    mail_encode1 = mail.get()
    if bcrypt.checkpw(identify_encode, reading):
        liste = list(identify.get())
        while a < 16:
            a += 1
            mot_finale.append(liste[b])
            b += 1
            if b == len(liste):
                b = 0
            else:
                continue
        mot_finale2 = ''.join(mot_finale)
        crypt = Cypher(mot_finale2)
        encryption_test = crypt.encrypt(mail_encode1)
        curseur3 = connexion.cursor()
        curseur3.execute("SELECT mail FROM auth")
        result = curseur3.fetchall()
        search_password = []
        for resultat in result:
            result_decode = result[0]
            search_password.append(resultat[0])
        connexion.commit()
        curseur4 = connexion.cursor()
        a = 0
        for element in search_password:
            if element == encryption_test:
                curseur4.execute("SELECT pass FROM auth WHERE mail=?",
                                 [element])
                result2 = curseur4.fetchone()
                connexion.commit()
                crypt = Cypher(mot_finale2)
                unpad_decrypt = crypt.decrypt(result2[0])
                if voice.get() == 1:
                    tts = gTTS('Your password is ' + unpad_decrypt, 'en')
                    tts.save('voice.mp3')
                    playsound('voice.mp3')
                    os.remove("voice.mp3")
                    return 0
                else:
                    resp = "The password is" + unpad_decrypt
                    color_resp = "green"
                    title2.pack_forget()
                    title2 = Button(window,
                                    text=resp,
                                    bg=color_background,
                                    fg=color_resp,
                                    width=1000,
                                    height=2,
                                    borderwidth=0,
                                    font=police2)
                    title2.pack()
                    connexion.commit()
                    a = 0
                    anti_brute_force = 0
                    return 0
            else:
                a = 5
        if a == 5:
            resp = "the email was not found"
            color_resp = "red"
            title2.pack_forget()
            title2 = Button(window,
                            text=resp,
                            bg=color_background,
                            fg=color_resp,
                            width=1000,
                            height=2,
                            borderwidth=0,
                            font=police2)
            title2.pack()
            connexion.commit()
            return 0
    else:
        if anti_brute_force == 6:
            resp = "Anti brute force activated for 30 seconds of inactivity"
            anti_brute_force = 0
        else:
            resp = "The ID is false"
        color_resp = "red"
        title2.pack_forget()
        title2 = Button(window,
                        text=resp,
                        bg=color_background,
                        fg=color_resp,
                        width=1000,
                        height=2,
                        borderwidth=0,
                        font=police2)
        title2.pack()
        return 0
        if resp == "Anti brute force activated for 30 seconds of inactivity":
            time.sleep(30)
        anti_brute_force += 1
        connexion.commit()
    global nombre_error
    nombre_error += 1
    color_resp = "grey"
    resp = "ok"
    if nombre_error == 1:
        title2 = Button(window,
                        text=resp,
                        bg=color_background,
                        fg=color_resp,
                        width=1000,
                        height=2,
                        borderwidth=0,
                        font=police2)
    else:
        title2.pack_forget()
Example #14
0
def main():
    open = Opening()
    open.hash()
    svocal = Vocal()
    svocal.synthese()
    sqlite = Bdd()
    global identify
    global mail
    global police2
    global voice
    police = font.Font(family='Arial', size=25, weight='bold')
    police2 = font.Font(family='Arial', size=10, weight='bold')
    photo = PhotoImage(file='logo.png')
    logo = Button(window,
                  image=photo,
                  bg=color_background,
                  fg='white',
                  width=1000,
                  height=100,
                  borderwidth=0,
                  font=police)
    title = Button(window,
                   text="STOCK",
                   bg=color_background,
                   fg='white',
                   width=1000,
                   height=1,
                   borderwidth=0,
                   font=police)
    saut_ligne = Button(window,
                        text="Your email",
                        bg=color_background,
                        fg='white',
                        width=100,
                        height=3,
                        borderwidth=0,
                        font=police2)
    saut_ligne1 = Button(window,
                         text="Your ID",
                         bg=color_background,
                         fg='white',
                         width=100,
                         height=3,
                         borderwidth=0,
                         font=police2)
    button_active = Button(window,
                           text="view your password",
                           bg="black",
                           fg='white',
                           width=40,
                           height=2,
                           borderwidth=0,
                           command=decrypt,
                           font=police2)
    saut_ligne3 = Button(window,
                         bg=color_background,
                         fg='white',
                         width=100,
                         height=3,
                         borderwidth=0,
                         font=police2)
    saut_ligne4 = Button(window,
                         bg=color_background,
                         fg='white',
                         width=100,
                         height=3,
                         borderwidth=0,
                         font=police2)
    saut_ligne5 = Button(window,
                         bg=color_background,
                         fg='white',
                         width=100,
                         height=3,
                         borderwidth=0,
                         font=police2)
    identife = Entry(window, show="*", textvariable=identify, width=30)
    window.title("STOCK|software password")
    logo.pack()
    title.pack()
    saut_ligne.pack()
    mail_entry = Entry(window, textvariable=mail, width=30)
    mail_entry.pack()
    saut_ligne1.pack()
    identife = Entry(window, show="*", textvariable=identify, width=30)
    identife.pack()
    saut_ligne4.pack()
    button_active.pack()
    saut_ligne3.pack()
    valide_voice = Checkbutton(window,
                               text="say the password (voice synthesis)",
                               background=color_background,
                               variable=voice)
    valide_voice.pack()
    window.configure(background=color_background)
    window.geometry('850x690+0+10')
    window.iconbitmap(r"nuage.ico")
    window.resizable(0, 0)
    encrypt()
    window.mainloop()
    sqlite.end_program()
Example #15
0
def encrypt_test():
    global add_identify
    global add_password_up
    global title_2_2
    global connexion
    title_2_2.pack()
    sqlite = Bdd()
    reading = sqlite.hash_bdd()
    identify_encode1 = add_identify.get().encode("utf-8")
    mail_encode = add_mail.get()
    password_encode = add_password_up.get()
    a = 0
    mot_finale = []
    b = 0
    if bcrypt.checkpw(identify_encode1, reading):
        liste = list(add_identify.get())
        while a < 16:
            a += 1
            mot_finale.append(liste[b])
            b += 1
            if b == len(liste):
                b = 0
            else:
                continue
        mot_finale2 = ''.join(mot_finale)
        crypt = Cypher(mot_finale2)
        id1 = crypt.encrypt(mail_encode)
        id2 = crypt.encrypt(password_encode)
        curseur_ajout = connexion.cursor()
        curseur_ajout.executescript('''
     CREATE TABLE IF NOT EXISTS auth(
       mail TEXT,
       pass TEXT)''')
        curseur_ajout.execute("SELECT mail FROM auth WHERE mail=?", [id1])
        result2 = curseur_ajout.fetchall()
        if result2 != []:
            color_resp = "red"
            resp = "The email already exists"
            title2_2 = Button(window_add,
                              text=resp,
                              bg=color_background,
                              fg=color_resp,
                              width=1000,
                              height=2,
                              borderwidth=0,
                              font=police2)
            title2_2.pack()
            return 0
        color_resp = "green"
        curseur_ajout.execute("PRAGMA table_info(auth);")
        curseur_ajout.execute('''INSERT INTO auth (mail,pass) VALUES (?,?)''',
                              (id1, id2))
        connexion.commit()
        resp = "Email and password added"
        title2_2 = Button(window_add,
                          text=resp,
                          bg=color_background,
                          fg=color_resp,
                          width=1000,
                          height=2,
                          borderwidth=0,
                          font=police2)
        title2_2.pack()
        return 0
    else:
        color_resp = "red"
        resp = "The ID is false"
        title2_2 = Button(window_add,
                          text=resp,
                          bg=color_background,
                          fg=color_resp,
                          width=1000,
                          height=2,
                          borderwidth=0,
                          font=police2)
        title2_2.pack()
Example #16
0
 def update_usines_infos(self):
     self.usines = Bdd.recup_sites()
     print(self.usines)
     for i, v in enumerate(self.usines.values()):
         text = f' Site de {v[0]}, {v[1]} à {v[2]}\n'
         self.usines_infos = tk.Label(self.display, text=text, font=('Helvetica', 12)).grid(row=i)
Example #17
0
class Fen4(QDialog):  #  	saisir un nouveau client
    def __init__(self):
        QDialog.__init__(self)
        self.setWindowTitle("IkeoOoooooo")
        self.setGeometry(500, 50, 500, 450)
        self.setStyleSheet("background-color: #003399; color: #FFFFFF")
        try:
            self.data = Bdd()
        except mysql.connector.errors.InterfaceError:
            self.pop = Popup()
            self.pop.connex_err()

        self.vide = QLabel()
        self.invit1 = QLabel()
        self.invit1.setText("Choisir le type de client :")
        self.invit2 = QLabel()
        self.invit2.setText("Nom du client :")
        self.invit3 = QLabel()
        self.invit3.setText("Adresse :")
        self.invit4 = QLabel()
        self.invit4.setText("Ville :")
        self.invit5 = QLabel()
        self.invit5.setText("Pays :")
        self.affect_typecl = QComboBox(self)
        self.affect_typecl.addItems(['Magasin', 'Central d\'achat'])
        self.affect_pays = QComboBox(self)
        self.affect_pays.addItems(self.data.lister_pays())
        self.champ2 = QLineEdit()
        self.champ3 = QLineEdit()
        self.champ4 = QLineEdit()
        self.btok = QPushButton("Entrer dans la base")
        self.btok.resize(100, 30)
        self.btok.clicked.connect(self.appui_ok4)
        self.label = QLabel()

        layout = QVBoxLayout()
        layout.addWidget(self.invit1)
        layout.addWidget(self.affect_typecl)
        layout.addWidget(self.invit2)
        layout.addWidget(self.champ2)
        layout.addWidget(self.invit3)
        layout.addWidget(self.champ3)
        layout.addWidget(self.invit4)
        layout.addWidget(self.champ4)
        layout.addWidget(self.invit5)
        layout.addWidget(self.affect_pays)
        layout.addWidget(self.vide)
        layout.addWidget(self.btok)
        layout.addWidget(self.label)
        self.setLayout(layout)

    def appui_ok4(self):
        typecl = self.affect_typecl.currentText()
        nom = self.champ2.text()
        rue = self.champ3.text()
        ville = self.champ4.text()
        pays = self.affect_pays.currentText()
        if (bool(nom) & bool(ville)):
            try:
                self.data.saisir_client(typecl, nom, rue, ville, pays)
                self.champ2.setText("")
                self.champ3.setText("")
                self.champ4.setText("")
                self.label.setText("Nouveau client entré en base.")
            except:
                self.label.setText(
                    "Une erreur est survenue. Veuillez vérifier votre connexion au serveur et réessayer."
                )
        else:
            self.pop = Popup()
            self.pop.champ_vide_err("'Nom' et 'Ville'")
Example #18
0
#folder = ""


# Feature scaling
class Scale():
    def __init__(self, folder):
        self.filename = "scaler_predict_petrol.save"
        self.folder = folder
        self.sc = joblib.load(self.folder + self.filename)

    def setScaledTraining(self, training_set):
        return self.sc.fit_transform(training_set)

    def save(self):
        joblib.dump(self.sc, self.folder + self.scaler_filename)


bdd = Bdd(True)
training_set = bdd.getTrainingSetPetrol(training_set)
training_set = np.flip(training_set, 0)

scale = Scale(folder)

training_set_scaled = scale.setScaledTraining(training_set)

data = Data(110)
data.filledDataPetrol(training_set_scaled)

ai = AI(folder, 'predict_petrol.h5')
ai.prepetualTraining(data.getXTrain(), data.getYTrain())
ai.save()
Example #19
0
class Fen6(
        QDialog
):  #     saisir un nouveau produit et de le ratacher à un site de production
    def __init__(self):
        QDialog.__init__(self)
        self.setWindowTitle("IkeoOoooooo")
        self.setGeometry(500, 50, 500, 450)
        self.setStyleSheet("background-color: #003399; color: #FFFFFF")
        try:
            self.data = Bdd()
        except mysql.connector.errors.InterfaceError:
            self.pop = Popup()
            self.pop.connex_err()

        self.vide = QLabel()
        self.invit0 = QLabel()
        self.invit0.setText("Nom du produit :")
        self.invit1 = QLabel()
        self.invit1.setText("Référence :")
        self.invit2 = QLabel()
        self.invit2.setText("Description :")
        self.invit3 = QLabel()
        self.invit3.setText("Statut du produit :")
        self.invit4 = QLabel()
        self.invit4.setText("Site de production :")
        self.affect_statut = QComboBox(self)
        self.affect_statut.addItems(
            ['Commercialisation abandonnée', 'Commercialisé'])
        self.affect_site = QComboBox(self)
        self.affect_site.addItems(self.data.lister_sites())
        self.champ0 = QLineEdit()
        self.champ1 = QLineEdit()
        self.champ2 = QLineEdit()
        self.btok = QPushButton("Entrer dans la base")
        self.btok.resize(100, 30)
        self.btok.clicked.connect(self.appui_ok6)
        self.label = QLabel()

        layout = QVBoxLayout()
        layout.addWidget(self.invit0)
        layout.addWidget(self.champ0)
        layout.addWidget(self.invit1)
        layout.addWidget(self.champ1)
        layout.addWidget(self.invit2)
        layout.addWidget(self.champ2)
        layout.addWidget(self.invit3)
        layout.addWidget(self.affect_statut)
        layout.addWidget(self.invit4)
        layout.addWidget(self.affect_site
                         )  ## ajouter possibilité d'affecter plusieurs sites
        layout.addWidget(self.vide)
        layout.addWidget(self.btok)
        layout.addWidget(self.label)
        self.setLayout(layout)

    def appui_ok6(self):
        nompro = self.champ0.text()
        refpro = self.champ1.text()
        descpro = self.champ2.text()
        if self.affect_statut.currentText() == 'Commercialisé':
            statpro = 0
        else:
            statpro = 1
        site1 = self.affect_site.currentText()
        refs_existantes = self.data.lister_references()
        if refpro in refs_existantes:
            self.pop1 = Popup()
            self.pop1.ref_exist_err()
        else:
            if (bool(nompro) & bool(refpro)
                ):  ## faire un if imbriqué pour ref existe déjà ou pas
                try:
                    self.data.ajout_produit(nompro, refpro, descpro, statpro,
                                            site1)
                    self.champ0.setText("")
                    self.champ1.setText("")
                    self.champ2.setText("")
                    self.label.setText("Nouveau produit entré en base.")
                except OperationalError:
                    self.label.setText(
                        "Une erreur est survenue. Vérifiez votre connexion avec le serveur de données."
                    )
            else:
                self.pop = Popup()
                self.pop.champ_vide_err("'Nom' et 'Référence'")
Example #20
0
@author: s.granel
"""

#Imports
import pandas as pd
import numpy as np
import sys
from bdd import Bdd
from data import Data
from ai import AI

folder = sys.argv[1]
#folder = ""
filename = "predict_fuel_v2_400.h5"

idpdv = 33600001
idcarburant = 1
# Jeu d'entrainement
training_set = pd.DataFrame(columns=['A', 'B', 'C', 'D', 'E'])

bdd = Bdd(True)
training_set = bdd.getTrainingSetFuelV2(training_set, idpdv, idcarburant)
training_set = np.flip(training_set, 0)

data = Data(400)
data.filledDataFuelPerpetual(training_set)

ai = AI(folder, filename)
ai.prepetualTraining(data.getXTrain(), data.getYTrain())
ai.save()
Example #21
0
 def recup_prod_name(self):
     self.products = Bdd.recup_products()
     self.prod_names = []
     for product in self.products.keys():
         self.prod_names.append(product)
     return self.prod_names