summaryrefslogtreecommitdiff
path: root/src/gui/pageHome.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/pageHome.py')
-rw-r--r--src/gui/pageHome.py33
1 files changed, 24 insertions, 9 deletions
diff --git a/src/gui/pageHome.py b/src/gui/pageHome.py
index 99ca956..016d374 100644
--- a/src/gui/pageHome.py
+++ b/src/gui/pageHome.py
@@ -3,28 +3,43 @@ from PyQt5.QtWidgets import (
QGroupBox, QPushButton,
QComboBox, QLineEdit,
QHBoxLayout, QWidget,
- QVBoxLayout
+ QVBoxLayout, QLabel
)
from src.database import dbsearch
-from src.gui import pageLogin, pageRegister
-from src.gui.include import connexionInfo
+from src.gui import pageLogin, pageRegister, globalMenu
from src.core.coreSearch import core_search_id, core_search_name
+from src.core.coreUser import core_logout
-def main(mainWindow) -> None:
+def main(mainWindow, reloadMenu = False) -> None:
+ if reloadMenu:
+ globalMenu.init(mainWindow)
+
classSearch = dbsearch.DbSearch(mainWindow)
- connexionState = connexionInfo.get_text(mainWindow)
+ if not mainWindow.userConnected:
+ connexionState = QLabel("Non connecté.")
+ else:
+ connexionState = QLabel(f"Connecté: {mainWindow.userEmail} - {mainWindow.userStatus}")
+
+ if not mainWindow.userConnected:
+ btnConnexion = QPushButton("Connexion")
+ btnConnexion.clicked.connect(lambda: pageLogin.main(mainWindow))
+ else:
+ btnDeconnexion = QPushButton("Déconnexion")
+ btnDeconnexion.clicked.connect(lambda: core_logout(mainWindow))
- btnConnexion = QPushButton("Connexion")
- btnConnexion.clicked.connect(lambda: pageLogin.main(mainWindow))
btnInscription = QPushButton("Inscription")
btnInscription.clicked.connect(lambda: pageRegister.main(mainWindow))
layoutUser = QHBoxLayout()
layoutUser.addStretch()
- layoutUser.addWidget(btnConnexion)
layoutUser.addWidget(btnInscription)
+ if not mainWindow.userConnected:
+ layoutUser.addWidget(btnConnexion)
+ else:
+ layoutUser.addWidget(btnDeconnexion)
+
grpUtilisateur = QGroupBox("Gestion de l'utilisateur")
grpUtilisateur.setLayout(layoutUser)
@@ -64,7 +79,7 @@ def main(mainWindow) -> None:
layoutRecherche.addLayout(layoutRechercheCat)
layoutRecherche.addStretch()
- grpRecherche = QGroupBox("Recherche")
+ grpRecherche = QGroupBox("Recherche par nom ou emploi")
grpRecherche.setLayout(layoutRecherche)
layoutMain = QVBoxLayout()