from PyQt5.
QtWidgets import QWidget, QLabel, QLineEdit, QPushButton, QVBoxLayout, QMessageBox,
QAction, QMainWindow, QStackedWidget, QApplication
from PyQt5 import QtWidgets, QtGui
from [Link] import Qt
class Accueil(QWidget):
def __init__(self):
super().__init__()
layout = QVBoxLayout(self)
label = QLabel("Bienvenue dans l'accueil")
[Link](label)
class Login(QMainWindow):
def __init__(self):
super().__init__()
# Configuration de la fenêtre
[Link]("Gestion d'Inventaire")
[Link](125, 70, 950, 650)
[Link]("background-color: #FF00FF;")
# Créer le widget central
[Link] = QStackedWidget()
[Link]([Link])
# Page de connexion
self.login_page = QWidget()
[Link](self.login_page)
# Cadre central pour simuler le verre
self.form_frame = [Link](self.login_page)
self.form_frame.setGeometry(175, 50, 600, 425)
self.form_frame.setStyleSheet("""
background-color: rgba(255, 255, 255, 0.5);
border-radius: 15px;
""")
# Labels et champs d'entrée
[Link] = QLabel("Bienvenue sur la gestion d'inventaire", self.form_frame)
[Link](85, 25, 450, 50)
[Link]([Link]("Arial", 16))
self.username_input = QLineEdit(self.form_frame)
self.username_input.setGeometry(85, 100, 250, 40)
self.username_input.setPlaceholderText("Entrez le nom d'utilisateur")
self.password_input = QLineEdit(self.form_frame)
self.password_input.setGeometry(85, 160, 250, 40)
self.password_input.setPlaceholderText("Entrez le mot de passe")
self.password_input.setEchoMode([Link])
self.resultat_label = QLabel("", self.form_frame)
self.resultat_label.setGeometry(85, 280, 250, 40)
self.resultat_label.setStyleSheet("color: red;")
# Bouton de connexion
self.login_button = QPushButton("Se connecter", self.form_frame)
self.login_button.setGeometry(210, 350, 120, 40)
self.login_button.[Link]([Link])
# Créer le menu principal
self.create_menu()
# Dictionnaire pour stocker les pages
[Link] = {}
def authenticate(self):
username = self.username_input.text()
password = self.password_input.text()
if username == "admin" and password == "admin":
# Ajouter la page d'accueil
if 'accueil' not in [Link]:
[Link]['accueil'] = Accueil()
[Link]([Link]['accueil'])
[Link]([Link]['accueil'])
else:
[Link](self, "Erreur", "Nom d'utilisateur ou mot de passe incorrect")
def create_menu(self):
menu_bar = [Link]()
menu = menu_bar.addMenu("Action")
[Link] = QAction("Enregistrement", self)
[Link](self.show_enregistrement_page)
[Link]([Link])
[Link] = QAction("Stagiaire", self)
[Link](self.show_stagiaire_page)
[Link]([Link])
[Link] = QAction("Maitre de Stage", self)
[Link](self.show_maitre_page)
[Link]([Link])
[Link] = QAction("Validation", self)
[Link](self.show_validation_page)
[Link]([Link])
def show_enregistrement_page(self):
if 'enregistrement' not in [Link]:
[Link]['enregistrement'] = EnregistrementPage()
[Link]([Link]['enregistrement'])
[Link]([Link]['enregistrement'])
def show_stagiaire_page(self):
if 'stagiaire' not in [Link]:
[Link]['stagiaire'] = StagiairePage()
[Link]([Link]['stagiaire'])
[Link]([Link]['stagiaire'])
def show_maitre_page(self):
if 'maitre' not in [Link]:
[Link]['maitre'] = MaitrePage()
[Link]([Link]['maitre'])
[Link]([Link]['maitre'])
def show_validation_page(self):
if 'validation' not in [Link]:
[Link]['validation'] = ValidationPage()
[Link]([Link]['validation'])
[Link]([Link]['validation'])
class EnregistrementPage(QWidget):
def __init__(self):
super().__init__()
layout = QVBoxLayout(self)
label = QLabel("Enregistrement des informations")
[Link](label)
save_button = QPushButton("Sauvegarder")
save_button.[Link](self.save_data)
[Link](save_button)
back_button = QPushButton("Retour")
back_button.[Link](self.go_back)
[Link](back_button)
def save_data(self):
pass
def go_back(self):
[Link]().setCurrentIndex(0) # Retour à l'accueil
class StagiairePage(QWidget):
def __init__(self):
super().__init__()
layout = QVBoxLayout(self)
label = QLabel("Liste des Stagiaires")
[Link](label)
stagiaire_button = QPushButton("Valider Stagiaire")
stagiaire_button.[Link](self.save_stagiaire_info)
[Link](stagiaire_button)
back_button = QPushButton("Retour")
back_button.[Link](self.go_back)
[Link](back_button)
def save_stagiaire_info(self):
pass
def go_back(self):
[Link]().setCurrentIndex(0)
class MaitrePage(QWidget):
def __init__(self):
super().__init__()
layout = QVBoxLayout(self)
label = QLabel("Maitre de Stage des informations")
[Link](label)
back_button = QPushButton("Retour")
back_button.[Link](self.go_back)
[Link](back_button)
def go_back(self):
[Link]().setCurrentIndex(0)
class ValidationPage(QWidget):
def __init__(self):
super().__init__()
layout = QVBoxLayout(self)
label = QLabel("Validation des stagiaires")
[Link](label)
back_button = QPushButton("Retour")
back_button.[Link](self.go_back)
[Link](back_button)
def go_back(self):
[Link]().setCurrentIndex(0)
if __name__ == "__main__":
app = QApplication([])
main_window = Login()
main_window.show()
app.exec_()