Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- coding: utf-8 -*-
- # Form implementation generated from reading ui file 'Login.ui'
- #
- # Created by: PyQt5 UI code generator 5.10.1
- #
- # WARNING! All changes made in this file will be lost!
- from Database.HotelConnect import *
- from PyQt5 import QtCore, QtGui, QtWidgets
- Common = CommonPS()
- Address = Address()
- Customer = Customer()
- Employee = Employee()
- Hotel = Hotel()
- Item = Item()
- Reservation = Reservation()
- Order_Has_Items = Order_Has_Items()
- Order_Has_Rooms = Order_Has_Rooms()
- Room = Room()
- RoomType = RoomType()
- ServiceOrder = ServiceOrder()
- Staff = Staff()
- class Ui_Dialog(object):
- def setupUi(self, Dialog):
- Dialog.setObjectName("Dialog")
- Dialog.resize(299, 326)
- Dialog.setInputMethodHints(QtCore.Qt.ImhSensitiveData)
- self.verticalLayout_2 = QtWidgets.QVBoxLayout(Dialog)
- self.verticalLayout_2.setObjectName("verticalLayout_2")
- self.verticalLayout = QtWidgets.QVBoxLayout()
- self.verticalLayout.setObjectName("verticalLayout")
- self.label = QtWidgets.QLabel(Dialog)
- self.label.setTextFormat(QtCore.Qt.RichText)
- self.label.setObjectName("label")
- self.verticalLayout.addWidget(self.label, 0, QtCore.Qt.AlignHCenter)
- self.horizontalLayout = QtWidgets.QHBoxLayout()
- self.horizontalLayout.setObjectName("horizontalLayout")
- self.label_2 = QtWidgets.QLabel(Dialog)
- self.label_2.setObjectName("label_2")
- self.horizontalLayout.addWidget(self.label_2)
- self.inputuser = QtWidgets.QLineEdit(Dialog)
- self.inputuser.setObjectName("inputuser")
- self.horizontalLayout.addWidget(self.inputuser)
- self.verticalLayout.addLayout(self.horizontalLayout)
- self.verticalLayout_2.addLayout(self.verticalLayout)
- self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
- self.horizontalLayout_2.setObjectName("horizontalLayout_2")
- self.horizontalLayout_3 = QtWidgets.QHBoxLayout()
- self.horizontalLayout_3.setObjectName("horizontalLayout_3")
- self.label_3 = QtWidgets.QLabel(Dialog)
- self.label_3.setObjectName("label_3")
- self.horizontalLayout_3.addWidget(self.label_3)
- self.inputpass = QtWidgets.QLineEdit(Dialog)
- self.inputpass.setInputMethodHints(QtCore.Qt.ImhHiddenText)
- self.inputpass.setClearButtonEnabled(False)
- self.inputpass.setObjectName("inputpass")
- self.horizontalLayout_3.addWidget(self.inputpass)
- self.horizontalLayout_2.addLayout(self.horizontalLayout_3)
- self.verticalLayout_2.addLayout(self.horizontalLayout_2)
- self.horizontalLayout_4 = QtWidgets.QHBoxLayout()
- self.horizontalLayout_4.setObjectName("horizontalLayout_4")
- self.btncancellogin = QtWidgets.QPushButton(Dialog)
- self.btncancellogin.setObjectName("btncancellogin")
- self.horizontalLayout_4.addWidget(self.btncancellogin)
- self.btnlogin = QtWidgets.QPushButton(Dialog)
- self.btnlogin.setObjectName("btnlogin")
- self.btnlogin.clicked.connect(self.check_login)
- self.horizontalLayout_4.addWidget(self.btnlogin)
- self.verticalLayout_2.addLayout(self.horizontalLayout_4)
- self.retranslateUi(Dialog)
- QtCore.QMetaObject.connectSlotsByName(Dialog)
- def check_login(self):
- user = self.inputuser.text()
- passwd = self.inputpass.text()
- print(user)
- print(passwd)
- result = Employee.EmployeeList()
- for i in result:
- if user == i[8] and passwd == i[9]:
- print("Login successful!")
- EmpID = i[0]
- print(EmpID)
- else:
- print("Login unsuccessful!")
- def retranslateUi(self, Dialog):
- _translate = QtCore.QCoreApplication.translate
- Dialog.setWindowTitle(_translate("Dialog", "Dialog"))
- self.label.setText(_translate("Dialog", "Hraun Hótel"))
- self.label_2.setText(_translate("Dialog", "Username"))
- self.label_3.setText(_translate("Dialog", "Password"))
- self.btncancellogin.setText(_translate("Dialog", "Cancel"))
- self.btnlogin.setText(_translate("Dialog", "Login"))
- if __name__ == "__main__":
- import sys
- app = QtWidgets.QApplication(sys.argv)
- Dialog = QtWidgets.QDialog()
- ui = Ui_Dialog()
- ui.setupUi(Dialog)
- Dialog.show()
- sys.exit(app.exec_())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement