Commit a90da4d9 authored by Babacar Thiam's avatar Babacar Thiam

update data create and chargement

parents
chargementSGDEexcelsans btl Version 1.2 installation guide
1- Installation on Linux/Unix
To install the sGDE_IsmerQO package, you must install
the Python Programming Language environnement on your system.
The Python software is available for download at http://www.python.org.
Once python is installed on your system, simply download the
sGDE_IsmerQO package from the gitlasso
The package for Linux/Unix comes
as a gzip tar file. To install, follow these steps:
1- tar zxvf sGDE_IsmerQO-1.2.tar.gz
(or gunzip -c sGDE_IsmerQO-1.2.tar.gz | tar xvf -)
2- cd sGDE_IsmerQO-1.2/src
3- su - root (become superuser)
4- python setup.py install
And sGDE_IsmerQO should now be
available for execution.
2- Installation of the source code on Windows
To install the sGDE_IsmerQO package, you must install
the Python Programming Language environnement on your system.
The Python software is available for download at http://www.python.org.
Once python is installed on your system, simply download the
sGDE_IsmerQO package from the gitlasso
The package for windows comes Windows comes as a zip file.
To install, follow these steps:
1- Download the zip file to a directory such as c:\temp
2- Unzip sGDE_IsmerQO-1.2.zip
3- Open a command window
4- cd c:\temp\sGDE_IsmerQO-1.2\src
5- python setup.py install
sGDE_IsmerQO.py should now be
available for execution and will have been copied to the Scripts directory of your Python
installation (e.g., c:\Python24\Scripts). In order to use
the sGDE_IsmerQO.py package from anywhere on your machine, you must
add this directory to your PATH environnement variable.
#
#Makefile pour construire les paquets de
#distribution de odf2netcdf
all:
python setup.py sdist --formats=gztar,zip
python setup.py bdist_wininst
chargementSGDEexcelsans btl Version 1.2 installation guide
1- Installation on Linux/Unix
To install the sGDE_IsmerQO package, you must install
the Python Programming Language environnement on your system.
The Python software is available for download at http://www.python.org.
Once python is installed on your system, simply download the
sGDE_IsmerQO package from the gitlasso
The package for Linux/Unix comes
as a gzip tar file. To install, follow these steps:
1- tar zxvf sGDE_IsmerQO-1.2.tar.gz
(or gunzip -c sGDE_IsmerQO-1.2.tar.gz | tar xvf -)
2- cd sGDE_IsmerQO-1.2
3- su - root (become superuser)
4- python setup.py install
And sGDE_IsmerQO should now be
available for execution.
2- Installation of the source code on Windows
To install the sGDE_IsmerQO package, you must install
the Python Programming Language environnement on your system.
The Python software is available for download at http://www.python.org.
Once python is installed on your system, simply download the
sGDE_IsmerQO package from the gitlasso
The package for windows comes Windows comes as a zip file.
To install, follow these steps:
1- Download the zip file to a directory such as c:\temp
2- Unzip sGDE_IsmerQO-1.2.zip
3- Open a command window
4- cd c:\temp\sGDE_IsmerQO-1.2
5- python setup.py install
sGDE_IsmerQO.py should now be
available for execution and will have been copied to the Scripts directory of your Python
installation (e.g., c:\Python24\Scripts). In order to use
the sGDE_IsmerQO.py package from anywhere on your machine, you must
add this directory to your PATH environnement variable.
import testPostgres as pf
import traceback
import sys
from tkinter import *
from tkinter import ttk, messagebox
import pandas as pd
import json
#import excel2nc as ex
#bd.cursor.execute("select nextval('seq_int')")
#resultat2=bd.cursor.fetchone()
#print(resultat2)
def geoliste(g):
r=[i for i in range(0,len(g)) if not g[i].isdigit()]
return [int(g[0:r[0]]),int(g[r[0]+1:r[1]]),int(g[r[1]+1:r[2]]),int(g[r[2]+1:])]
def centrefenetre(fen):
fen.update_idletasks()
l,h,x,y=geoliste(fen.geometry())
fen.geometry("%dx%d%+d%+d" % (l,h,(fen.winfo_screenwidth()-l)//2,(fen.winfo_screenheight()-h)//2))
class ConnGraphic(Tk):
def __init__(self):
Tk.__init__(self)
#self.minsize(1200,700)
self.title('connexion a la base de donnees')
self.creerWidgets()
##interface pour la mission
def creerWidgets(self):
self.mainWindow = Frame(self, bg="blue")
self.mainWindow.pack(fill=BOTH, expand=1)
self.frameSaisie = Frame(self.mainWindow, bg="blue")
self.frameSaisie.pack(fill=BOTH)
self.frameResult10 = Frame(self.mainWindow)
self.frameResult10.pack(fill=BOTH)
self.frameResult = Frame(self.frameResult10, bd=4, relief=SUNKEN)
self.frameResult.pack(side=LEFT,fill=X)
self.ent_label = Label(self.frameResult,font=('arial',50,'bold'),bd=4,bg="blue", fg="white", text="Information de connection:")
#self.ent_label.configure(font=('Helvetica', 12),bg="blue", fg="white")
self.ent_label.pack(side=TOP,padx=5, pady=5)
self.frameResult00 = Frame(self.frameResult, bd=4, relief=SUNKEN)
self.frameResult00.pack(fill=BOTH,padx=5, pady=5)
self.modified_label53321 = Label(self.frameResult00,font=('arial',50,'bold'),bd=4, text = "host:")
#self.modified_label53321.configure(font=('Helvetica', 12))
#self.modified_label53321.pack(side=LEFT,padx=5, pady=5)
self.modified5332100=StringVar()
self.modified_entry53321= Entry(self.frameResult00,font=('arial',50,'bold'),textvariable=self.modified5332100)
self.modified_label53321.grid(row =0)
self.modified_entry53321.grid(row =0, column=1)
#self.modified_entry53321.pack(side=LEFT,padx=5, pady=5)
#self.modified_entry53321.focus()
#self.frameResult21 = Frame(self.frameResult10, bd=2, relief=SUNKEN)
#self.frameResult21.pack(side=LEFT,fill=Y)
self.modified_label51 = Label(self.frameResult00,font=('arial',50,'bold'),bd=4, text = "db info:")
#self.modified_label51.configure(font=('Helvetica', 12))
#self.modified_label51.pack(side=LEFT,padx=25, pady=25)
self.modified_label51.grid(row =1, column =0)
self.modified51=StringVar()
self.modified_entry51=Entry(self.frameResult00,font=('arial',50,'bold'),textvariable=self.modified51)
self.modified_entry51.grid(row =1, column =1)
self.modified_label4 = Label(self.frameResult00,font=('arial',50,'bold'),bd=4, text = "User:")
#self.modified_label4.configure(font=('Helvetica', 12))
#self.modified_label4.pack(side=LEFT,padx=25, pady=25)
#self.modified_label4.grid(row =0,column =4)
self.modified4=StringVar()
self.modified_entry4 = Entry(self.frameResult00,font=('arial',50,'bold'),bd=4,textvariable=self.modified4)
self.modified_entry4.grid(row =2, column =1)
self.modified_label4.grid(row =2, column =0)
#self.modified_entry4.pack(side=LEFT,padx=25, pady=25)
#self.modified_entry4.focus()
# self.modified_entry4.grid(row =1,column =4)
#self.frameResult2112 = Frame(self.frameResult, bd=2, relief=SUNKEN)
#self.frameResult2112.pack(side=LEFT,fill=Y)
self.modified_label5 = Label(self.frameResult00,font=('arial',50,'bold'),bd=4, text = "Password:")
#self.modified_label5.configure(font=('Helvetica', 12))
self.modified_label5.grid(row =3, column =0)
#self.modified_label5.pack(side=LEFT,padx=25, pady=25)
self.modified5=StringVar()
self.modified_entry5= Entry(self.frameResult00,font=('arial',50,'bold'),textvariable=self.modified5,show="*")
self.modified_entry5.grid(row =3, column =1)
self.btnan = Button(self.mainWindow,font=('arial',50,'bold'),bd=4, text="Se connecter", bg="blue", fg="white", command=self.seconnecter)
self.btnan.pack()
#self.btntablenew = Button(self.mainWindow, text="initialiser",font=('arial',50,'bold'),bd=4, bg="blue", fg="white",command=self.nouveauD)
#self.btntablenew.pack()
#self.frameButtontable1 = Frame(self.frameSaisie, bg="blue")
#self.frameButtontable1.pack(side=LEFT)
#self.btnacceuille = Button(self.frameResult00, text="Acceuil",font=('arial',50,'bold'),bd=4, bg="red", fg="white",command=self.acceuil)
#self.btnacceuille.grid(row=3,column=2)
self.exit_button = Button(self.mainWindow,font=('arial',50,'bold'),bd=4,bg="red",fg="black", text = "Exit", command = self.destroy)
self.exit_button.pack()
def nouveauD(self):
#self.dose.set("")
self.modified5332100.set("")
self.modified51.set("")
self.modified4.set("")
self.modified5.set("")
def seconnecter(self):
playlist = {}
playlist["identifiant"] = {}
playlist["identifiant"]["user"]=self.modified4.get()
playlist["identifiant"]["password"]=self.modified5.get()
playlist["dbinfo"] = {}
playlist["dbinfo"]["db"]=self.modified51.get()
playlist["dbinfo"]["host"]=self.modified5332100.get()
with open('conn1.json', 'w', encoding='utf-8') as f:
json.dump(playlist, f, indent=4)
self.destroy()
#ex.bd.cursor.execute("select nom from groupe order by nom")
#resultat1=ex.bd.cursor.fetchall()
#print("bonjour",resultat1)
#a=pf.recupconf("conn1.json")
#bd=pf.GestionBD(a[0],a[1],a[2],a[3])
#print(a)
import testPostgres as pf
import traceback
import sys
from tkinter import *
from tkinter import ttk, messagebox
import sGDE_IsmerQO as iF
import seconnecter as ex
#ex.bd.cursor.execute("select nextval('seq_int')")
#resultat2=ex.bd.cursor.fetchone()
#print(resultat2)
def geoliste(g):
r=[i for i in range(0,len(g)) if not g[i].isdigit()]
return [int(g[0:r[0]]),int(g[r[0]+1:r[1]]),int(g[r[1]+1:r[2]]),int(g[r[2]+1:])]
def centrefenetre(fen):
fen.update_idletasks()
l,h,x,y=geoliste(fen.geometry())
fen.geometry("%dx%d%+d%+d" % (l,h,(fen.winfo_screenwidth()-l)//2,(fen.winfo_screenheight()-h)//2))
class IntervenantGraphic(Tk):
def __init__(self):
Tk.__init__(self)
#self.minsize(1200,700)
self.title('Gestion Intervenant')
self.creerWidgets()
def creerWidgets(self):
self.mainWindow = Frame(self, bg="blue")
self.mainWindow.pack(fill=BOTH, expand=1)
self.frameSaisie = Frame(self.mainWindow, bg="blue")
self.frameSaisie.pack(fill=BOTH)
#self.frameButtoninter = Frame(self.frameSaisie, bg="blue")
#self.frameButtoninter.pack(side=LEFT)
#self.btninter = Button(self.frameButtoninter, text="Nouveau", bg="blue", fg="white")
#self.btninter.pack(padx=5, pady=5)
self.frameButtonmission = Frame(self.frameSaisie, bg="blue")
self.frameButtonmission.pack(side=LEFT)
self.btnmission = Button(self.frameButtonmission,font=('arial',50,'bold'), text="modifier", bg="blue", fg="white", command=self.modifier)
self.btnmission.pack(padx=5, pady=5)
self.frameButtontable = Frame(self.frameSaisie, bg="blue")
self.frameButtontable.pack(side=LEFT)
self.btntable = Button(self.frameButtontable,font=('arial',50,'bold'), text="supprimer", bg="blue", fg="white",command=self.supprimer)
self.btntable.pack(padx=5, pady=5)
self.frameButtonnew = Frame(self.frameSaisie, bg="blue")
self.frameButtonnew.pack(side=LEFT)
self.btntablenew = Button(self.frameButtonnew,font=('arial',50,'bold'), text="nouveau", bg="blue", fg="white",command=self.nouveauD)
self.btntablenew.pack(padx=5, pady=5)
self.frameButtontable1 = Frame(self.frameSaisie, bg="blue")
self.frameButtontable1.pack(side=LEFT)
self.btnacceuille = Button(self.frameButtontable1,font=('arial',50,'bold'), text="Acceuil", bg="red", fg="white",command=self.acceuil)
self.btnacceuille.pack(padx=5, pady=5)
#self.frameButtonOk = Frame(self.frameSaisie, bg="blue")
#self.frameButtonOk.pack(side=RIGHT)
#self.btnOk = Button(self.frameButtonOk, text="ok", bg="blue", fg="white")
#self.btnOk.pack(padx=5, pady=10)
#self.frameButtonan = Frame(self.frameSaisie, bg="blue")
#self.frameButtonan.pack(side=RIGHT)
#self.btnan = Button(self.frameButtonan, text="annuler", bg="blue", fg="white")
#self.btnan.pack(padx=5, pady=10)
self.frameButtonsauve = Frame(self.frameSaisie, bg="blue")
self.frameButtonsauve.pack(side=RIGHT)
self.btnsauve = Button(self.frameButtonsauve,font=('arial',50,'bold'), text="sauvegarder", bg="blue", fg="white", command=self.sauvegarder)
self.btnsauve.pack(padx=5, pady=10)
self.frameLogin = Frame(self.frameSaisie, bg="blue")
self.frameLogin.pack(side=RIGHT)
self.login = StringVar()
self.loginEntry = Entry(self.frameLogin,font=('arial',50,'bold'), textvariable=self.login, width=50)
self.loginEntry.pack(padx=5, pady=5)
self.loginEntry.focus()
self.frameText = Frame(self.frameSaisie, bg="blue")
self.frameText.pack(side=RIGHT)
self.label = Label(self.frameText,font=('arial',50,'bold'), text="Acronyme Intervenant", bg="blue", fg="white")
self.label.pack(padx=5, pady=5)
#self.dose_label.grid(in_=self.frameSaisie, row=0, column=1, sticky=NS)
#self.dose_entry.grid(in_=self.frameSaisie, row=0, column=1, sticky=NS)
#self.modified_label.grid(in_=self.frameSaisie, row=0, column=1, sticky=NS)
#self.modified_entry.grid(in_=self.frameSaisie, row=0, column=1, sticky=NS)
#self.exit_button.grid(row = 0, column = 3)
self.frameResult10 = Frame(self.mainWindow, bd=4, relief=SUNKEN)
self.frameResult10.pack( fill=BOTH)
self.frameResult = Frame(self.frameResult10, bd=4, relief=SUNKEN)
self.frameResult.pack(side=LEFT,fill=X)
self.ent_label = Label(self.frameResult,font=('arial',20,'bold'),bg="blue", fg="white", text="Identification:")
#self.ent_label.configure(font=('Helvetica', 12),bg="blue", fg="white")
self.ent_label.pack(side=TOP,padx=5, pady=5)
self.frameResult00 = Frame(self.frameResult, bd=4, relief=SUNKEN)
self.frameResult00.pack(fill=BOTH,padx=15, pady=15)
self.dose_label = Label(self.frameResult00,font=('arial',20,'bold'), text = "No Sequentiel:")
#self.dose_label.configure(font=('Helvetica', 12))
#self.dose_label.pack(side=LEFT,padx=25, pady=25,anchor=CENTER)
self.dose = StringVar()
self.dose_entry = Entry(self.frameResult00,font=('arial',50,'bold'),textvariable=self.dose)
#self.dose_entry.pack(side=LEFT,padx=25, pady=25,anchor=CENTER)
#self.dose_entry.focus()
self.dose_label.grid(row =0)
self.dose_entry.grid(row =0,column=1)
self.modified_label = Label(self.frameResult00,font=('arial',20,'bold'), text = "nom:")
#self.modified_label.configure(font=('Helvetica', 12))
#self.modified_label.pack(side=LEFT,padx=25, pady=25,anchor=CENTER)
self.nom=StringVar()
self.modified_entry = Entry(self.frameResult00,font=('arial',50,'bold'),textvariable=self.nom)
#self.modified_entry.pack(side=LEFT,padx=25, pady=25,anchor=CENTER)
#self.modified_entry.focus()
self.modified_label.grid(row =1,column=0)
self.modified_entry.grid(row =1,column=1)
self.modified_label1 = Label(self.frameResult00,font=('arial',20,'bold'), text = "courriel:")
#self.modified_label1.configure(font=('Helvetica', 12))
#self.modified_label1.pack(side=LEFT,padx=25, pady=25,anchor=CENTER)
self.modified1=StringVar()
self.modified_entry1 = Entry(self.frameResult00,font=('arial',50,'bold'),textvariable=self.modified1,width=30)
#self.modified_entry1.pack(side=LEFT,padx=25, pady=25,anchor=CENTER)
#self.modified_entry1.focus()
self.modified_label1.grid(row =2,column=0)
self.modified_entry1.grid(row =2,column=1)
self.frameResult.rowconfigure(0, weight=1)
self.frameResult.columnconfigure(0, weight=1)
self.frameResult22 = Frame(self.frameResult10, bd=4, relief=SUNKEN)
self.frameResult22.pack(side=LEFT,fill=BOTH)
self.ent_label = Label(self.frameResult22,font=('arial',20,'bold'),bg="blue", fg="white", text="Description:")
#self.ent_label.configure(font=('Helvetica', 12),bg="blue", fg="white")
self.ent_label.pack(side=TOP,padx=5, pady=5)
self.frameResult2 = Frame(self.frameResult22, bd=2, relief=SUNKEN)
self.frameResult2.pack( fill=BOTH)
self.modified_label2 = Label(self.frameResult2,font=('arial',20,'bold'), text = "Coordonnees:")
#self.modified_label2.configure(font=('Helvetica', 12))
#self.modified_label2.pack(side=LEFT,padx=25, pady=25)
self.modified2=StringVar()
self.modified_entry2 = Entry(self.frameResult2,font=('arial',50,'bold'),textvariable=self.modified2,width=40)
#self.modified_entry2.pack(side=LEFT,padx=25, pady=25)
#self.modified_entry2.focus()
#self.ent_label.pack(side=TOP,padx=5, pady=5)
self.modified_label2.grid(row =0,column=0)
self.modified_entry2.grid(row =0,column=1)
self.modified_label3 = Label(self.frameResult2,font=('arial',20,'bold'), text = "Nom employeur:")
#self.modified_label3.configure(font=('Helvetica', 12))
#self.modified_label3.pack(side=LEFT,padx=25, pady=25)
self.modified3=StringVar()
self.modified_entry3 = Entry(self.frameResult2,font=('arial',50,'bold'),textvariable=self.modified3)
#self.modified_entry3.pack(side=LEFT,padx=25, pady=25)
#self.modified_entry3.focus()
self.modified_label3.grid(row =1,column=0)
self.modified_entry3.grid(row =1,column=1)
self.modified_label4 = Label(self.frameResult2,font=('arial',20,'bold'), text = "Nombre d'intervenant:")
#self.modified_label4.configure(font=('Helvetica', 12))
#self.modified_label4.pack(side=LEFT,padx=25, pady=25)
self.modified4=StringVar()
self.modified_entry4 = Entry(self.frameResult2,font=('arial',50,'bold'),textvariable=self.modified4)
#self.modified_entry4.pack(side=LEFT,padx=25, pady=25)
#self.modified_entry4.focus()
#self.tree.grid(in_=self.frameResult, row=0, column=1, sticky=NSEW)
#ysb.grid(in_=self.frameResult, row=0, column=1, sticky=NS)
self.modified_label4.grid(row =2,column=0)
self.modified_entry4.grid(row =2,column=1)
self.frameResult1 = Frame(self.mainWindow, bd=4, relief=SUNKEN)
self.frameResult1.pack(expand=1, fill=BOTH, padx=15, pady=15)
self.datacols = ('seq_int','accronyme','name', 'courriel','organisation','coor_int',)
self.tree = ttk.Treeview(columns=self.datacols, show='headings')
ysb = ttk.Scrollbar(orient=VERTICAL, command=self.tree.yview)
self.tree['yscroll'] = ysb.set
self.tree.heading('seq_int', text='seq_int', anchor=CENTER)
self.tree.heading('accronyme', text='accronyme', anchor=CENTER)
self.tree.heading('name', text='name', anchor=CENTER)
self.tree.heading('courriel', text='courriel', anchor=CENTER)
self.tree.heading('organisation', text='organisation', anchor=CENTER)
self.tree.heading('coor_int', text='cordonnees', anchor=CENTER)
self.tree.column('seq_int', anchor=CENTER)
self.tree.column('accronyme', anchor=CENTER)
self.tree.column('name', anchor=CENTER)
self.tree.column('courriel', anchor=CENTER)
self.tree.column('organisation', anchor=CENTER)
self.tree.column('coor_int', anchor=CENTER)
self.tree.grid(in_=self.frameResult1, row=0, column=0, sticky=NSEW)
ysb.grid(in_=self.frameResult1, row=0, column=1, sticky=NS)
self.frameButtolist = Frame(self.mainWindow, bg="blue")
self.frameButtolist.pack(side=RIGHT)
self.btnan = Button(self.frameButtolist,font=('arial',50,'bold'), text="liste intervenant", bg="blue", fg="white", command=self.resultatintervenant)
self.btnan.pack(padx=5, pady=10)
self.frameResult1.rowconfigure(0, weight=1)
self.frameResult1.columnconfigure(0, weight=1)
style = ttk.Style()
style.configure(".", font=('arial',20,'bold'), foreground="white")
style.configure("Treeview.Heading", font=('arial',20,'bold'), foreground='blue')
self.tree.tag_configure('oddrow', background='#06C')
self.tree.tag_configure('evenrow', background='#066', anchor=CENTER)
self.frameHL = Frame(self.mainWindow, bd=4, relief=SUNKEN)
self.HL = ('H(X)')
self.treeHL = ttk.Treeview(columns=self.HL, show='headings', height='0')
self.exit_button = Button(self.mainWindow,font=('arial',50,'bold'),bg="red",fg="black", text = "Exit", command = self.mainWindow.quit)
self.exit_button.pack()
#self.update_layout()
self.tree.bind('<Double-Button-1>', self.on_configure)
#choix d un intervenant
def acceuil(self):
#prob = self.loginEntry.get().strip().split(' ')
try:
self.destroy()
self.groupe= iF.InterfaceGraphic()
#self.groupe.mainloop()
#print("bonjour")
except Exception as err:
print("Requête SQL incorrecte :\n%s\nErreur détectée :\n%s"\
% (err))
messagebox.showerror("Erreur de saisie", "impossible de lancer cette interface.")
def on_configure(self, event):
w,h = event.x, event.y
#natural = self.frameResult1.winfo_reqwidth()
#print(self.tree.identify_element(w,h))
seltxt = self.tree.set(self.tree.selection(), 'accronyme')
if ex.bd.echec:
raise ValueError("Erreur : connection echoue")
#prob = [float(i) for i in prob if i!='' and i!='0']
ex.bd.cursor.execute("""select acr_nom_int,nom,courriel,organisation,coor_int,seq_intervenant from intervenant where acr_nom_int= '%s'"""%seltxt)
resultat=ex.bd.cursor.fetchone()
self.modified1.set(resultat[2])
self.modified2.set(resultat[4])
self.modified3.set(resultat[3])
self.dose.set(resultat[5])
self.login.set(resultat[0])
self.nom.set(resultat[1])
def nouveauD(self):
self.modified1.set("")
self.modified2.set("")
self.modified3.set("")
self.dose.set("")
self.login.set("")
self.nom.set("")
#self.tree.itemconfigure('inner', width= w if w>natural else natural)
#self.tree.configure(scrollregion=self.tree.bbox('.'))
#inserer un intervenant
def sauvegarder(self):
#natural = self.frameResult1.winfo_reqwidth()
#print(self.tree.identify_element(w,h))
#sql.append((str(self.nom.get()).encode("utf8"),str(self.modified1.get()).encode("utf8"),str(self.modified3.get()).encode("utf8"),str(self.modified2.get()).encode("utf8")))
if self.nom.get()=="":
messagebox.showerror("Erreur de requête", "le champs nom intervenant doit contenir une valeur.")
elif self.modified1.get()=="":
messagebox.showerror("Erreur de requête", "le champs courriel intervenant doit contenir une valeur.")
elif self.modified3.get()=="":
messagebox.showerror("Erreur de requête", "le champs organisation intervenant doit contenir une valeur.")
elif self.modified2.get()=="":
messagebox.showerror("Erreur de requête", "le champs Coordonnees intervenant doit contenir une valeur.")
elif self.login.get()=="":
messagebox.showerror("Erreur de requête", "le champs acronyme intervenant doit contenir une valeur.")
else:
ex.bd.cursor.execute("""select acr_nom_int from intervenant where acr_nom_int= '%s'"""%self.login.get())
resultat=ex.bd.cursor.fetchone()
if resultat != None:
messagebox.showerror("Erreur de requête","Existe deja dans la base de données '%s'"""%self.login.get())
else:
#base="""INSERT INTO intervenant (nom,courriel,organisation,coor_int) VALUES (sql)"""
#namedict = {"acronyme":self.login.get(),"nom":self.nom.get(),"cour":self.modified1.get(),"orga":self.modified3.get(),"coord":self.modified2.get()}
#print(namedict["orga"])
base="""INSERT INTO intervenant(acr_nom_int,nom,courriel,organisation,coor_int) VALUES(%s, %s, %s, %s, %s)"""
#base="INSERT INTO intervenant(seq_int,acr_nom_int,nom,courriel,organisation,coor_int) VALUES(%s,%s, %s, %s, %s, %s)"
ex.bd.cursor.execute("""select max(seq_int) from intervenant """)
seq=ex.bd.cursor.fetchone()
#print(seq)
try:
#if ex.bd.echec:
# raise ValueError("Erreur : connection echoue")
#prob = [float(i) for i in prob if i!='' and i!='0']
ex.bd.cursor.execute(base,(self.login.get(),self.nom.get(),self.modified1.get(),self.modified3.get(),self.modified2.get()))
#resultat=ex.bd.cursor.fetchone()
#print(base)
messagebox.showinfo("Information","Insertion reussi avec succes.")
ex.bd.commit()
except Exception as err:
# afficher la requête et le message d'erreur système :
print ("Requête SQL incorrecte :\n%s\nErreur détectée :\n%s"\
% (base, err))
messagebox.showerror("Erreur de saisie", "La requête n est pas correcte.")
ex.bd.rollback()
#self.tree.itemconfigure('inner', width= w if w>natural else natural)
#self.tree.configure(scrollregion=self.tree.bbox('.'))
#modifier un Intervenant
def modifier(self):
#natural = self.frameResult1.winfo_reqwidth()
#print(self.tree.identify_element(w,h))
#sql.append((str(self.nom.get()).encode("utf8"),str(self.modified1.get()).encode("utf8"),str(self.modified3.get()).encode("utf8"),str(self.modified2.get()).encode("utf8")))
if self.dose.get()=="":
messagebox.showerror("Erreur de requête", "le champs seq int doit contenir une valeur.")
elif self.nom.get()=="":
messagebox.showerror("Erreur de requête", "le champs nom intervenant doit contenir une valeur.")
elif self.modified1.get()=="":
messagebox.showerror("Erreur de requête", "le champs courriel intervenant doit contenir une valeur.")
elif self.modified2.get()=="":
messagebox.showerror("Erreur de requête", "le champs Coordonnees intervenant doit contenir une valeur.")
elif self.login.get()=="":
messagebox.showerror("Erreur de requête", "le champs acronyme intervenant doit contenir une valeur.")
else:
#ex.bd.cursor.execute("""select acr_nom_int from intervenant where acr_nom_int= '%s'"""%self.login.get())
#resultat=ex.bd.cursor.fetchone()
#if resultat != None:
# messagebox.showerror("Erreur de requête","Existe deja dans la base de données '%s'"""%self.login.get())
#else:
#base="""INSERT INTO intervenant (nom,courriel,organisation,coor_int) VALUES (sql)"""
#namedict = {"acronyme":self.login.get(),"nom":self.nom.get(),"cour":self.modified1.get(),"orga":self.modified3.get(),"coord":self.modified2.get()}
#print(namedict["orga"])
base="UPDATE intervenant SET acr_nom_int=%s, nom=%s, courriel=%s ,organisation=%s, coor_int=%s where acr_nom_int=%s"
#base="INSERT INTO intervenant(seq_int,acr_nom_int,nom,courriel,organisation,coor_int) VALUES(%s,%s, %s, %s, %s, %s)"
ex.bd.cursor.execute("""select max(seq_int) from intervenant """)
seq=ex.bd.cursor.fetchone()