Ecole 1
Ecole 1
import sys
import os
import subprocess
import platform
import mysql.connector
def creer_connexion():
try:
if connexion.is_connected():
print("connexion reussie")
return connexion
except Error as e :
print(f"Erreur : {e}")
return None
class Accueil(QWidget):
def __init__(self):
super().__init__()
layout = QVBoxLayout(self)
label = QLabel("Bienvenue dans l'accueil")
layout.addWidget(label)
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 = QStackedWidget()
self.setCentralWidget(self.stacked)
# Page de connexion
self.login_page = QWidget()
self.stacked.addWidget(self.login_page)
self.form_frame = QtWidgets.QFrame(self.login_page)
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)
#panneau lateral
self.side_menu = QFrame(self)
self.side_menu.setGeometry(0,0,0,self.height())
self.side_menu.setStyleSheet("background-color: #F9009F;")
#bouton menu panneau lateral
self.menu_layout = QVBoxLayout(self.side_menu)
self.enregistrement.setStyleSheet("background-color: #FB00BF;")
self.enregistrement.clicked.connect(self.show_enregistrement_page)
self.menu_layout.addWidget(self.enregistrement)
self.stagiaire.setStyleSheet("background-color: #FB00BF;")
self.stagiaire.clicked.connect(self.show_stagiaire_page)
self.menu_layout.addWidget(self.stagiaire)
self.maitre.clicked.connect(self.show_maitre_page)
self.menu_layout.addWidget(self.maitre)
self.validation.clicked.connect(self.show_validation_page)
self.menu_layout.addWidget(self.validation)
self.toggle_button = QPushButton("|||",self)
self.toggle_button.setGeometry(10,10,30,30)
self.toggle_button.clicked.connect(self.toggle_side_menu)
self.toggle_button.hide()
self.pages = {}
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.pages['accueil']= Accueil()
self.stacked.addWidget(self.pages['accueil'])
self.stacked.setCurrentWidget(self.pages['accueil'])
self.toggle_button.show()
else:
else:
QMessageBox.warning(self, "Erreur", "impossible de se connecter a la base de données")
def show_enregistrement_page(self):
self.stacked = QStackedWidget()
self.setCentralWidget(self.stacked)
self.enregistrement_page = QWidget(self)
self.stacked.addWidget(self.enregistrement_page)
self.form_frame = QtWidgets.QFrame(self.enregistrement_page)
self.form_frame.setStyleSheet("""
border-radius: 15px;
""")
self.demande_stage_button.setGeometry(50,100,500,500)
self.demande_stage_button.clicked.connect(self.show_demande_stage_page)
self.stagiaire_button.setGeometry(600,100,500,500)
self.stagiaire_button.clicked.connect(self.show_enregistrement_stagiaire_page)
self.stacked.addWidget(self.enregistrement_page)
self.stacked.setCurrentWidget(self.enregistrement_page)
def show_demande_stage_page(self):
self.setWindowTitle("Type de Demande")
self.stacked = QStackedWidget()
self.setCentralWidget(self.stacked)
self.demande_stage_page = QWidget(self)
self.stacked.addWidget(self.demande_stage_page)
self.form_frame = QtWidgets.QFrame(self.demande_stage_page)
self.form_frame.setStyleSheet("""
border-radius: 15px;
""")
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)
self.stacked.setCurrentWidget(self.demande_stage_page)
def go_back(self):
def show_ecole(self):
self.pages['ecole'] = ecole()
self.stacked.addWidget(self.pages['ecole'])
self.stacked.setCurrentWidget(self.pages['ecole'])
def show_immersion(self):
self.pages['immersion'] = immersion()
self.stacked.addWidget(self.pages['immersion'])
self.stacked.setCurrentWidget(self.pages['immersion'])
def show_renforcement(self):
self.stacked.addWidget(self.pages['renforcement'])
self.stacked.setCurrentWidget(self.pages['renforcement'])
def show_enregistrement_stagiaire_page(self):
self.setWindowTitle("Type de Demande")
self.stacked = QStackedWidget()
self.setCentralWidget(self.stacked)
self.enregistrement_stagiaire_page = QWidget(self)
self.stacked.addWidget(self.enregistrement_stagiaire_page)
self.form_frame = QtWidgets.QFrame(self.enregistrement_stagiaire_page)
self.form_frame.setStyleSheet("""
border-radius: 15px;
""")
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(enregistrement_stagiaire_immersion)
self.stagiaire_renforcement_button.clicked.connect(enregistrement_stagiaire_renforcement)
def enre_stagiaire_ecole(self):
self.pages['stagiaire_ecole'] = enregistrement_stagiaire_ecole()
self.stacked.addWidget(self.pages['stagiaire_ecole'])
self.stacked.setCurrentWidget(self.pages['stagiaire_ecole'])
def show_stagiaire_page(self):
self.pages['stagiaire'] = StagiairePage()
self.stacked.addWidget(self.pages['stagiaire'])
self.stacked.setCurrentWidget(self.pages['stagiaire'])
def show_maitre_page(self):
self.pages['maitre'] = MaitrePage()
self.stacked.addWidget(self.pages['maitre'])
self.stacked.setCurrentWidget(self.pages['maitre'])
def show_validation_page(self):
self.pages['validation'] = ValidationPage()
self.stacked.addWidget(self.pages['validation'])
self.stacked.setCurrentWidget(self.pages['validation'])
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()
class ecole(QMainWindow):
def __init__(self):
super().__init__()
self.init_ui()
def init_ui(self):
self.stacked = QStackedWidget()
self.setCentralWidget(self.stacked)
self.EcolePage = QWidget()
self.stacked.addWidget(self.EcolePage)
self.form_frame = QtWidgets.QFrame(self.EcolePage)
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.lieu_input.setGeometry(970, 190, 220, 40)
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.major_input.setGeometry(600, 320, 260, 40)
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):
class immersion(QMainWindow):
def __init__(self):
super().__init__()
self.init_ui()
def init_ui(self):
self.stacked = QStackedWidget()
self.setCentralWidget(self.stacked)
self.immersionPage = QWidget()
self.stacked.addWidget(self.immersionPage)
self.form_frame = QtWidgets.QFrame(self.immersionPage)
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.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_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.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()
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:
connexion.close()
def go_back(self):
class renforcement(QMainWindow):
def __init__(self):
super().__init__()
self.init_ui()
def init_ui(self):
self.stacked = QStackedWidget()
self.setCentralWidget(self.stacked)
self.renforcementPage = QWidget()
self.stacked.addWidget(self.renforcementPage)
self.form_frame = QtWidgets.QFrame(self.renforcementPage)
self.form_frame.setStyleSheet("""
border-radius: 15px;
""")
self.title = QLabel("ENREGISTREMENT DE STAGIAIRE (STAGE DE 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.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.setGeometry(35, 190, 220, 40)
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.contact_input.setGeometry(875, 320, 250, 40)
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 = 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)
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()
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:
finally:
connexion.close()
def go_back(self):
super().__init__()
self.initUI()
self.show_stagiaire_ecole()
def initUI(self):
self.stacked = QStackedWidget()
self.setCentralWidget(self.stacked)
self.show_enregistrement_stagiaire_ecole_page = QWidget(self)
self.stacked.addWidget(self.show_enregistrement_stagiaire_ecole_page)
self.form_frame = QtWidgets.QFrame(self.show_enregistrement_stagiaire_ecole_page)
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,500,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)
def show_stagiaire_ecole_form(self,id):
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 = curseur.fetchone()
if stagiaire:
(nom,prenom,date_naissance,lieu_naissance,adresse,telephone,adresse_email,etablissement,filiere,dipl
ome_prepa,contact_urgence,file_name,piece_identite,admissibilite,demande,photo,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.setCalendarPopup (True)
self.dob_input.setDate(date_naissance)
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.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.setText(filiere)
self.contact_input = QLineEdit(self.form_frame)
self.contact_input.setText(contact_urgence)
self.infodoc.setFont(QtGui.QFont("Arial", 16))
self.cv_button.setGeometry(35,440,250,125)
self.cv_button.clicked.connect(self.view_cv(file_name))
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 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)
accept_button.clicked.connect(self.accept_stagiaire)
refus_button = QPushButton("Accepter",self.form_frame)
refus_button.setGeometry(800,460,150,35)
refus_button.clicked.connect(self.refus_stagiaire)
except Error as e:
finally:
connexion.close()
def view_cv(self,file_name):
system_os = platform.system()
if system_os == 'Linux':
subprocess.Popen(['xdg-open',file_name],stdout=subprocess.PIPE,stderr = subprocess.PIPE)
else:
except Exception as e:
else:
def accept_stagiaire():
def refus_stagiaire():
def show_stagiaire_ecole(self):
self.stacked = QStackedWidget()
self.setCentralWidget(self.stacked)
self.show_enregistrement_stagiaire_ecole_page = QWidget(self)
self.stacked.addWidget(self.show_enregistrement_stagiaire_ecole_page)
self.form_frame = QtWidgets.QFrame(self.show_enregistrement_stagiaire_ecole_page)
self.form_frame.setStyleSheet("""
border-radius: 15px;
""")
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(50,y,500,140)
frame.setFrameShape(QFrame.Box)
nom_label.setGeometry(250,10,200,50)
nom_label.setFont(QtGui.QFont("Arial", 16))
prenom_label.setGeometry(250,40,200,50)
prenom_label.setFont(QtGui.QFont("Arial", 16))
telephone_label.setGeometry(250,70,200,50)
telephone_label.setFont(QtGui.QFont("Arial", 16))
statut_label.setGeometry(250,100,200,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)
def show_stagiaire_ecole_form(self,id):
connexion = creer_connexion()
if connexion:
try:
curseur = connexion.cursor()
stagiaire = curseur.fetchone()
if stagiaire:
nom,prenom,date_naissance,lieu_naissance,adresse,telephone,adresse_email,etablissement,filiere,dipl
ome_prepa,contact_urgence,cv,piece_identite,admissibilité,demande,photo,statut = stagiaire
self.stacked = QStackedWidget()
self.setCentralWidget(self.stacked)
self.EcolePage = QWidget()
self.stacked.addWidget(self.EcolePage)
self.form_frame = QtWidgets.QFrame(self.EcolePage)
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.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.setCalendar(date_naissance)
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(diplome_prepa)
self.major_input = QLineEdit(self.form_frame)
self.major_input.setText(filiere)
self.contact_input = QLineEdit(self.form_frame)
self.contact_input.setText(contact_urgence)
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)
except Error as e:
finally:
connexion.close()
def show_stagiaire_ecole(self):
self.stacked = QStackedWidget()
self.setCentralWidget(self.stacked)
self.show_enregistrement_stagiaire_ecole_page = QWidget(self)
self.stacked.addWidget(self.show_enregistrement_stagiaire_ecole_page)
self.form_frame = QtWidgets.QFrame(self.show_enregistrement_stagiaire_ecole_page)
self.form_frame.setStyleSheet("""
border-radius: 15px;
""")
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(50,y,500,140)
frame.setFrameShape(QFrame.Box)
nom_label.setGeometry(250,10,200,50)
nom_label.setFont(QtGui.QFont("Arial", 16))
prenom_label.setGeometry(250,40,200,50)
prenom_label.setFont(QtGui.QFont("Arial", 16))
telephone_label.setGeometry(250,70,200,50)
telephone_label.setFont(QtGui.QFont("Arial", 16))
statut_label.setGeometry(250,100,200,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)
def show_stagiaire_ecole_form(self,id):
connexion = creer_connexion()
if connexion:
try:
curseur = connexion.cursor()
stagiaire = curseur.fetchone()
if stagiaire:
nom,prenom,date_naissance,lieu_naissance,adresse,telephone,adresse_email,etablissement,filiere,dipl
ome_prepa,contact_urgence,cv_file,piece_identite,admissibilité,demande,photo,statut = stagiaire
self.stacked = QStackedWidget()
self.setCentralWidget(self.stacked)
self.EcolePage = QWidget()
self.stacked.addWidget(self.EcolePage)
self.form_frame = QtWidgets.QFrame(self.EcolePage)
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.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.setCalendar(date_naissance)
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(diplome_prepa)
self.major_input = QLineEdit(self.form_frame)
self.major_input.setText(filiere)
self.contact_input = QLineEdit(self.form_frame)
self.contact_input.setText(contact_urgence)
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)
except Error as e:
finally:
connexion.close()
class StagiairePage(QMainWindow):
def __init__(self):
super().__init__()
self.initUi()
self.load_stagiaire()
def initUi(self):
scroll_area = QScrollArea()
self.central_widget = QWidget()
self.central_layout = QVBoxLayout(self.central_widget)
self.central_widget.setLayout(self.central_layout)
scroll_area.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn)
scroll_area.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
scroll_area.setWidgetResizable(True)
scroll_area.setWidget(self.central_widget)
self.setCentralWidget(scroll_area)
self.setGeometry(0,0,1500,1500)
self.setStyleSheet("background-color: #FF00FF;")
def load_stagiaire(self):
connexion = creer_connexion()
if connexion:
try:
curseur = connexion.cursor()
curseur.execute(requete)
stagiaires = curseur.fetchall()
x,y = 20,20
y+=175
except Error as e:
finally:
connexion.close()
frame = QFrame(self)
frame.setGeometry(x,y,500,140)
frame.setFrameShape(QFrame.Box)
nom_label.setGeometry(250,10,200,50)
nom_label.setFont(QtGui.QFont("Arial", 16))
prenom_label.setGeometry(250,40,200,50)
prenom_label.setFont(QtGui.QFont("Arial", 16))
filiere_label.setGeometry(250,70,200,50)
filiere_label.setFont(QtGui.QFont("Arial", 16))
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)
def open_stagiaire_detail(self,id_stagiaire):
connexion = creer_connexion()
if connexion:
try:
curseur = connexion.cursor()
curseur.execute(requete,(id_stagiaire,))
stagiaire = curseur.fetchone()
if stagiaire:
self.show_stagiaire_form(stagiaire)
except Error as e :
finally:
connexion.close()
def show_stagiaire_form(self,stagiaire):
id_stagiaire,nom,prenom,date_naissance,adresse,telephone,adresse_email,etablissement,niveau_etude
,filiere,poste_demande,cv,lettre_motivation,photo,statut = stagiaire
widget.deleteLater()
statut_label.setGeometry(20,140,100,30)
self.statut_combo = QComboBox(self)
self.statut_combo.addItems(["Accepté","Refusé","En attente"])
self.statut_combo.setCurrentText(statut)
self.statut_combo.setGeometry(80,140,150,30)
modify_button.setGeometry(20,200,100,30)
modify_button.clicked.connect(lambda:self.update_stagiaire_info(id_stagiaire))
def update_stagiaire_info(self,id_stagiaire):
nouveau_statut = self.statut_combo.CurrentText()
connexion = creer_connexion()
if connexion:
try:
curseur = connexion.cursor()
connexion.commit()
except Error as e:
finally:
connexion.close()
stagiaire_button.clicked.connect(self.save_stagiaire_info)
back_button = QPushButton("Retour",self.form_frame)
back_button.setGeometry(1000,550,100,55)
back_button.clicked.connect(self.go_back)
def save_stagiaire_info(self):
pass
def go_back(self):
self.parentWidget().setCurrentIndex(1)
class MaitrePage(QWidget):
def __init__(self):
super().__init__()
layout = QVBoxLayout(self)
label = QLabel("Maitre de Stage des informations")
layout.addWidget(label)
back_button = QPushButton("Retour")
back_button.clicked.connect(self.go_back)
layout.addWidget(back_button)
def go_back(self):
self.parentWidget().setCurrentIndex(1)
class ValidationPage(QWidget):
def __init__(self):
super().__init__()
layout = QVBoxLayout(self)
layout.addWidget(label)
back_button = QPushButton("Retour")
back_button.clicked.connect(self.go_back)
layout.addWidget(back_button)
def go_back(self):
self.parentWidget().setCurrentIndex(1)
if __name__ == "__main__":
app = QApplication([])
main_window = Login()
main_window.showMaximized()
app.exec_()