Ecole 7
Ecole 7
import sys
import os
import subprocess
import platform
import mysql.connector
import fitz
def creer_connexion():
try:
if connexion.is_connected():
print("connexion reussie")
return connexion
except Error as e :
print(f"Erreur : {e}")
return None
class Login(QMainWindow):
def __init__(self):
super().__init__()
# Configuration de la fenêtre
self.setWindowTitle("Gestion d'Inventaire")
self.setStyleSheet("background-color: #FF00FF;")
self.stacked_widget = QStackedWidget()
self.setCentralWidget(self.stacked_widget)
global pages
pages = {}
global history
history = []
# Page de connexion
self.login_page = LoginPage(self)
self.stacked_widget.addWidget(self.login_page)
self.stacked_widget.setCurrentWidget(self.login_page)
class LoginPage(QMainWindow):
def __init__(self,parent):
super().__init__()
self.parent = parent
self.init_ui()
def init_ui(self):
self.setWindowTitle("Page de Connexion")
self.form_frame = QtWidgets.QFrame(self)
self.form_frame.setStyleSheet("""
border-radius: 15px;
""")
self.title.setFont(QtGui.QFont("Arial", 16))
self.username_input = QLineEdit(self.form_frame)
self.password_input = QLineEdit(self.form_frame)
self.password_input.setEchoMode(QLineEdit.Password)
self.resultat_label.setStyleSheet("color: red;")
# Bouton de connexion
self.login_button.clicked.connect(self.authenticate)
def authenticate(self):
username = self.username_input.text()
password = self.password_input.text()
connexion = creer_connexion()
if connexion :
curseur = connexion.cursor()
resultat = curseur.fetchone()
connexion.close()
if resultat:
self.parent.accueil_page= Accueil(self.parent)
self.parent.stacked_widget.addWidget(self.parent.accueil_page)
self.parent.stacked_widget.setCurrentWidget(self.parent.accueil_page)
else:
else:
class Accueil(QMainWindow):
def __init__(self,parent):
super().__init__()
self.parent = parent
self.init_ui()
def init_ui(self):
layout = QVBoxLayout(self)
layout.addWidget(label)
self.form_frame = QtWidgets.QFrame(self)
self.form_frame.setStyleSheet("""
border-radius: 15px;
""")
#panneau lateral
self.side_menu = QFrame(self)
self.side_menu.setGeometry(0,0,0,self.height())
self.enregistrement.setStyleSheet("background-color: #FB00BF;")
self.enregistrement.setGeometry(30,80,150,75)
self.enregistrement.clicked.connect(self.show_enregistrement_page)
self.stagiaire.setStyleSheet("background-color: #FB00BF;")
self.stagiaire.setGeometry(30,180,150,75)
self.stagiaire.clicked.connect(self.show_stagiaire_page)
self.suivie.setGeometry(30,280,150,75)
self.suivie.clicked.connect(self.show_suivi_page)
self.validation.setStyleSheet("background-color: #FB00BF;")
self.validation.setGeometry(30,380,150,75)
#self.validation.clicked.connect(lambda)
self.historique.setStyleSheet("background-color: #FB00BF;")
self.historique.setGeometry(30,480,150,75)
#self.historique.clicked.connect(lambda)
self.deconnection = QPushButton("Deconnection", self.side_menu)
self.deconnection.setStyleSheet("background-color: #FBBBBF;")
self.deconnection.setGeometry(30,640,140,50)
#self.historique.clicked.connect(lambda)
self.toggle_button = QPushButton("|||",self)
self.toggle_button.setGeometry(10,10,80,30)
self.toggle_button.clicked.connect(self.toggle_side_menu)
self.toggle_button.show()
def toggle_side_menu(self):
if self.side_menu.width() == 0:
new_width = 200
else:
new_width = 0
self.animation = QPropertyAnimation(self.side_menu,b"geometry")
self.animation.setDuration(500)
self.animation.setStartValue(QRect(0,0,self.side_menu.width(),self.height()))
self.animation.setEndValue(QRect(0,0,new_width,self.height()))
self.animation.start()
def show_enregistrement_page(self):
self.parent.enregistrement_page = EnregistrementPage(self.parent)
self.parent.stacked_widget.addWidget(self.parent.enregistrement_page)
self.parent.stacked_widget.setCurrentWidget(self.parent.enregistrement_page)
def show_stagiaire_page(self):
self.parent.stagiaire_page = stagiaire(self.parent)
self.parent.stacked_widget.addWidget(self.parent.stagiaire_page)
self.parent.stacked_widget.setCurrentWidget(self.parent.stagiaire_page)
def show_suivi_page(self):
self.parent.suivi_page = SuiviPage(self.parent)
self.parent.stacked_widget.addWidget(self.parent.suivi_page)
self.parent.stacked_widget.setCurrentWidget(self.parent.suivi_page)
def show_validation_page(self):
pages['validation'] = ValidationPage()
self.parent.stacked_widget.addWidget(pages['validation'])
self.parent.stacked_widget.setCurrentWidget(pages['validation'])
def __init__(self,parent):
super().__init__()
self.parent = parent
self.init_ui()
def init_ui(self):
self.setWindowTitle("Choisir le type d'enregistrement")
self.form_frame = QtWidgets.QFrame(self)
self.form_frame.setStyleSheet("""
border-radius: 15px;
""")
self.demande_stage_button.setGeometry(50,50,500,450)
self.demande_stage_button.clicked.connect(self.show_demande_stage_page)
self.stagiaire_button.setGeometry(650,50,500,450)
self.stagiaire_button.clicked.connect(self.show_enregistrement_stagiaire_page)
back_button = QPushButton("Retour",self.form_frame)
back_button.setGeometry(1000,550,100,55)
back_button.clicked.connect(self.go_back)
def show_demande_stage_page(self):
self.parent.demande_stage_page = demande_stage(self.parent)
self.parent.stacked_widget.addWidget(self.parent.demande_stage_page)
self.parent.stacked_widget.setCurrentWidget(self.parent.demande_stage_page)
def show_enregistrement_stagiaire_page(self):
self.parent.enregistrement_stagiaire_page = enregistrement_stagiaire(self.parent)
self.parent.stacked_widget.addWidget(self.parent.enregistrement_stagiaire_page)
self.parent.stacked_widget.setCurrentWidget(self.parent.enregistrement_stagiaire_page)
def go_back(self):
self.parent.stacked_widget.setCurrentWidget(self.parent.accueil_page)
def __init__(self,parent):
super().__init__()
self.parent = parent
self.init_ui()
def init_ui(self):
self.setWindowTitle("Type de Demande")
self.form_frame = QtWidgets.QFrame(self)
self.form_frame.setStyleSheet("""
border-radius: 15px;
""")
self.stage_ecole_button = QPushButton("Stage ecole",self.form_frame)
self.stage_ecole_button.setGeometry(50,120,350,350)
self.stage_ecole_button.clicked.connect(self.show_ecole)
self.immersion_button.setGeometry(425,120,350,350)
self.immersion_button.clicked.connect(self.show_immersion)
self.perfectionnement_button.setGeometry(800,120,350,350)
self.perfectionnement_button.clicked.connect(self.show_renforcement)
back_button = QPushButton("Retour",self.form_frame)
back_button.setGeometry(1000,550,100,55)
back_button.clicked.connect(self.go_back)
def go_back(self):
self.parent.stacked_widget.setCurrentWidget(self.parent.enregistrement_page)
def show_ecole(self):
self.parent.ecole_page = ecole(self.parent)
self.parent.stacked_widget.addWidget(self.parent.ecole_page)
self.parent.stacked_widget.setCurrentWidget(self.parent.ecole_page)
self.parent.immersion_page = immersion(self.parent)
self.parent.stacked_widget.addWidget(self.parent.immersion_page)
self.parent.stacked_widget.setCurrentWidget(self.parent.immersion_page)
def show_renforcement(self):
self.parent.renforcement_page = renforcement(self.parent)
self.parent.stacked_widget.addWidget(self.parent.renforcement_page)
self.parent.stacked_widget.setCurrentWidget(self.parent.renforcement_page)
class enregistrement_stagiaire(QMainWindow):
# enregistrement de stagiaires
def __init__(self,parent):
super().__init__()
self.parent = parent
self.init_ui()
def init_ui(self):
self.setWindowTitle("Type de Demande")
self.form_frame = QtWidgets.QFrame(self)
self.form_frame.setStyleSheet("""
border-radius: 15px;
""")
self.stagiaire_ecole_button = QPushButton("Stage ecole",self.form_frame)
self.stagiaire_ecole_button.setGeometry(50,120,350,350)
self.stagiaire_ecole_button.clicked.connect(self.enre_stagiaire_ecole)
self.stagiaire_immersion_button.setGeometry(425,120,350,350)
self.stagiaire_immersion_button.clicked.connect(self.enre_stagiaire_immersion)
self.stagiaire_renforcement_button.setGeometry(800,120,350,350)
self.stagiaire_renforcement_button.clicked.connect(self.enre_stagiaire_renforcement)
back_button = QPushButton("Retour",self.form_frame)
back_button.setGeometry(1000,550,100,55)
back_button.clicked.connect(self.go_back)
def go_back(self):
self.parent.stacked_widget.setCurrentWidget(self.parent.enregistrement_page)
def enre_stagiaire_ecole(self):
self.parent.enre_stagiaire_ecole = enregistrement_stagiaire_ecole(self.parent)
self.parent.stacked_widget.addWidget(self.parent.enre_stagiaire_ecole)
self.parent.stacked_widget.setCurrentWidget(self.parent.enre_stagiaire_ecole)
def enre_stagiaire_immersion(self):
self.parent.enre_stagiaire_immersion = enregistrement_stagiaire_immersion(self.parent)
self.parent.stacked_widget.addWidget(self.parent.enre_stagiaire_immersion)
self.parent.stacked_widget.setCurrentWidget(self.parent.enre_stagiaire_immersion)
def enre_stagiaire_renforcement(self):
self.parent.enre_stagiaire_renforcement = enregistrement_stagiaire_renforcement(self.parent)
self.parent.stacked_widget.addWidget(self.parent.enre_stagiaire_renforcement)
self.parent.stacked_widget.setCurrentWidget(self.parent.enre_stagiaire_renforcement)
class ecole(QMainWindow):
def __init__(self,parent):
super().__init__()
self.parent = parent
self.init_ui()
def init_ui(self):
self.form_frame = QtWidgets.QFrame(self)
self.form_frame.setStyleSheet("""
background-color: rgba(255, 255, 255, 0.5);
border-radius: 15px;
""")
self.title.setFont(QtGui.QFont("Arial", 16))
self.infop.setFont(QtGui.QFont("Arial", 16))
self.name_input = QLineEdit(self.form_frame)
self.name_input.setPlaceholderText("nom : ")
self.surname_input = QLineEdit(self.form_frame)
self.surname_input.setPlaceholderText("prenom : ")
self.dob_input = QDateEdit(self.form_frame)
self.dob_input.setCalendarPopup (True)
self.lieu_input = QLineEdit(self.form_frame)
self.address_input = QLineEdit(self.form_frame)
self.address_input.setPlaceholderText("addresse : ")
self.phone_input = QLineEdit(self.form_frame)
self.email_input = QLineEdit(self.form_frame)
self.infoa.setFont(QtGui.QFont("Arial", 16))
self.school_input = QLineEdit(self.form_frame)
self.level_input = QLineEdit(self.form_frame)
self.major_input = QLineEdit(self.form_frame)
self.contact_input = QLineEdit(self.form_frame)
self.infodoc.setFont(QtGui.QFont("Arial", 16))
self.cv_button.setGeometry(35,440,250,125)
self.cv_button.clicked.connect(self.upload_cv)
self.id_checkbox_label.setGeometry(300,440,200,30)
self.id_checkbox_yes = QCheckBox("oui",self.form_frame)
self.id_checkbox_yes.setGeometry(600,440,60,40)
self.id_checkbox_no = QCheckBox("non",self.form_frame)
self.id_checkbox_no.setGeometry(700,440,60,40)
self.diplome_checkbox_label.setGeometry(300,500,200,30)
self.diplome_checkbox_yes = QCheckBox("oui",self.form_frame)
self.diplome_checkbox_yes.setGeometry(600,500,60,40)
self.diplome_checkbox_no = QCheckBox("non",self.form_frame)
self.diplome_checkbox_no.setGeometry(700,500,60,40)
self.lettre_checkbox_label.setGeometry(300,560,200,30)
self.lettre_checkbox_yes = QCheckBox("oui",self.form_frame)
self.lettre_checkbox_yes.setGeometry(600,560,60,40)
self.lettre_checkbox_no = QCheckBox("non",self.form_frame)
self.lettre_checkbox_no.setGeometry(700,560,60,40)
self.photo_label = QLabel(self.form_frame)
self.photo_label.hide()
self.photo_button.clicked.connect(self.upload_photo)
save_button = QPushButton("Sauvegarder",self.form_frame)
save_button.setGeometry(800,460,150,35)
save_button.clicked.connect(self.save_data)
back_button = QPushButton("Retour",self.form_frame)
back_button.setGeometry(1000,550,100,55)
back_button.clicked.connect(self.go_back)
def upload_cv(self):
options = QFileDialog.Options()
if file_name:
self.cv_button.setText(file_name)
def upload_letter(self):
options = QFileDialog.Options()
if file_name:
self.letter_button.setText(file_name)
def upload_photo(self):
options = QFileDialog.Options()
if file_name :
try:
pixmap = QPixmap(file_name)
if pixmap.isNull():
return
self.photo_label.setPixmap(pixmap)
self.photo_label.show()
self.photo_button.hide()
self.photo_path = file_name
except Exception as e :
def save_data(self):
nom = self.name_input.text()
prenom = self.surname_input.text()
date_naissance = self.dob_input.date().toString("dd/MM/yyyy")
lieu_naissance = self.lieu_input.text()
adresse = self.address_input.text()
telephone = self.phone_input.text()
adresse_email = self.email_input.text()
etablissement = self.school_input.text()
filiere = self.major_input.text()
diplome_prepa = self.level_input.text()
contact_urgent= self.contact_input.text()
cv_file = self.cv_button.text()
photo_file = getattr(self,'photo_path',None)
else:
connexion = creer_connexion()
if connexion:
try:
curseur = connexion.cursor()
VALUES(%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)
"""
valeurs =
(nom,prenom,date_naissance,lieu_naissance,adresse,telephone,adresse_email,etablissement,filiere,dipl
ome_prepa,contact_urgent,cv_file,piece_identite,admissibilité,demande,photo_file,"en attente")
curseur.execute(requete,valeurs)
connexion.commit()
# except Error as e:
finally:
connexion.close()
def go_back(self):
self.parent.stacked_widget.setCurrentWidget(self.parent.demande_stage_page)
class immersion(QMainWindow):
def __init__(self,parent):
super().__init__()
self.parent = parent
self.init_ui()
def init_ui(self):
self.form_frame = QtWidgets.QFrame(self)
self.form_frame.setStyleSheet("""
border-radius: 15px;
""")
self.title.setFont(QtGui.QFont("Arial", 16))
self.infop.setFont(QtGui.QFont("Arial", 16))
self.name_input = QLineEdit(self.form_frame)
self.name_input.setPlaceholderText("nom : ")
self.surname_input = QLineEdit(self.form_frame)
self.surname_input.setPlaceholderText("prenom : ")
self.dob_input = QDateEdit(self.form_frame)
self.dob_input.setCalendarPopup (True)
self.lieu_input = QLineEdit(self.form_frame)
self.address_input = QLineEdit(self.form_frame)
self.address_input.setPlaceholderText("addresse : ")
self.phone_input = QLineEdit(self.form_frame)
self.email_input = QLineEdit(self.form_frame)
self.infoa.setFont(QtGui.QFont("Arial", 16))
self.school_input = QLineEdit(self.form_frame)
self.level_input = QLineEdit(self.form_frame)
self.contact_input = QLineEdit(self.form_frame)
self.infodoc.setFont(QtGui.QFont("Arial", 16))
self.cv_button.setGeometry(35,440,250,125)
self.cv_button.clicked.connect(self.upload_cv)
self.id_checkbox_label.setGeometry(300,440,200,30)
self.id_checkbox_yes = QCheckBox("oui",self.form_frame)
self.id_checkbox_yes.setGeometry(600,440,60,40)
self.id_checkbox_no = QCheckBox("non",self.form_frame)
self.id_checkbox_no.setGeometry(700,440,60,40)
self.attestation_checkbox_label.setGeometry(300,500,200,30)
self.attestation_checkbox_yes = QCheckBox("oui",self.form_frame)
self.attestation_checkbox_yes.setGeometry(600,500,60,40)
self.attestation_checkbox_no = QCheckBox("non",self.form_frame)
self.attestation_checkbox_no.setGeometry(700,500,60,40)
self.lettre_checkbox_label.setGeometry(300,560,200,30)
self.lettre_checkbox_yes = QCheckBox("oui",self.form_frame)
self.lettre_checkbox_yes.setGeometry(600,560,60,40)
self.lettre_checkbox_no = QCheckBox("non",self.form_frame)
self.lettre_checkbox_no.setGeometry(700,560,60,40)
self.photo_label = QLabel(self.form_frame)
self.photo_label.hide()
self.photo_button.clicked.connect(self.upload_photo)
save_button = QPushButton("Sauvegarder",self.form_frame)
save_button.setGeometry(800,460,150,35)
save_button.clicked.connect(self.save_data)
back_button = QPushButton("Retour",self.form_frame)
back_button.setGeometry(1000,550,100,55)
back_button.clicked.connect(self.go_back)
def upload_cv(self):
options = QFileDialog.Options()
if file_name:
self.cv_button.setText(file_name)
def upload_letter(self):
options = QFileDialog.Options()
if file_name:
self.letter_button.setText(file_name)
def upload_photo(self):
options = QFileDialog.Options()
if file_name :
try:
pixmap = QPixmap(file_name)
if pixmap.isNull():
return
self.photo_label.show()
self.photo_button.hide()
self.photo_path = file_name
except Exception as e :
def save_data(self):
nom = self.name_input.text()
prenom = self.surname_input.text()
date_naissance = self.dob_input.date().toString("dd/MM/yyyy")
lieu_naissance = self.lieu_input.text()
adresse = self.address_input.text()
telephone = self.phone_input.text()
adresse_email = self.email_input.text()
etablissement = self.school_input.text()
niveau = self.level_input.text()
contact_urgence = self.contact_input.text()
cv_file = self.cv_button.text()
photo_file = getattr(self,'photo_path',None)
else:
connexion = creer_connexion()
if connexion:
try:
curseur = connexion.cursor()
VALUES(%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)
"""
valeurs =
(nom,prenom,date_naissance,lieu_naissance,adresse,telephone,adresse_email,etablissement,niveau,co
ntact_urgence,cv_file,piece_identite,attestation,demande,photo_file,"en attente")
curseur.execute(requete,valeurs)
connexion.commit()
except Error as e:
finally:
connexion.close()
def go_back(self):
self.parent.stacked_widget.setCurrentWidget(self.parent.demande_stage_page)
class renforcement(QMainWindow):
def __init__(self,parent):
super().__init__()
self.parent = parent
self.init_ui()
def init_ui(self):
self.form_frame = QtWidgets.QFrame(self)
self.form_frame.setStyleSheet("""
border-radius: 15px;
""")
self.title.setFont(QtGui.QFont("Arial", 16))
self.infop.setFont(QtGui.QFont("Arial", 16))
self.name_input = QLineEdit(self.form_frame)
self.name_input.setPlaceholderText("nom : ")
self.surname_input = QLineEdit(self.form_frame)
self.surname_input.setPlaceholderText("prenom : ")
self.daten_label = QLabel("Date de naissance", self.form_frame)
self.dob_input = QDateEdit(self.form_frame)
self.dob_input.setCalendarPopup (True)
self.lieu_input = QLineEdit(self.form_frame)
self.address_input = QLineEdit(self.form_frame)
self.address_input.setPlaceholderText("addresse : ")
self.phone_input = QLineEdit(self.form_frame)
self.email_input = QLineEdit(self.form_frame)
self.infoa.setFont(QtGui.QFont("Arial", 16))
self.school_input = QLineEdit(self.form_frame)
self.diplome_input = QLineEdit(self.form_frame)
self.major_input = QLineEdit(self.form_frame)
self.contact_input = QLineEdit(self.form_frame)
self.infodoc.setFont(QtGui.QFont("Arial", 16))
self.cv_button.setGeometry(35,440,250,125)
self.cv_button.clicked.connect(self.upload_cv)
self.id_checkbox_label.setGeometry(300,440,200,30)
self.id_checkbox_yes = QCheckBox("oui",self.form_frame)
self.id_checkbox_yes.setGeometry(600,440,60,40)
self.id_checkbox_no = QCheckBox("non",self.form_frame)
self.id_checkbox_no.setGeometry(700,440,60,40)
self.diplome_checkbox_label = QLabel("diplome",self.form_frame)
self.diplome_checkbox_label.setGeometry(300,500,200,30)
self.diplome_checkbox_yes = QCheckBox("oui",self.form_frame)
self.diplome_checkbox_yes.setGeometry(600,500,60,40)
self.diplome_checkbox_no = QCheckBox("non",self.form_frame)
self.diplome_checkbox_no.setGeometry(700,500,60,40)
self.lettre_checkbox_label.setGeometry(300,560,200,30)
self.lettre_checkbox_yes = QCheckBox("oui",self.form_frame)
self.lettre_checkbox_yes.setGeometry(600,560,60,40)
self.lettre_checkbox_no = QCheckBox("non",self.form_frame)
self.lettre_checkbox_no.setGeometry(700,560,60,40)
self.photo_label = QLabel(self.form_frame)
self.photo_label.hide()
self.photo_button.clicked.connect(self.upload_photo)
save_button = QPushButton("Sauvegarder",self.form_frame)
save_button.setGeometry(800,460,150,35)
save_button.clicked.connect(self.save_data)
back_button = QPushButton("Retour",self.form_frame)
back_button.setGeometry(1000,550,100,55)
back_button.clicked.connect(self.go_back)
def upload_cv(self):
options = QFileDialog.Options()
if file_name:
self.cv_button.setText(file_name)
def upload_letter(self):
options = QFileDialog.Options()
if file_name:
self.letter_button.setText(file_name)
def upload_photo(self):
options = QFileDialog.Options()
if file_name :
try:
pixmap = QPixmap(file_name)
if pixmap.isNull():
return
self.photo_label.setPixmap(pixmap)
self.photo_label.show()
self.photo_button.hide()
self.photo_path = file_name
except Exception as e :
def save_data(self):
nom = self.name_input.text()
prenom = self.surname_input.text()
date_naissance = self.dob_input.date().toString("dd/MM/yyyy")
lieu_naissance = self.lieu_input.text()
adresse = self.address_input.text()
telephone = self.phone_input.text()
adresse_email = self.email_input.text()
etablissement = self.school_input.text()
diplome = self.diplome_input.text()
filiere = self.major_input.text()
contact_urgence = self.contact_input.text()
cv_file = self.cv_button.text()
photo_file = getattr(self,'photo_path',None)
else:
connexion = creer_connexion()
if connexion:
try:
curseur = connexion.cursor()
VALUES(%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)
"""
valeurs =
(nom,prenom,date_naissance,lieu_naissance,adresse,telephone,adresse_email,etablissement,diplome,fi
liere,contact_urgence,cv_file,piece_identite,diplome_,demande,photo_file,"en attente")
curseur.execute(requete,valeurs)
connexion.commit()
except Error as e:
connexion.close()
def go_back(self):
self.parent.stacked_widget.setCurrentWidget(self.parent.demande_stage_page)
def __init__(self,parent):
super().__init__()
self.parent = parent
self.initUI()
self.show_stagiaire_ecole()
def initUI(self):
self.form_frame = QtWidgets.QFrame(self)
self.form_frame.setStyleSheet("""
border-radius: 15px;
""")
def show_stagiaire_ecole(self):
connexion = creer_connexion()
if connexion:
try:
curseur = connexion.cursor()
stagiaires = curseur.fetchall()
y = 50
self.create_stagiaire_ecole_bloc(id,nom,prenom,telephone , photo,statut,y)
y+=175
except Error as e:
finally:
connexion.close()
frame = QFrame(self)
frame.setGeometry(140,y,550,180)
frame.setFrameShape(QFrame.Box)
nom_label.setGeometry(180,10,300,50)
nom_label.setFont(QtGui.QFont("Arial", 16))
prenom_label.setGeometry(180,40,300,50)
prenom_label.setFont(QtGui.QFont("Arial", 16))
telephone_label.setGeometry(180,70,300,50)
telephone_label.setFont(QtGui.QFont("Arial", 16))
statut_label.setGeometry(180,100,300,50)
statut_label.setFont(QtGui.QFont("Arial", 16))
if photo:
pixmap = QPixmap(photo).scaled(130,130,Qt.KeepAspectRatio,Qt.SmoothTransformation)
photo_label = QLabel(frame)
photo_label.setPixmap(pixmap)
photo_label.setGeometry(10,25,100,100)
back_button = QPushButton("Retour",self.form_frame)
back_button.setGeometry(1000,550,100,55)
back_button.clicked.connect(self.go_back)
def show_stagiaire_ecole_form(self,id_stagiaire):
self.setWindowTitle("Formulaire complet du stagiaire")
self.stacked = QStackedWidget()
self.setCentralWidget(self.stacked)
self.stagiaire_ecole_Page = QWidget()
self.stacked.addWidget(self.stagiaire_ecole_Page)
self.form_frame = QtWidgets.QFrame(self.stagiaire_ecole_Page)
self.form_frame.setStyleSheet("""
border-radius: 15px;
""")
connexion = creer_connexion()
if connexion:
try:
curseur = connexion.cursor()
curseur.execute("SELECT nom,prenom,date_naissance,
lieu_naissance,adresse,telephone,adresse_email,etablissement,filiere,diplome_prepa,contact_urgence,c
v,piece_identite,admissibilite,demande,photo,statut FROM stage_ecole WHERE id = %s",(id_stagiaire,))
stagiaire = curseur.fetchone()
print(id_stagiaire)
print(stagiaire)
if stagiaire:
(nom,prenom,date_naissance,lieu_naissance,adresse,telephone,adresse_email,etablissement,filiere,dipl
ome_prepa,contact_urgence,cv_file,piece_identite,admissibilite,demande,photo,statut) = stagiaire
self.title = QLabel("ENREGISTREMENT DE STAGIAIRE (STAGE ECOLE) ", self.form_frame)
self.title.setFont(QtGui.QFont("Arial", 16))
self.infop.setFont(QtGui.QFont("Arial", 16))
self.name_input = QLineEdit(self.form_frame)
self.name_input.setText(nom)
self.surname_input = QLineEdit(self.form_frame)
self.surname_input.setText(prenom)
self.dob_input = QDateEdit(self.form_frame)
self.dob_input.setCalendarPopup (True)
self.dob_input.setDate(QDate.fromString(date_naissance,"yyyy-MM-dd"))
self.lieu_input = QLineEdit(self.form_frame)
self.lieu_input.setGeometry(970, 190, 220, 40)
self.lieu_input.setText(lieu_naissance)
self.address_input = QLineEdit(self.form_frame)
self.address_input.setText(adresse)
self.phone_input = QLineEdit(self.form_frame)
self.phone_input.setText(telephone)
self.email_input = QLineEdit(self.form_frame)
self.email_input.setText(adresse_email)
self.infoa.setFont(QtGui.QFont("Arial", 16))
self.school_input = QLineEdit(self.form_frame)
self.school_input.setText(etablissement)
self.level_input = QLineEdit(self.form_frame)
self.level_input.setText(diplome_prepa)
self.major_input = QLineEdit(self.form_frame)
self.major_input.setGeometry(600, 320, 260, 40)
self.major_input.setText(filiere)
self.contact_input = QLineEdit(self.form_frame)
self.contact_input.setText(contact_urgence)
self.infodoc.setFont(QtGui.QFont("Arial", 16))
self.cv_file = cv_file
self.cv_button.setGeometry(35,440,250,125)
self.cv_button.clicked.connect(self.voir_cv)
self.id_checkbox_label.setGeometry(300,440,200,30)
self.id_checkbox_yes = QCheckBox("oui",self.form_frame)
self.id_checkbox_yes.setGeometry(600,440,60,40)
self.id_checkbox_no = QCheckBox("non",self.form_frame)
self.id_checkbox_no.setGeometry(700,440,60,40)
if piece_identite == 'oui':
self.id_checkbox_yes.setChecked(True)
else:
self.id_checkbox_no.setChecked(True)
self.diplome_checkbox_label = QLabel("admissibilité du diplome",self.form_frame)
self.diplome_checkbox_label.setGeometry(300,500,200,30)
self.diplome_checkbox_yes = QCheckBox("oui",self.form_frame)
self.diplome_checkbox_yes.setGeometry(600,500,60,40)
self.diplome_checkbox_no = QCheckBox("non",self.form_frame)
self.diplome_checkbox_no.setGeometry(700,500,60,40)
if admissibilite == 'oui':
self.diplome_checkbox_yes.setChecked(True)
else:
self.diplome_checkbox_no.setChecked(True)
self.lettre_checkbox_label.setGeometry(300,560,200,30)
self.lettre_checkbox_yes = QCheckBox("oui",self.form_frame)
self.lettre_checkbox_yes.setGeometry(600,560,60,40)
self.lettre_checkbox_no = QCheckBox("non",self.form_frame)
self.lettre_checkbox_no.setGeometry(700,560,60,40)
if demande == 'oui':
self.lettre_checkbox_yes.setChecked(True)
else:
self.lettre_checkbox_no.setChecked(True)
self.photo_label = QLabel(self.form_frame)
photo_pixmap = QPixmap(photo).scaled(180,150,Qt.KeepAspectRatio)
self.photo_view = QLabel(self)
self.photo_view.setPixmap(photo_pixmap)
self.statut_input = QLineEdit(self.form_frame)
self.statut_input.setText(statut)
accept_button = QPushButton("Accepter",self.form_frame)
accept_button.setGeometry(800,460,150,35)
refus_button = QPushButton("refusé",self.form_frame)
refus_button.setGeometry(800,660,150,35)
back_button = QPushButton("Retour",self.form_frame)
back_button.setGeometry(1000,550,100,55)
back_button.clicked.connect(self.go_back)
except Error as e:
finally:
connexion.close()
def voir_cv(self):
if self.cv_file:
if os.path.exists(self.cv_file):
try:
if os.name == 'nt':
os.startfile(self.cv_file)
subprocess.call(('xdg*open',self.cv_file))
else:
except Exception as e :
else:
else:
def accept_stagiaire(self,id_stagiaire):
connexion = creer_connexion()
if connexion:
try:
curseur = connexion.cursor()
connexion.commit()
self.nouveau_stagiaire(id_stagiaire)
finally:
connexion.close()
def refus_stagiaire(self,id_stagiaire):
connexion = creer_connexion()
if connexion:
try:
curseur = connexion.cursor()
connexion.commit()
finally:
connexion.close()
def nouveau_stagiaire(self,id_stagiaire):
self.form_frame = QtWidgets.QFrame(self)
self.form_frame.setStyleSheet("""
border-radius: 15px;
""")
connexion = creer_connexion()
if connexion:
try:
curseur = connexion.cursor()
curseur.execute("SELECT nom,prenom,date_naissance,
lieu_naissance,adresse,telephone,adresse_email,contact_urgence,cv,photo FROM stage_ecole WHERE
id = %s",(id_stagiaire,))
stagiaire = curseur.fetchone()
if stagiaire:
(nom,prenom,date_naissance,lieu_naissance,adresse,telephone,adresse_email,contact_urgence,cv_file,
photo) = stagiaire
self.title.setFont(QtGui.QFont("Arial", 16))
self.infop.setFont(QtGui.QFont("Arial", 16))
self.name_input = QLineEdit(self.form_frame)
self.name_input.setText(nom)
self.surname_input = QLineEdit(self.form_frame)
self.surname_input.setText(prenom)
self.dob_input = QDateEdit(self.form_frame)
self.dob_input.setCalendarPopup (True)
self.dob_input.setDate(QDate.fromString(date_naissance,"yyyy-MM-dd"))
self.lieu_input = QLineEdit(self.form_frame)
self.lieu_input.setText(lieu_naissance)
self.address_input = QLineEdit(self.form_frame)
self.address_input.setText(adresse)
self.phone_input = QLineEdit(self.form_frame)
self.phone_input.setText(telephone)
self.email_input = QLineEdit(self.form_frame)
self.email_input.setText(adresse_email)
self.infoa.setFont(QtGui.QFont("Arial", 16))
self.contact_input = QLineEdit(self.form_frame)
self.contact_input.setText(contact_urgence)
self.photo_ste = photo
if photo:
photo_pixmap = QPixmap(photo).scaled(180,150,Qt.KeepAspectRatio)
self.photo_view = QLabel(self)
self.photo_view.setPixmap(photo_pixmap)
self.service_input = QLineEdit(self.form_frame)
self.siege_input = QLineEdit(self.form_frame)
self.date_debut_input = QDateEdit(self.form_frame)
self.date_debut_input.setCalendarPopup (True)
self.date_fin_input = QDateEdit(self.form_frame)
self.date_fin_input.setCalendarPopup (True)
self.date_debut_input.dateChanged.connect(self.update_date_fin)
self.photo_label = QLabel(self.form_frame)
self.statut_input = QLineEdit(self.form_frame)
self.statut_input.setGeometry(975, 320, 300, 40)
self.statut_input.setText("stagiaire")
self.cv_file = cv_file
if cv_file:
self.cv_button.setGeometry(35,440,250,125)
self.cv_button.clicked.connect(self.voir_cv)
save_button = QPushButton("Sauvegarder",self.form_frame)
save_button.setGeometry(800,460,150,35)
save_button.clicked.connect(self.save_data)
back_button = QPushButton("Retour",self.form_frame)
back_button.setGeometry(1000,550,100,55)
back_button.clicked.connect(self.go_back)
except Error as e:
finally:
connexion.close()
def update_date_fin(self):
date_debut = self.date_debut_input.date()
date_fin = date_debut.addMonths(3)
self.date_fin_input.setDate(date_fin)
def save_data(self,id_stagiaire):
nom_ste = self.name_input.text()
prenom_ste = self.surname_input.text()
date_naissance_ste = self.dob_input.date().toString("dd/MM/yyyy")
lieu_naissance_ste = self.lieu_input.text()
adresse_ste= self.address_input.text()
telephone_ste = self.phone_input.text()
adresse_email_ste = self.email_input.text()
service_ste = self.service_input.text()
siege_ste = self.siege_input.text
date_debut_ste = self.date_debut_input.date().toString("yyyy-MM-dd")
date_fin_ste = self.date_fin_input.date().toString("yyyy-MM-dd")
cv_ste = self.cv_file
photo_ste = self.photo_ste
statut_ste = self.statut_input.text()
contact_urgence_ste = self.contact_input.text()
else:
connexion = creer_connexion()
if connexion:
try:
curseur = connexion.cursor()
VALUES(%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)
"""
valeurs = (nom_ste,prenom_ste,date_naissance_ste,
lieu_naissance_ste,adresse_ste,telephone_ste,adresse_email_ste,service_ste,date_debut_ste,date_fin_
ste,contact_urgence_ste,cv_ste,photo_ste,statut_ste)
curseur.execute(requete,valeurs)
connexion.commit()
curseur2 = connexion.cursor()
curseur2.execute(requete2,(id_stagiaire,))
connexion.commit()
finally:
connexion.close()
def go_back(self):
self.parent.stacked_widget.setCurrentWidget(self.parent.enregistrement_page)
def __init__(self,parent):
super().__init__()
self.parent = parent
self.initUI()
self.show_stagiaire_immersion()
def initUI(self):
self.stacked = QStackedWidget()
self.setCentralWidget(self.stacked)
self.form_frame = QtWidgets.QFrame(self)
self.form_frame.setStyleSheet("""
border-radius: 15px;
""")
def show_stagiaire_immersion(self):
connexion = creer_connexion()
if connexion:
try:
curseur = connexion.cursor()
stagiaires = curseur.fetchall()
y = 50
self.create_stagiaire_immersion_bloc(id,nom,prenom,telephone , photo,statut,y)
y+=175
except Error as e:
finally:
connexion.close()
frame = QFrame(self)
frame.setGeometry(140,y,550,180)
frame.setFrameShape(QFrame.Box)
nom_label.setGeometry(180,10,300,50)
nom_label.setFont(QtGui.QFont("Arial", 16))
prenom_label.setGeometry(180,40,300,50)
prenom_label.setFont(QtGui.QFont("Arial", 16))
telephone_label.setGeometry(180,70,300,50)
telephone_label.setFont(QtGui.QFont("Arial", 16))
statut_label = QLabel(f"statut : {statut}", frame)
statut_label.setGeometry(180,100,300,50)
statut_label.setFont(QtGui.QFont("Arial", 16))
if photo:
pixmap = QPixmap(photo).scaled(130,130,Qt.KeepAspectRatio,Qt.SmoothTransformation)
photo_label = QLabel(frame)
photo_label.setPixmap(pixmap)
photo_label.setGeometry(10,25,100,100)
back_button = QPushButton("Retour",self.form_frame)
back_button.setGeometry(1000,550,100,55)
back_button.clicked.connect(self.go_back)
def show_stagiaire_immersion_form(self,id_stagiaire):
self.stacked = QStackedWidget()
self.setCentralWidget(self.stacked)
self.stagiaire_immersion_Page = QWidget()
self.stacked.addWidget(self.stagiaire_immersion_Page)
self.form_frame = QtWidgets.QFrame(self)
self.form_frame.setStyleSheet("""
border-radius: 15px;
""")
connexion = creer_connexion()
if connexion:
try:
curseur = connexion.cursor()
curseur.execute("SELECT nom,prenom,date_naissance,
lieu_naissance,adresse,telephone,adresse_email,etablissement,niveau,contact_urgence,cv,piece_identit
e,attestation,demande,photo,statut FROM stage_immersion WHERE id = %s",(id_stagiaire,))
stagiaire = curseur.fetchone()
print(id_stagiaire)
print(stagiaire)
if stagiaire:
(nom,prenom,date_naissance,lieu_naissance,adresse,telephone,adresse_email,etablissement,niveau,co
ntact_urgence,cv_file,piece_identite,attestation,demande,photo_file,statut) = stagiaire
self.title.setFont(QtGui.QFont("Arial", 16))
self.infop.setFont(QtGui.QFont("Arial", 16))
self.name_input = QLineEdit(self.form_frame)
self.name_input.setText(nom)
self.surname_input = QLineEdit(self.form_frame)
self.surname_input.setText(prenom)
self.dob_input = QDateEdit(self.form_frame)
self.dob_input.setCalendarPopup (True)
self.dob_input.setDate(QDate.fromString(date_naissance,"yyyy-MM-dd"))
self.lieu_input = QLineEdit(self.form_frame)
self.lieu_input.setText(lieu_naissance)
self.address_input = QLineEdit(self.form_frame)
self.address_input.setText(adresse)
self.phone_input = QLineEdit(self.form_frame)
self.email_input = QLineEdit(self.form_frame)
self.email_input.setText(adresse_email)
self.infoa.setFont(QtGui.QFont("Arial", 16))
self.school_input = QLineEdit(self.form_frame)
self.school_input.setText(etablissement)
self.level_input = QLineEdit(self.form_frame)
self.level_input.setText(niveau)
self.contact_input = QLineEdit(self.form_frame)
self.contact_input.setText(contact_urgence)
self.infodoc.setFont(QtGui.QFont("Arial", 16))
self.cv_file = cv_file
self.cv_button.clicked.connect(self.voir_cv)
self.id_checkbox_label.setGeometry(300,440,200,30)
self.id_checkbox_yes = QCheckBox("oui",self.form_frame)
self.id_checkbox_yes.setGeometry(600,440,60,40)
self.id_checkbox_no = QCheckBox("non",self.form_frame)
self.id_checkbox_no.setGeometry(700,440,60,40)
if piece_identite == 'oui':
self.id_checkbox_yes.setChecked(True)
else:
self.id_checkbox_no.setChecked(True)
self.attestation_checkbox_label.setGeometry(300,500,200,30)
self.attestation_checkbox_yes = QCheckBox("oui",self.form_frame)
self.attestation_checkbox_yes.setGeometry(600,500,60,40)
self.attestation_checkbox_no = QCheckBox("non",self.form_frame)
self.attestation_checkbox_no.setGeometry(700,500,60,40)
if attestation == 'oui':
self.attestation_checkbox_yes.setChecked(True)
else:
self.attestation_checkbox_no.setChecked(True)
self.lettre_checkbox_label = QLabel("lettre de demande de stage",self.form_frame)
self.lettre_checkbox_label.setGeometry(300,560,200,30)
self.lettre_checkbox_yes = QCheckBox("oui",self.form_frame)
self.lettre_checkbox_yes.setGeometry(600,560,60,40)
self.lettre_checkbox_no = QCheckBox("non",self.form_frame)
self.lettre_checkbox_no.setGeometry(700,560,60,40)
if demande == 'oui':
self.lettre_checkbox_yes.setChecked(True)
else:
self.lettre_checkbox_no.setChecked(True)
self.photo_label = QLabel(self.form_frame)
photo_pixmap = QPixmap(photo_file).scaled(180,150,Qt.KeepAspectRatio)
self.photo_view = QLabel(self)
self.photo_view.setPixmap(photo_pixmap)
self.statut_input = QLineEdit(self.form_frame)
self.statut_input.setText(statut)
accept_button = QPushButton("Accepter",self.form_frame)
accept_button.setGeometry(800,460,150,35)
refus_button = QPushButton("refusé",self.form_frame)
refus_button.setGeometry(800,660,150,35)
back_button = QPushButton("Retour",self.form_frame)
back_button.setGeometry(1000,550,100,55)
back_button.clicked.connect(self.go_back)
except Error as e:
finally:
connexion.close()
def voir_cv(self):
if self.cv_file:
if os.path.exists(self.cv_file):
try:
if os.name == 'nt':
os.startfile(self.cv_file)
subprocess.call(('xdg*open',self.cv_file))
else:
except Exception as e :
else:
def accept_stagiaire(self,id_stagiaire):
connexion = creer_connexion()
if connexion:
try:
curseur = connexion.cursor()
connexion.commit()
self.nouveau_stagiaire(id_stagiaire)
finally:
connexion.close()
def refus_stagiaire(self,id_stagiaire):
connexion = creer_connexion()
if connexion:
try:
curseur = connexion.cursor()
connexion.commit()
finally:
connexion.close()
def nouveau_stagiaire(self,id_stagiaire):
self.setWindowTitle("Formulaire du nouveau stagiaire")
self.form_frame = QtWidgets.QFrame(self)
self.form_frame.setStyleSheet("""
border-radius: 15px;
""")
connexion = creer_connexion()
if connexion:
try:
curseur = connexion.cursor()
curseur.execute("SELECT nom,prenom,date_naissance,
lieu_naissance,adresse,telephone,adresse_email,contact_urgence,cv,photo FROM stage_immersion
WHERE id = %s",(id_stagiaire,))
stagiaire = curseur.fetchone()
if stagiaire:
(nom,prenom,date_naissance,lieu_naissance,adresse,telephone,adresse_email,contact_urgence,cv_file,
photo) = stagiaire
self.title.setFont(QtGui.QFont("Arial", 16))
self.infop.setFont(QtGui.QFont("Arial", 16))
self.name_input = QLineEdit(self.form_frame)
self.name_input.setText(nom)
self.surname_input = QLineEdit(self.form_frame)
self.surname_input.setText(prenom)
self.dob_input = QDateEdit(self.form_frame)
self.dob_input.setCalendarPopup (True)
self.dob_input.setDate(QDate.fromString(date_naissance,"yyyy-MM-dd"))
self.lieu_input = QLineEdit(self.form_frame)
self.lieu_input.setText(lieu_naissance)
self.address_input = QLineEdit(self.form_frame)
self.address_input.setText(adresse)
self.phone_input = QLineEdit(self.form_frame)
self.email_input = QLineEdit(self.form_frame)
self.email_input.setText(adresse_email)
self.infoa.setFont(QtGui.QFont("Arial", 16))
self.contact_input = QLineEdit(self.form_frame)
self.contact_input.setText(contact_urgence)
self.photo_sti = photo
if photo:
photo_pixmap = QPixmap(photo).scaled(180,150,Qt.KeepAspectRatio)
self.photo_view = QLabel(self)
self.photo_view.setPixmap(photo_pixmap)
self.service_input = QLineEdit(self.form_frame)
self.siege_input = QLineEdit(self.form_frame)
self.date_debut_input = QDateEdit(self.form_frame)
self.date_debut_input.setCalendarPopup (True)
self.date_fin_input = QDateEdit(self.form_frame)
self.date_fin_input.setCalendarPopup (True)
self.date_debut_input.dateChanged.connect(self.update_date_fin)
self.photo_label = QLabel(self.form_frame)
self.statut_input = QLineEdit(self.form_frame)
self.statut_input.setText("stagiaire")
self.cv_file = cv_file
if cv_file:
self.cv_button.setGeometry(35,440,250,125)
self.cv_button.clicked.connect(self.voir_cv)
save_button = QPushButton("Sauvegarder",self.form_frame)
save_button.setGeometry(800,460,150,35)
save_button.clicked.connect(self.save_data)
back_button = QPushButton("Retour",self.form_frame)
back_button.setGeometry(1000,550,100,55)
back_button.clicked.connect(self.go_back)
except Error as e:
finally:
connexion.close()
def update_date_fin(self):
date_debut = self.date_debut_input.date()
date_fin = date_debut.addMonths(3)
self.date_fin_input.setDate(date_fin)
def save_data(self):
nom_sti = self.name_input.text()
prenom_sti = self.surname_input.text()
date_naissance_sti = self.dob_input.date().toString("dd/MM/yyyy")
lieu_naissance_sti = self.lieu_input.text()
adresse_sti= self.address_input.text()
telephone_sti = self.phone_input.text()
adresse_email_sti = self.email_input.text()
service_sti = self.service_input.text()
siege_sti = self.siege_input.text
date_debut_sti = self.date_debut_input.date().toString("yyyy-MM-dd")
date_fin_sti = self.date_fin_input.date().toString("yyyy-MM-dd")
cv_sti = self.cv_file
photo_sti = self.photo_sti
statut_sti = self.statut_input.text()
contact_urgence_sti = self.contact_input.text()
else:
connexion = creer_connexion()
if connexion:
try:
curseur = connexion.cursor()
VALUES(%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)
"""
valeurs = (nom_sti,prenom_sti,date_naissance_sti,
lieu_naissance_sti,adresse_sti,telephone_sti,adresse_email_sti,service_sti,date_debut_sti,date_fin_sti,c
ontact_urgence_sti,cv_sti,photo_sti,statut_sti)
curseur.execute(requete,valeurs)
connexion.commit()
finally:
connexion.close()
def go_back(self):
self.parent.stacked_widget.setCurrentWidget(self.parent.enregistrement_page)
# classe d'enregistrement des stagiaires renforcement
def __init__(self,parent):
super().__init__()
self.parent = parent
self.initUI()
self.show_stagiaire_renforcement()
def initUI(self):
self.form_frame = QtWidgets.QFrame(self)
self.form_frame.setStyleSheet("""
border-radius: 15px;
""")
def show_stagiaire_renforcement(self):
connexion = creer_connexion()
if connexion:
try:
curseur = connexion.cursor()
curseur.execute("SELECT id , nom , prenom , telephone , photo , statut FROM
stage_renforcement")
stagiaires = curseur.fetchall()
y = 50
self.create_stagiaire_renforcement_bloc(id,nom,prenom,telephone , photo,statut,y)
y+=175
except Error as e:
finally:
connexion.close()
frame = QFrame(self)
frame.setGeometry(140,y,550,180)
frame.setFrameShape(QFrame.Box)
nom_label.setGeometry(180,10,300,50)
nom_label.setFont(QtGui.QFont("Arial", 16))
prenom_label.setGeometry(180,40,300,50)
prenom_label.setFont(QtGui.QFont("Arial", 16))
telephone_label.setFont(QtGui.QFont("Arial", 16))
statut_label.setGeometry(180,100,300,50)
statut_label.setFont(QtGui.QFont("Arial", 16))
if photo:
pixmap = QPixmap(photo).scaled(130,130,Qt.KeepAspectRatio,Qt.SmoothTransformation)
photo_label = QLabel(frame)
photo_label.setPixmap(pixmap)
photo_label.setGeometry(10,25,100,100)
back_button = QPushButton("Retour",self.form_frame)
back_button.setGeometry(1000,550,100,55)
back_button.clicked.connect(self.go_back)
def show_stagiaire_renforcement_form(self,id_stagiaire):
self.stacked = QStackedWidget()
self.setCentralWidget(self.stacked)
self.stagiaire_renforcement_Page = QWidget()
self.stacked.addWidget(self.stagiaire_renforcement_Page)
self.form_frame = QtWidgets.QFrame(self)
self.form_frame.setStyleSheet("""
border-radius: 15px;
""")
connexion = creer_connexion()
if connexion:
try:
curseur = connexion.cursor()
curseur.execute("SELECT nom,prenom,date_naissance,
lieu_naissance,adresse,telephone,adresse_email,etablissement,filiere,diplome,contact_urgence,cv,piece
_identite,diplome_,demande,photo,statut FROM stage_renforcement WHERE id = %s",(id_stagiaire,))
stagiaire = curseur.fetchone()
print(id_stagiaire)
print(stagiaire)
if stagiaire:
(nom,prenom,date_naissance,lieu_naissance,adresse,telephone,adresse_email,etablissement,filiere,dipl
ome,contact_urgence,cv_file,piece_identite,diplome_,demande,photo,statut) = stagiaire
self.title.setFont(QtGui.QFont("Arial", 16))
self.infop = QLabel("INFORMATION PERSONNELLE :", self.form_frame)
self.infop.setFont(QtGui.QFont("Arial", 16))
self.name_input = QLineEdit(self.form_frame)
self.name_input.setText(nom)
self.name_input.setEnabled(False)
self.surname_input = QLineEdit(self.form_frame)
self.surname_input.setText(prenom)
self.surname_input.setEnabled(False)
self.dob_input = QDateEdit(self.form_frame)
self.dob_input.setCalendarPopup (True)
self.dob_input.setDate(QDate.fromString(date_naissance,"yyyy-MM-dd"))
self.dob_input.setEnabled(False)
self.lieu_input = QLineEdit(self.form_frame)
self.lieu_input.setText(lieu_naissance)
self.lieu_input.setEnabled(False)
self.address_input = QLineEdit(self.form_frame)
self.address_input.setText(adresse)
self.address_input.setEnabled(False)
self.phone_input = QLineEdit(self.form_frame)
self.phone_input.setText(telephone)
self.phone_input.setEnabled(False)
self.email_input = QLineEdit(self.form_frame)
self.email_input.setText(adresse_email)
self.email_input.setEnabled(False)
self.infoa.setFont(QtGui.QFont("Arial", 16))
self.school_input = QLineEdit(self.form_frame)
self.school_input.setText(etablissement)
self.school_input.setEnabled(False)
self.diplome_input = QLineEdit(self.form_frame)
self.diplome_input.setText(diplome)
self.diplome_input.setEnabled(False)
self.major_input = QLineEdit(self.form_frame)
self.major_input.setText(filiere)
self.major_input.setEnabled(False)
self.contact_input = QLineEdit(self.form_frame)
self.contact_input.setText(contact_urgence)
self.contact_input.setEnabled(False)
self.infodoc.setFont(QtGui.QFont("Arial", 16))
self.cv_file = cv_file
self.cv_button.setGeometry(35,440,250,125)
self.cv_button.clicked.connect(self.voir_cv)
self.id_checkbox_label.setGeometry(300,440,200,30)
self.id_checkbox_yes = QCheckBox("oui",self.form_frame)
self.id_checkbox_yes.setGeometry(600,440,60,40)
self.id_checkbox_no = QCheckBox("non",self.form_frame)
self.id_checkbox_no.setGeometry(700,440,60,40)
if piece_identite == 'oui':
self.id_checkbox_yes.setChecked(True)
else:
self.id_checkbox_no.setChecked(True)
self.diplome_checkbox_label.setGeometry(300,500,200,30)
self.diplome_checkbox_yes = QCheckBox("oui",self.form_frame)
self.diplome_checkbox_yes.setGeometry(600,500,60,40)
self.diplome_checkbox_no = QCheckBox("non",self.form_frame)
self.diplome_checkbox_no.setGeometry(700,500,60,40)
if diplome_ == 'oui':
self.diplome_checkbox_yes.setChecked(True)
else:
self.diplome_checkbox_no.setChecked(True)
self.lettre_checkbox_label.setGeometry(300,560,200,30)
self.lettre_checkbox_yes = QCheckBox("oui",self.form_frame)
self.lettre_checkbox_yes.setGeometry(600,560,60,40)
self.lettre_checkbox_no = QCheckBox("non",self.form_frame)
self.lettre_checkbox_no.setGeometry(700,560,60,40)
if demande == 'oui':
self.lettre_checkbox_yes.setChecked(True)
else:
self.lettre_checkbox_no.setChecked(True)
self.photo_label = QLabel(self.form_frame)
self.photo_label.setGeometry(940, 30, 180, 150)
photo_pixmap = QPixmap(photo).scaled(180,150,Qt.KeepAspectRatio)
self.photo_view = QLabel(self)
self.photo_view.setPixmap(photo_pixmap)
self.statut_input = QLineEdit(self.form_frame)
self.statut_input.setText(statut)
accept_button = QPushButton("Accepter",self.form_frame)
accept_button.setGeometry(800,460,150,35)
refus_button = QPushButton("refusé",self.form_frame)
refus_button.setGeometry(800,660,150,35)
back_button = QPushButton("Retour",self.form_frame)
back_button.setGeometry(1000,550,100,55)
back_button.clicked.connect(self.go_back)
except Error as e:
finally:
connexion.close()
def voir_cv(self):
if self.cv_file:
if os.path.exists(self.cv_file):
try:
if os.name == 'nt':
os.startfile(self.cv_file)
subprocess.call(('xdg*open',self.cv_file))
else:
except Exception as e :
else:
else:
def accept_stagiaire(self,id_stagiaire):
connexion = creer_connexion()
if connexion:
try:
curseur = connexion.cursor()
connexion.commit()
QMessageBox.information(self,"Succes","le stagiaire a été accepté ")
self.nouveau_stagiaire(id_stagiaire)
finally:
connexion.close()
def refus_stagiaire(self,id_stagiaire):
connexion = creer_connexion()
if connexion:
try:
curseur = connexion.cursor()
connexion.commit()
finally:
connexion.close()
def nouveau_stagiaire(self,id_stagiaire):
self.form_frame = QtWidgets.QFrame(self)
self.form_frame.setStyleSheet("""
border-radius: 15px;
""")
connexion = creer_connexion()
if connexion:
try:
curseur = connexion.cursor()
curseur.execute("SELECT nom,prenom,date_naissance,
lieu_naissance,adresse,telephone,adresse_email,contact_urgence,cv,photo FROM stage_renforcement
WHERE id = %s",(id_stagiaire,))
stagiaire = curseur.fetchone()
if stagiaire:
(nom,prenom,date_naissance,lieu_naissance,adresse,telephone,adresse_email,contact_urgence,cv_file,
photo) = stagiaire
self.title.setFont(QtGui.QFont("Arial", 16))
self.infop.setFont(QtGui.QFont("Arial", 16))
self.name_input = QLineEdit(self.form_frame)
self.name_input.setText(nom)
self.name_input.setEnabled(False)
self.surname_input = QLineEdit(self.form_frame)
self.surname_input.setEnabled(False)
self.dob_input = QDateEdit(self.form_frame)
self.dob_input.setCalendarPopup (True)
self.dob_input.setDate(QDate.fromString(date_naissance,"yyyy-MM-dd"))
self.dob_input.setEnabled(False)
self.lieu_input = QLineEdit(self.form_frame)
self.lieu_input.setText(lieu_naissance)
self.lieu_input.setEnabled(False)
self.address_input = QLineEdit(self.form_frame)
self.address_input.setText(adresse)
self.address_input.setEnabled(False)
self.phone_input = QLineEdit(self.form_frame)
self.phone_input.setText(telephone)
self.phone_input.setEnabled(False)
self.email_input = QLineEdit(self.form_frame)
self.email_input.setEnabled(False)
self.infoa.setFont(QtGui.QFont("Arial", 16))
self.contact_input = QLineEdit(self.form_frame)
self.contact_input.setText(contact_urgence)
self.contact_input.setEnabled(False)
self.photo_str = photo
if photo:
photo_pixmap = QPixmap(photo).scaled(180,150,Qt.KeepAspectRatio)
self.photo_view = QLabel(self)
self.photo_view.setPixmap(photo_pixmap)
self.service_input = QLineEdit(self.form_frame)
self.siege_input = QLineEdit(self.form_frame)
self.date_debut_input = QDateEdit(self.form_frame)
self.date_debut_input.setGeometry(485, 320, 220, 40)
self.date_debut_input.setCalendarPopup (True)
self.date_fin_input = QDateEdit(self.form_frame)
self.date_fin_input.setCalendarPopup (True)
self.date_debut_input.dateChanged.connect(self.update_date_fin)
self.photo_label = QLabel(self.form_frame)
self.statut_input = QLineEdit(self.form_frame)
self.statut_input.setText("stagiaire")
self.cv_file = cv_file
if cv_file:
self.cv_button.setGeometry(35,440,250,125)
self.cv_button.clicked.connect(self.voir_cv)
save_button = QPushButton("Sauvegarder",self.form_frame)
save_button.setGeometry(800,460,150,35)
save_button.clicked.connect(self.save_data)
back_button = QPushButton("Retour",self.form_frame)
back_button.setGeometry(1000,550,100,55)
back_button.clicked.connect(self.go_back)
except Error as e:
finally:
connexion.close()
def go_back(self):
self.parent.stacked_widget.setCurrentWidget(self.parent.enregistrement_page)
def update_date_fin(self):
date_debut = self.date_debut_input.date()
date_fin = date_debut.addMonths(3)
self.date_fin_input.setDate(date_fin)
def save_data(self):
nom_str = self.name_input.text()
prenom_str = self.surname_input.text()
date_naissance_str = self.dob_input.date().toString("dd/MM/yyyy")
lieu_naissance_str = self.lieu_input.text()
adresse_str= self.address_input.text()
telephone_str = self.phone_input.text()
adresse_email_str = self.email_input.text()
service_str = self.service_input.text()
siege_str = self.siege_input.text
date_debut_str = self.date_debut_input.date().toString("yyyy-MM-dd")
date_fin_str = self.date_fin_input.date().toString("yyyy-MM-dd")
cv_str = self.cv_file
photo_str = self.photo_str
statut_str = self.statut_input.text()
contact_urgence_str = self.contact_input.text()
else:
connexion = creer_connexion()
if connexion:
try:
curseur = connexion.cursor()
VALUES(%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)
"""
valeurs = (nom_str,prenom_str,date_naissance_str,
lieu_naissance_str,adresse_str,telephone_str,adresse_email_str,service_str,date_debut_str,date_fin_str
,contact_urgence_str,cv_str,photo_str,statut_str)
curseur.execute(requete,valeurs)
connexion.commit()
finally:
connexion.close()
class PDFViewer(QMainWindow):
def __init__(self):
super().__init__()
self.init_ui()
def init_ui(self):
self.stacked = QStackedWidget()
self.setCentralWidget(self.stacked)
self.form_frame = QtWidgets.QFrame(self)
self.form_frame.setStyleSheet("""
border-radius: 15px;
""")
self.label.setGeometry(35,440,250,125)
self.label.setAlignment(Qt.AlignCenter)
self.setWindowTitle("Visualisation du CV")
self.setGeometry(100,100,800,600)
self.cv_button =QPushButton("chargement",self.form_frame)
self.cv_button.setGeometry(100,100,50,50)
self.cv_button.clicked.connect(self.load_pdf_from_db)
def load_pdf_from_db(self):
chemin_pdf = self.chemin(id)
if chemin_pdf :
self.display_pdf(chemin_pdf)
else:
try:
connexion = creer_connexion
curseur = connexion.cursor()
result = curseur.fetchone()
connexion.close()
if result:
cv_file = result[0]
return cv_file
else:
return None
except Exception as e:
return None
page = doc.load_page(0)
pix = page.get_pixmap()
image = QPixmap.fromImage(self.convert_pix_to_quimage(pix))
self.label.setPixmap(self.scaled(self.label.size(),Qt.keepAspectRatio,Qt.SmoothTransformation))
doc.close()
img = pix.samples
return quimage
class stagiaire(QMainWindow):
def __init__(self,parent):
super().__init__()
self.parent = parent
self.init_ui()
def init_ui(self):
self.form_frame.setStyleSheet("""
border-radius: 15px;
""")
self.stagiaire_ecole_button.setGeometry(50,120,350,350)
self.stagiaire_ecole_button.clicked.connect(self.showecole)
self.stagiaire_immersion_button.setGeometry(425,120,350,350)
self.stagiaire_immersion_button.clicked.connect(self.showimmersion)
self.stagiaire_perfectionnement_button = QPushButton("Stagiaire -
perfectionnement",self.form_frame)
self.stagiaire_perfectionnement_button.setGeometry(800,120,350,350)
self.stagiaire_perfectionnement_button.clicked.connect(self.showrenforcement)
back_button = QPushButton("Retour",self.form_frame)
back_button.setGeometry(1000,550,100,55)
back_button.clicked.connect(self.go_back)
self.parent.stagiaire_ecole_page = stagiaires_ecole(self.parent)
self.parent.stacked_widget.addWidget(self.parent.stagiaire_ecole_page)
self.parent.stacked_widget.setCurrentWidget(self.parent.stagiaire_ecole_page)
def showimmersion(self):
self.parent.stagiaire_immersion_page = stagiaires_immersion(self.parent)
self.parent.stacked_widget.addWidget(self.parent.stagiaire_immersion_page)
self.parent.stacked_widget.setCurrentWidget(self.parent.stagiaire_immersion_page)
def showrenforcement(self):
self.parent.stagiaire_renforcement_page = stagiaires_renforcement(self.parent)
self.parent.stacked_widget.addWidget(self.parent.stagiaire_renforcement_page)
self.parent.stacked_widget.setCurrentWidget(self.parent.stagiaire_renforcement_page)
def go_back(self):
self.parent.stacked_widget.setCurrentWidget(self.parent.accueil_page)
class stagiaires_ecole(QMainWindow):
def __init__(self,parent):
super().__init__()
self.parent = parent
self.initUi()
self.show_stagiaire_ecole()
def initUi(self):
self.setWindowTitle("Stagiaires ecole")
self.form_frame = QtWidgets.QFrame(self)
self.form_frame.setStyleSheet("""
border-radius: 15px;
""")
def show_stagiaire_ecole(self):
connexion = creer_connexion()
if connexion:
try:
curseur = connexion.cursor()
stagiaires = curseur.fetchall()
y = 50
self.stagiaire_ecole_bloc(id,nom_ste,prenom_ste,telephone_ste ,
photo_ste,service_ste,siege_ste,date_debut_ste,date_fin_ste,y)
y+=175
except Error as e:
connexion.close()
frame = QFrame(self)
frame.setGeometry(140,y,670,180)
frame.setFrameShape(QFrame.Box)
nom_label.setGeometry(140,10,250,40)
nom_label.setFont(QtGui.QFont("Arial", 14))
prenom_label.setGeometry(140,40,250,40)
prenom_label.setFont(QtGui.QFont("Arial", 14))
telephone_label.setGeometry(140,70,250,40)
telephone_label.setFont(QtGui.QFont("Arial", 14))
service_label.setGeometry(140,100,250,40)
service_label.setFont(QtGui.QFont("Arial", 14))
siege_label.setGeometry(140,130,250,40)
siege_label.setFont(QtGui.QFont("Arial", 14))
date_debut_label.setGeometry(360,40,300,40)
date_debut_label.setFont(QtGui.QFont("Arial", 14))
date_fin_label.setGeometry(360,100,300,40)
date_fin_label.setFont(QtGui.QFont("Arial", 14))
if photo_ste:
pixmap = QPixmap(photo_ste).scaled(130,130,Qt.KeepAspectRatio,Qt.SmoothTransformation)
photo_label = QLabel(frame)
photo_label.setPixmap(pixmap)
photo_label.setGeometry(10,0,125,180)
back_button = QPushButton("Retour",self.form_frame)
back_button.setGeometry(1000,550,100,55)
back_button.clicked.connect(self.go_back)
def go_back(self):
self.parent.stacked_widget.setCurrentWidget(self.parent.stagiaire_page)
class stagiaires_immersion(QMainWindow):
def __init__(self):
super().__init__()
self.initUi()
self.show_stagiaire_immersion()
def initUi(self):
self.setWindowTitle("Stagiaires immersion")
self.stacked = QStackedWidget()
self.setCentralWidget(self.stacked)
self.form_frame = QtWidgets.QFrame(self)
self.form_frame.setStyleSheet("""
border-radius: 15px;
""")
def show_stagiaire_immersion(self):
connexion = creer_connexion()
if connexion:
try:
curseur = connexion.cursor()
stagiaires = curseur.fetchall()
y = 50
self.stagiaire_immersion_bloc(id,nom_sti,prenom_sti,telephone_sti ,
photo_sti,service_sti,siege_sti,date_debut_sti,date_fin_sti,y)
y+=175
except Error as e:
finally:
connexion.close()
frame = QFrame(self)
frame.setGeometry(140,y,670,180)
frame.setFrameShape(QFrame.Box)
nom_label.setGeometry(140,10,250,40)
nom_label.setFont(QtGui.QFont("Arial", 14))
prenom_label.setGeometry(140,40,250,40)
prenom_label.setFont(QtGui.QFont("Arial", 14))
telephone_label = QLabel(f"telephone : {telephone_sti}", frame)
telephone_label.setGeometry(140,70,250,40)
telephone_label.setFont(QtGui.QFont("Arial", 14))
service_label.setGeometry(140,100,250,40)
service_label.setFont(QtGui.QFont("Arial", 14))
siege_label.setGeometry(140,130,250,40)
siege_label.setFont(QtGui.QFont("Arial", 14))
date_debut_label.setGeometry(360,40,300,40)
date_debut_label.setFont(QtGui.QFont("Arial", 14))
date_fin_label.setGeometry(360,100,300,40)
date_fin_label.setFont(QtGui.QFont("Arial", 14))
if photo_sti:
pixmap = QPixmap(photo_sti).scaled(130,130,Qt.KeepAspectRatio,Qt.SmoothTransformation)
photo_label = QLabel(frame)
photo_label.setPixmap(pixmap)
photo_label.setGeometry(10,0,125,180)
back_button = QPushButton("Retour",self.form_frame)
back_button.setGeometry(1000,550,100,55)
back_button.clicked.connect(self.go_back)
def go_back(self):
self.parent.stacked_widget.setCurrentWidget(self.parent.stagiaire_page)
class stagiaires_renforcement(QMainWindow):
def __init__(self):
super().__init__()
self.initUi()
self.show_stagiaire_renforcement()
def initUi(self):
self.setWindowTitle("Stagiaires renforcement")
self.stacked = QStackedWidget()
self.setCentralWidget(self.stacked)
self.form_frame = QtWidgets.QFrame(self)
self.form_frame.setStyleSheet("""
border-radius: 15px;
""")
def show_stagiaire_renforcement(self):
connexion = creer_connexion()
if connexion:
try:
curseur = connexion.cursor()
stagiaires = curseur.fetchall()
y = 50
self.stagiaire_renforcement_bloc(id,nom_str,prenom_str,telephone_str ,
photo_str,service_str,siege_str,date_debut_str,date_fin_str,y)
y+=175
except Error as e:
finally:
connexion.close()
frame = QFrame(self)
frame.setGeometry(140,y,670,180)
frame.setFrameShape(QFrame.Box)
nom_label.setFont(QtGui.QFont("Arial", 14))
prenom_label.setGeometry(140,40,250,40)
prenom_label.setFont(QtGui.QFont("Arial", 14))
telephone_label.setGeometry(140,70,250,40)
telephone_label.setFont(QtGui.QFont("Arial", 14))
service_label.setGeometry(140,100,250,40)
service_label.setFont(QtGui.QFont("Arial", 14))
siege_label.setGeometry(140,130,250,40)
siege_label.setFont(QtGui.QFont("Arial", 14))
date_debut_label.setGeometry(360,40,300,40)
date_debut_label.setFont(QtGui.QFont("Arial", 14))
date_fin_label.setGeometry(360,100,300,40)
date_fin_label.setFont(QtGui.QFont("Arial", 14))
if photo_str:
pixmap = QPixmap(photo_str).scaled(130,130,Qt.KeepAspectRatio,Qt.SmoothTransformation)
photo_label = QLabel(frame)
photo_label.setPixmap(pixmap)
photo_label.setGeometry(10,0,125,180)
back_button = QPushButton("Retour",self.form_frame)
back_button.setGeometry(1000,550,100,55)
back_button.clicked.connect(self.go_back)
def go_back(self):
self.parent.stacked_widget.setCurrentWidget(self.parent.stagiaire_page)
class SuiviPage(QWidget):
def __init__(self,parent):
super().__init__()
self.parent = parent
self.init_ui()
def init_ui(self):
self.setWindowTitle("Type de Demande")
self.form_frame = QtWidgets.QFrame(self)
self.form_frame.setStyleSheet("""
border-radius: 15px;
""")
self.suivi_ecole_button.setGeometry(50,120,350,350)
self.suivi_ecole_button.clicked.connect(self.enreg_suivi_ecole)
self.suivi_immersion_button.setGeometry(425,120,350,350)
self.suivi_immersion_button.clicked.connect(self.enreg_suivi_immersion)
self.suivi_renforcement_button.setGeometry(800,120,350,350)
self.suivi_renforcement_button.clicked.connect(self.enreg_suivi_renforcement)
back_button = QPushButton("Retour",self.form_frame)
back_button.setGeometry(1000,550,100,55)
back_button.clicked.connect(self.go_back)
def enreg_suivi_ecole(self):
self.parent.enre_suivi_ecole = enregistrement_suivi_ecole(self.parent)
self.parent.stacked_widget.addWidget(self.parent.enre_suivi_ecole)
self.parent.stacked_widget.setCurrentWidget(self.parent.enre_suivi_ecole)
def enreg_suivi_immersion(self):
self.parent.enre_suivi_immersion = enregistrement_suivi_immersion(self.parent)
self.parent.stacked_widget.addWidget(self.parent.enre_suivi_immersion)
self.parent.stacked_widget.setCurrentWidget(self.parent.enre_suivi_immersion)
# enregistrement stagiaire renforcement
def enreg_suivi_renforcement(self):
self.parent.enre_suivi_renforcement = enregistrement_suivi_renforcement(self.parent)
self.parent.stacked_widget.addWidget(self.parent.enre_suivi_renforcement)
self.parent.stacked_widget.setCurrentWidget(self.parent.enre_suivi_renforcement)
def go_back(self):
self.parent.stacked_widget.setCurrentWidget(self.parent.accueil_page)
class enregistrement_suivi_ecole(QMainWindow):
def __init__(self,parent):
super().__init__()
self.parent = parent
self.initUI()
self.show_suivi_ecole()
def initUI(self):
self.form_frame = QtWidgets.QFrame(self)
self.form_frame.setStyleSheet("""
border-radius: 15px;
""")
def show_suivi_ecole(self):
connexion = creer_connexion()
if connexion:
try:
curseur = connexion.cursor()
stagiaires = curseur.fetchall()
y = 50
self.create_suivi_ecole_bloc(id,nom_ste,prenom_ste,telephone_ste ,
photo_ste,statut_ste,date_debut_ste,date_fin_ste,date_enregistrement_ste, jours_counter_ste,y)
y+=175
except Error as e:
finally:
connexion.close()
frame = QFrame(self)
frame.setGeometry(140,y,700,180)
frame.setFrameShape(QFrame.Box)
nom_label.setGeometry(140,10,250,40)
nom_label.setFont(QtGui.QFont("Arial", 14))
prenom_label.setGeometry(140,40,250,40)
prenom_label.setFont(QtGui.QFont("Arial", 14))
telephone_label.setGeometry(140,70,250,40)
telephone_label.setFont(QtGui.QFont("Arial", 14))
statut_label.setGeometry(140,100,300,50)
statut_label.setFont(QtGui.QFont("Arial", 16))
date_enregistrement_label.setGeometry(360,10,330,40)
date_enregistrement_label.setFont(QtGui.QFont("Arial", 14))
date_debut_label.setGeometry(360,40,300,40)
date_debut_label.setFont(QtGui.QFont("Arial", 14))
date_fin_label.setGeometry(360,70,300,40)
date_fin_label.setFont(QtGui.QFont("Arial", 14))
jours_effectuer_label = QLabel(f"Jours effectué : {jours_counter_ste}",frame)
jours_effectuer_label.setGeometry(360,100,300,40)
jours_effectuer_label.setFont(QtGui.QFont("Arial", 14))
if photo_ste:
pixmap = QPixmap(photo_ste).scaled(130,130,Qt.KeepAspectRatio,Qt.SmoothTransformation)
photo_label = QLabel(frame)
photo_label.setPixmap(pixmap)
photo_label.setGeometry(10,0,125,180)
back_button = QPushButton("Retour",self.form_frame)
back_button.setGeometry(1000,550,100,55)
back_button.clicked.connect(self.go_back)
def go_back(self):
self.parent.stacked_widget.setCurrentWidget(self.parent.suivi_page)
def suivie_ecole_form(self,id_stagiaire) :
self.stacked = QStackedWidget()
self.setCentralWidget(self.stacked)
self.suivie_ecole_Page = QWidget()
self.stacked.addWidget(self.suivie_ecole_Page)
self.form_frame = QtWidgets.QFrame(self.suivie_ecole_Page)
self.form_frame.setStyleSheet("""
border-radius: 15px;
""")
frame = QFrame(self.form_frame)
frame.setGeometry(25,400,400,100)
frame.setFrameShape(QFrame.Box)
connexion = creer_connexion()
if connexion:
try:
curseur = connexion.cursor()
curseur.execute("SELECT
nom_ste,prenom_ste,adresse_ste,telephone_ste,adresse_email_ste,contact_urgence__ste,photo_ste,d
ate_debut_ste, date_fin_ste,date_enregistrement_ste, jours_counter_ste FROM stagiaire_ecole WHERE
id = %s",(id_stagiaire,))
stagiaire = curseur.fetchone()
print(id_stagiaire)
print(stagiaire)
if stagiaire:
(nom_ste,prenom_ste,adresse_ste,telephone_ste,adresse_email_ste,contact_urgence__ste,photo_ste,d
ate_debut_ste, date_fin_ste,date_enregistrement_ste, jours_counter_ste) = stagiaire
self.title = QLabel("ENREGISTREMENT DE STAGIAIRE (STAGE renforcement) ",
self.form_frame)
self.title.setFont(QtGui.QFont("Arial", 16))
self.infop.setFont(QtGui.QFont("Arial", 16))
self.name_input = QLineEdit(self.form_frame)
self.name_input.setText(nom_ste)
self.name_input.setReadOnly(True)
self.surname_input = QLineEdit(self.form_frame)
self.surname_input.setText(prenom_ste)
self.surname_input.setReadOnly(True)
self.address_input = QLineEdit(self.form_frame)
self.address_input.setText(adresse_ste)
self.address_input.setReadOnly(True)
self.phone_input = QLineEdit(self.form_frame)
self.phone_input.setText(telephone_ste)
self.phone_input.setReadOnly(True)
self.email_input = QLineEdit(self.form_frame)
self.email_input.setText(adresse_email_ste)
self.email_input.setReadOnly(True)
self.contact_input = QLineEdit(self.form_frame)
self.contact_input.setText(contact_urgence__ste)
self.contact_input.setReadOnly(True)
self.date_debut_label.setGeometry(35,250,200,20)
date_debut_pi = date_debut_ste.strftime("%Y-%m-%d")
qdatedeb = QDate.fromString(date_debut_pi,"yyyy-MM-dd")
self.date_debut_input = QDateEdit(self.form_frame)
self.date_debut_input.setCalendarPopup(True)
self.date_debut_input.setDate(qdatedeb)
self.date_debut_input.setReadOnly(True)
self.date_fin_label.setGeometry(280,250,200,20)
date_fin_pi = date_fin_ste.strftime("%Y-%m-%d")
qdatefin = QDate.fromString(date_fin_pi,"yyyy-MM-dd")
self.date_fin_input = QDateEdit(self.form_frame)
self.date_fin_input.setCalendarPopup(True)
self.date_fin_input.setDate(qdatefin)
self.date_fin_input.setEnabled(False)
self.date_enr_label.setGeometry(505,250,200,20)
date_enr_pi = date_enregistrement_ste.strftime("%Y-%m-%d")
qdateenr = QDate.fromString(date_enr_pi,"yyyy-MM-dd")
self.date_enregistrement_input = QDateEdit(self.form_frame)
self.date_enregistrement_input.setCalendarPopup(True)
self.date_enregistrement_input.setDate(qdateenr)
self.date_enregistrement_input.setReadOnly(True)
self.date_counter_label.setGeometry(730,250,200,20)
self.date_counter_input = QLineEdit(self.form_frame)
self.date_counter_input.setText(jours_counter_ste)
self.date_counter_input.setEnabled(False)
photo_pixmap = QPixmap(photo_ste).scaled(180,150,Qt.KeepAspectRatio)
self.photo_view = QLabel(self)
self.photo_view.setPixmap(photo_pixmap)
self.tab_widget = QTabWidget(self.form_frame)
self.infoa.setFont(QtGui.QFont("Arial", 16))
ajouter_button = QPushButton("Accepter",self.form_frame)
ajouter_button.setGeometry(800,460,150,35)
ajouter_button.clicked.connect(lambda: self.add_evaluation_form(id_stagiaire))
modifier_button = QPushButton("modifier",self.form_frame)
modifier_button.setGeometry(800,510,150,35)
modifier_button.clicked.connect(self.modify_evaluation_form)
supprimer_button = QPushButton("supprimer",self.form_frame)
supprimer_button.setGeometry(800,560,150,35)
supprimer_button.clicked.connect(self.delete_evaluation_form)
voir_liste.setGeometry(600,560,200,200)
voir_liste.clicked.connect(lambda : self.voir(id_stagiaire))
except Error as e:
finally:
connexion.close()
def add_evaluation_form(self,id_stagiaire):
self.parent.form_page = evaluationform(self.parent,id_stagiaire)
self.parent.stacked_widget.addWidget(self.parent.form_page)
self.parent.stacked_widget.setCurrentWidget(self.parent.form_page)
def modify_evaluation_form(self):
current_tab = self.tab_widget.currentWidget()
if current_tab:
self.form_dialog = evaluationform(self,current_tab.data)
self.form_dialog.show()
def delete_evaluation_form(self):
current_index = self.tab_widget.currentIndex()
if current_index != -1:
if reply == QMessageBox.Yes:
self.tab_widget.removeTab(current_index)
connexion = creer_connexion()
if connexion:
try:
curseur = connexion.cursor()
curseur.execute("SELECT id ,
nom_este,date_evaluation_etse,assiduite_este,conduite_este,evolution_este,participation_este,capacit
e_este,date_enregistrement_este,counter_este FROM evaluation_ste")
stagiaires = curseur.fetchall()
y = 50
print(id_stagiaire)
id_stagiaire = stagiaire[0]
nom_este = stagiaire[1]
date_evaluation_etse= stagiaire[2]
assiduite_este= stagiaire[3]
conduite_este= stagiaire[4]
evolution_este= stagiaire[5]
participation_este= stagiaire[6]
capacite_este= stagiaire[7]
date_enregistrement_este= stagiaire[8]
counter_este = stagiaire[9]
print(id_stagiaire)
print(stagiaire)
resultat = curseur.fetchone()
VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)""",(id_stagiaire,counter_este))
self.voir_liste(id_stagiaire ,
nom_este,date_evaluation_etse,assiduite_este,conduite_este,evolution_este,participation_este,capacit
e_este,date_enregistrement_este,y)
y+=150
except Error as e:
finally:
connexion.close()
def voir_liste
(self,id_stagiaire,nom_este,date_evaluation_etse,assiduite_este,conduite_este,evolution_este,participa
tion_este,capacite_este,date_enregistrement_este,y):
self.form_frame = QtWidgets.QFrame(self.suivie_ecole_Page)
self.form_frame.setStyleSheet("""
border-radius: 15px;
""")
frame = QFrame(self.form_frame)
frame.setGeometry(25,400,400,100)
frame.setFrameShape(QFrame.Box)
connexion = creer_connexion()
if connexion:
curseur = connexion.cursor()
curseur.execute("SELECT
nom_este,date_evaluation_etse,assiduite_este,conduite_este,evolution_este,participation_este,capacit
e_este,date_enregistrement_este FROM evaluation_ste WHERE id = %s",(id_stagiaire,))
stagiaire = curseur.fetchone()
print(id_stagiaire)
print(stagiaire)
if stagiaire :
(nom_este,date_evaluation_etse,assiduite_este,conduite_este,evolution_este,participation_este,capacit
e_este,date_enregistrement_este ) = stagiaire
nom_label= QLabel(f"Nom : {nom_este}", frame)
nom_label.setGeometry(10,10,100,20)
nom_label.setFont(QtGui.QFont("Arial", 14))
date_eva_label.setGeometry(10,40,100,20)
date_eva_label.setFont(QtGui.QFont("Arial", 14))
assiduite_label.setGeometry(10,70,250,20)
assiduite_label.setFont(QtGui.QFont("Arial", 14))
conduite_label.setGeometry(10,100,250,20)
conduite_label.setFont(QtGui.QFont("Arial", 14))
evolution_label.setGeometry(10,130,250,20)
evolution_label.setFont(QtGui.QFont("Arial", 14))
participation_label.setGeometry(10,160,250,20)
participation_label.setFont(QtGui.QFont("Arial", 14))
capacite_label.setGeometry(10,190,250,20)
capacite_label.setFont(QtGui.QFont("Arial", 14))
date_enr_label.setFont(QtGui.QFont("Arial", 14))
class enregistrement_suivi_immersion(QMainWindow):
def __init__(self,parent):
super().__init__()
self.parent = parent
self.initUI()
self.show_suivi_immersion()
def initUI(self):
self.form_frame = QtWidgets.QFrame(self)
self.form_frame.setStyleSheet("""
border-radius: 15px;
""")
def show_suivi_immersion(self):
connexion = creer_connexion()
if connexion:
try:
curseur = connexion.cursor()
stagiaires = curseur.fetchall()
y = 50
self.create_suivi_immersion_bloc(id,nom_sti,prenom_sti,telephone_sti ,
photo_sti,statut_sti,date_debut_sti,date_fin_sti,date_enregistrement_sti, jours_counter_sti,y)
y+=175
except Error as e:
finally:
connexion.close()
frame = QFrame(self)
frame.setGeometry(140,y,700,180)
frame.setFrameShape(QFrame.Box)
nom_label.setGeometry(140,10,250,40)
nom_label.setFont(QtGui.QFont("Arial", 14))
prenom_label.setGeometry(140,40,250,40)
prenom_label.setFont(QtGui.QFont("Arial", 14))
telephone_label.setGeometry(140,70,250,40)
telephone_label.setFont(QtGui.QFont("Arial", 14))
statut_label.setGeometry(140,100,300,50)
statut_label.setFont(QtGui.QFont("Arial", 16))
date_enregistrement_label.setGeometry(360,10,330,40)
date_enregistrement_label.setFont(QtGui.QFont("Arial", 14))
date_debut_label.setGeometry(360,40,300,40)
date_debut_label.setFont(QtGui.QFont("Arial", 14))
date_fin_label.setGeometry(360,70,300,40)
date_fin_label.setFont(QtGui.QFont("Arial", 14))
jours_effectuer_label.setGeometry(360,100,300,40)
jours_effectuer_label.setFont(QtGui.QFont("Arial", 14))
if photo_sti:
pixmap = QPixmap(photo_sti).scaled(130,130,Qt.KeepAspectRatio,Qt.SmoothTransformation)
photo_label = QLabel(frame)
photo_label.setPixmap(pixmap)
photo_label.setGeometry(10,0,125,180)
back_button = QPushButton("Retour",self.form_frame)
back_button.setGeometry(1000,550,100,55)
back_button.clicked.connect(self.go_back)
def go_back(self):
self.parent.stacked_widget.setCurrentWidget(self.parent.suivi_page)
class enregistrement_suivi_renforcement(QMainWindow):
def __init__(self,parent):
super().__init__()
self.parent = parent
self.initUI()
self.show_suivi_renforcement()
def initUI(self):
self.form_frame = QtWidgets.QFrame(self)
self.form_frame.setGeometry(125, 50, 1200, 625)
self.form_frame.setStyleSheet("""
border-radius: 15px;
""")
def show_suivi_renforcement(self):
connexion = creer_connexion()
if connexion:
try:
curseur = connexion.cursor()
stagiaires = curseur.fetchall()
y = 50
self.create_suivi_renforcement_bloc(id,nom_str,prenom_str,telephone_str ,
photo_str,statut_str,date_debut_str,date_fin_str,date_enregistrement_str, jours_counter_str,y)
y+=175
except Error as e:
finally:
connexion.close()
frame.setGeometry(140,y,700,180)
frame.setFrameShape(QFrame.Box)
nom_label.setGeometry(140,10,250,40)
nom_label.setFont(QtGui.QFont("Arial", 14))
prenom_label.setGeometry(140,40,250,40)
prenom_label.setFont(QtGui.QFont("Arial", 14))
telephone_label.setGeometry(140,70,250,40)
telephone_label.setFont(QtGui.QFont("Arial", 14))
statut_label.setGeometry(140,100,300,50)
statut_label.setFont(QtGui.QFont("Arial", 16))
date_enregistrement_label.setGeometry(360,10,330,40)
date_enregistrement_label.setFont(QtGui.QFont("Arial", 14))
date_debut_label.setGeometry(360,40,300,40)
date_debut_label.setFont(QtGui.QFont("Arial", 14))
date_fin_label = QLabel(f"Date fin stage : {date_fin_str}",frame)
date_fin_label.setGeometry(360,70,300,40)
date_fin_label.setFont(QtGui.QFont("Arial", 14))
jours_effectuer_label.setGeometry(360,100,300,40)
jours_effectuer_label.setFont(QtGui.QFont("Arial", 14))
if photo_str:
pixmap = QPixmap(photo_str).scaled(130,130,Qt.KeepAspectRatio,Qt.SmoothTransformation)
photo_label = QLabel(frame)
photo_label.setPixmap(pixmap)
photo_label.setGeometry(10,0,125,180)
back_button = QPushButton("Retour",self.form_frame)
back_button.setGeometry(1000,550,100,55)
back_button.clicked.connect(self.go_back)
def go_back(self):
self.parent.stacked_widget.setCurrentWidget(self.parent.suivi_page)
class evaluationform(QMainWindow):
def __init__(self,parent,id_stagiaire,data=None):
super().__init__(parent)
self.setWindowTitle("formulaire d'evaluation")
self.setGeometry(100,100,700,400)
self.data = data
self.parent = parent
self.id_stagiaire = id_stagiaire
self.init_ui(id_stagiaire)
def init_ui(self,id_stagiaire):
self.form_frame = QtWidgets.QFrame(self)
self.form_frame.setStyleSheet("""
border-radius: 15px;
""")
self.title_label.setGeometry(20,20,250,20)
connexion = creer_connexion()
if connexion:
curseur = connexion.cursor()
curseur.execute("SELECT nom_ste,prenom_ste,photo_ste,date_debut_ste,
date_fin_ste,date_enregistrement_ste, jours_counter_ste,service_ste,siege_ste FROM stagiaire_ecole
WHERE id = %s",(id_stagiaire,))
stagiaire = curseur.fetchone()
print(id_stagiaire)
print(stagiaire)
if stagiaire:
(nom_ste,prenom_ste,photo_ste,date_debut_ste, date_fin_ste,date_enregistrement_ste,
jours_counter_ste,service_ste,siege_ste) = stagiaire
self.infop.setFont(QtGui.QFont("Arial", 16))
self.name_input = QLineEdit(self.form_frame)
self.name_input.setText(nom_ste)
self.name_input.setEnabled(False)
self.surname_input = QLineEdit(self.form_frame)
self.surname_input.setText(prenom_ste)
self.surname_input.setEnabled(False)
date_debut_pi = date_debut_ste.strftime("%Y-%m-%d")
qdatedeb = QDate.fromString(date_debut_pi,"yyyy-MM-dd")
self.date_debut_input = QDateEdit(self.form_frame)
self.date_debut_input.setCalendarPopup (True)
self.date_debut_input.setDate(qdatedeb)
self.date_debut_input.setEnabled(False)
date_fin_pi = date_fin_ste.strftime("%Y-%m-%d")
qdatefin = QDate.fromString(date_fin_pi,"yyyy-MM-dd")
self.date_fin_input = QDateEdit(self.form_frame)
self.date_fin_input.setCalendarPopup (True)
self.date_fin_input.setDate(qdatefin)
self.date_fin_input.setEnabled(False)
date_enr_pi = date_enregistrement_ste.strftime("%Y-%m-%d")
qdateenr = QDate.fromString(date_enr_pi,"yyyy-MM-dd")
self.date_enregistrement_input = QDateEdit(self.form_frame)
self.date_enregistrement_input.setCalendarPopup (True)
self.date_enregistrement_input.setDate(qdateenr)
self.date_enregistrement_input.setEnabled(False)
self.date_counter_input = QLineEdit(self.form_frame)
self.date_counter_input.setText(jours_counter_ste)
self.date_counter_input.setEnabled(False)
self.infop.setFont(QtGui.QFont("Arial", 16))
self.label_supervisor.setGeometry(35,325,200,20)
self.input_supervisor = QLineEdit(self.form_frame)
self.input_supervisor.setGeometry(35,350,300,20)
self.label_service.setGeometry(35,375,200,20)
self.input_service = QLineEdit(self.form_frame)
self.input_service.setGeometry(35,400,300,20)
self.input_service.setText(service_ste)
self.input_service.setEnabled(False)
self.label_siege.setGeometry(35,425,200,20)
self.input_siege = QLineEdit(self.form_frame)
self.input_siege.setGeometry(35,450,300,20)
self.input_siege.setText(siege_ste)
self.input_siege.setEnabled(False)
line = QFrame(self.form_frame)
line.setGeometry(475,280,3,300)
line.setFrameShape(QFrame.VLine)
line.setFrameShadow(QFrame.Sunken)
self.label_criteria.setGeometry(500,280,425,30)
self.label_assiduite.setGeometry(500,325,200,20)
self.input_assiduite = QComboBox(self.form_frame)
self.input_assiduite.setGeometry(750,325,100,20)
self.input_assiduite.addItems(["","1","2","3","4","5"])
self.label_conduite.setGeometry(500,375,200,20)
self.input_conduite = QComboBox(self.form_frame)
self.input_conduite.setGeometry(750,375,100,20)
self.input_conduite.addItems(["","1","2","3","4","5"])
self.label_evolution.setGeometry(500,425,200,20)
self.input_evolution = QComboBox(self.form_frame)
self.input_evolution.setGeometry(750,425,100,20)
self.input_evolution.addItems(["","1","2","3","4","5"])
self.label_participation.setGeometry(500,475,200,20)
self.input_participation = QComboBox(self.form_frame)
self.input_participation.setGeometry(750,475,100,20)
self.input_participation.addItems(["","1","2","3","4","5"])
self.label_capacite.setGeometry(500,525,200,20)
self.input_capacite = QComboBox(self.form_frame)
self.input_capacite.setGeometry(750,525,100,20)
self.input_capacite.addItems(["","1","2","3","4","5"])
photo_pixmap = QPixmap(photo_ste).scaled(180,150,Qt.KeepAspectRatio)
self.photo_view = QLabel(self.form_frame)
self.photo_view.setPixmap(photo_pixmap)
if self.data:
self.input_assiduite.setCurrentText(self.data.get('Assiduité',''))
self.input_conduite.setCurrentText(self.data.get('Conduite',''))
self.input_capacite.setCurrentText(self.data.get('Capacité d''adaptation',''))
self.save_button = QPushButton("Sauvegarder",self.form_frame)
self.save_button.setGeometry(900,460,200,130)
self.save_button.clicked.connect(self.save_data)
def save_data(self):
data =
{"Assiduite":self.input_assiduite.currentText(),"Conduite":self.input_conduite.currentText(),"Evolution":s
elf.input_evolution.currentText(),"Participation":
self.input_participation.currentText(),"Capacite":self.input_capacite.currentText(),"Date":QDate.current
Date().toString("dd/MM/yyyy")}
nom_este = self.name_input.text()
prenom_este = self.surname_input.text()
date_debut_este = self.date_debut_input.date().toString("dd/MM/yyyy")
date_fin_este = self.date_fin_input.date().toString("dd/MM/yyyy")
date_enregistrement_este = self.date_enregistrement_input.date().toString("dd/MM/yyyy")
supervisor_este = self.input_supervisor.text()
service_este = self.input_service.text()
siege_este = self.input_siege.text()
jours_counter_este = self.date_counter_input.text()
assiduite_este = data['Assiduite']
conduite_este = data['Conduite']
evolution_este = data['Evolution']
participation_este = data['Participation']
capacite_este = data['Capacite']
photo_este = self.photo_view.text()
connexion = creer_connexion()
if connexion:
try:
curseur = connexion.cursor()
VALUES(%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)
"""
valeurs =
(nom_este,prenom_este,date_debut_este,date_fin_este,date_enregistrement_este,supervisor_este,ser
vice_este,siege_este,jours_counter_este,conduite_este,assiduite_este,evolution_este,participation_este
,capacite_este,photo_este)
curseur.execute(requete,valeurs)
connexion.commit()
self.parent.accueil_page= Accueil(self.parent)
self.parent.stacked_widget.addWidget(self.parent.accueil_page)
self.parent.stacked_widget.setCurrentWidget(self.parent.accueil_page)
except Error as e:
connexion.close()
if __name__ == "__main__":
app = QApplication([])
main_window = Login()
main_window.showMaximized()
app.exec_()