summaryrefslogtreecommitdiff
path: root/app_alphajob/main.py
diff options
context:
space:
mode:
Diffstat (limited to 'app_alphajob/main.py')
-rw-r--r--app_alphajob/main.py119
1 files changed, 0 insertions, 119 deletions
diff --git a/app_alphajob/main.py b/app_alphajob/main.py
deleted file mode 100644
index 11f4cc1..0000000
--- a/app_alphajob/main.py
+++ /dev/null
@@ -1,119 +0,0 @@
-
-
-import sys
-from os.path import join
-from PyQt5 import QtWidgets, QtGui
-from database import dbuser
-
-class mainWindow(QtWidgets.QMainWindow):
-
- VERSION = 0.1
-
- def __init__(self):
- super(mainWindow, self).__init__()
- logo = join("./ressources", "icon.ico")
- self.setWindowIcon(QtGui.QIcon(logo))
- menu = self.menuBar()
- menu_options = menu.addMenu("Options")
- btn_apropos = QtWidgets.QAction("A propos", self)
- btn_apropos.triggered.connect(self.a_propos)
- menu_options.addAction(btn_apropos)
- self.setWindowTitle("Alphajob")
- self.home()
-
- def home(self):
- self.label1 = QtWidgets.QLabel("Home page")
- btn1 = QtWidgets.QPushButton("Aller à la page de connexion")
- btn1.clicked.connect(self.page_login)
-
- self.layoutMain = QtWidgets.QVBoxLayout()
-
- self.layoutMain.addWidget(self.label1)
- self.layoutMain.addWidget(btn1)
-
- if hasattr(self, "mainWidget"):
- self.mainWidget.deleteLater()
- self.mainWidget = QtWidgets.QWidget()
- self.mainWidget.setLayout(self.layoutMain)
- self.setCentralWidget(self.mainWidget)
- self.show()
-
- def page_login(self):
- btnAccueil = QtWidgets.QPushButton("Accueil")
- btnAccueil.clicked.connect(self.home)
- self.emailConnexion = QtWidgets.QLineEdit("Email")
- self.passwordConnexion = QtWidgets.QLineEdit("Password")
- btnConnexion = QtWidgets.QPushButton("Connexion")
- btnConnexion.clicked.connect(self.login)
-
- self.layoutMain = QtWidgets.QVBoxLayout()
- self.layoutNavigation = QtWidgets.QHBoxLayout()
- self.layoutPassword = QtWidgets.QHBoxLayout()
- self.layoutPasswordWidgets = QtWidgets.QVBoxLayout()
-
- self.layoutMain.addLayout(self.layoutNavigation)
- self.layoutNavigation.addWidget(btnAccueil)
- self.layoutNavigation.addStretch()
-
- self.layoutMain.addLayout(self.layoutPassword)
- self.layoutPassword.addStretch()
- self.layoutPassword.addLayout(self.layoutPasswordWidgets)
- self.layoutPassword.addStretch()
-
- self.layoutPasswordWidgets.addWidget(self.emailConnexion)
- self.layoutPasswordWidgets.addWidget(self.passwordConnexion)
- self.layoutPasswordWidgets.addWidget(btnConnexion)
-
- self.mainWidget.deleteLater()
- self.mainWidget = QtWidgets.QWidget()
- self.mainWidget.setLayout(self.layoutMain)
- self.setCentralWidget(self.mainWidget)
-
- def login(self):
- user = dbuser.DbUser()
- if user.check_exist_email(self.emailConnexion.text()):
- res = user.check_user_credential(
- self.emailConnexion.text(),
- self.passwordConnexion.text()
- )
- if res:
- QtWidgets.QMessageBox.information(
- self,
- "Connexion",
- "Vous êtes connecté"
- )
- else:
- QtWidgets.QMessageBox.warning(
- self,
- "Connexion",
- "Mauvaise combinaison mail & mot de passe"
- )
- else:
- QtWidgets.QMessageBox.warning(
- self,
- "Connexion",
- "Mauvais email"
- )
-
-
- def a_propos(self):
- QtWidgets.QMessageBox.information(
- self,
- "A propos",
- "Logiciel pour mon dossier professionnel.\
- <br>Version: %s\
- <br>Auteur: Debulois Quentin\
- <br>Code source: \
- <a href='https://git.debulois.fr/'>git.debulois.fr/</a>" % self.VERSION
- )
-
-
-if __name__ == "__main__":
- def main():
- """Démarrage de l'app
- """
- app = QtWidgets.QApplication(sys.argv)
- GUI = mainWindow()
- sys.exit(app.exec_())
-
- main() \ No newline at end of file