Advertisement
Guest User

Untitled

a guest
May 8th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.39 KB | None | 0 0
  1. # -*- coding: utf-8 -*-
  2.  
  3. # Form implementation generated from reading ui file 'Login.ui'
  4. #
  5. # Created by: PyQt5 UI code generator 5.10.1
  6. #
  7. # WARNING! All changes made in this file will be lost!
  8.  
  9. from Database.HotelConnect import *
  10. from PyQt5 import QtCore, QtGui, QtWidgets
  11.  
  12. Common = CommonPS()
  13. Address = Address()
  14. Customer = Customer()
  15. Employee = Employee()
  16. Hotel = Hotel()
  17. Item = Item()
  18. Reservation = Reservation()
  19. Order_Has_Items = Order_Has_Items()
  20. Order_Has_Rooms = Order_Has_Rooms()
  21. Room = Room()
  22. RoomType = RoomType()
  23. ServiceOrder = ServiceOrder()
  24. Staff = Staff()
  25.  
  26.  
  27. class Ui_Dialog(object):
  28. def setupUi(self, Dialog):
  29. Dialog.setObjectName("Dialog")
  30. Dialog.resize(299, 326)
  31. Dialog.setInputMethodHints(QtCore.Qt.ImhSensitiveData)
  32. self.verticalLayout_2 = QtWidgets.QVBoxLayout(Dialog)
  33. self.verticalLayout_2.setObjectName("verticalLayout_2")
  34. self.verticalLayout = QtWidgets.QVBoxLayout()
  35. self.verticalLayout.setObjectName("verticalLayout")
  36. self.label = QtWidgets.QLabel(Dialog)
  37. self.label.setTextFormat(QtCore.Qt.RichText)
  38. self.label.setObjectName("label")
  39. self.verticalLayout.addWidget(self.label, 0, QtCore.Qt.AlignHCenter)
  40. self.horizontalLayout = QtWidgets.QHBoxLayout()
  41. self.horizontalLayout.setObjectName("horizontalLayout")
  42. self.label_2 = QtWidgets.QLabel(Dialog)
  43. self.label_2.setObjectName("label_2")
  44. self.horizontalLayout.addWidget(self.label_2)
  45. self.inputuser = QtWidgets.QLineEdit(Dialog)
  46. self.inputuser.setObjectName("inputuser")
  47. self.horizontalLayout.addWidget(self.inputuser)
  48. self.verticalLayout.addLayout(self.horizontalLayout)
  49. self.verticalLayout_2.addLayout(self.verticalLayout)
  50. self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
  51. self.horizontalLayout_2.setObjectName("horizontalLayout_2")
  52. self.horizontalLayout_3 = QtWidgets.QHBoxLayout()
  53. self.horizontalLayout_3.setObjectName("horizontalLayout_3")
  54. self.label_3 = QtWidgets.QLabel(Dialog)
  55. self.label_3.setObjectName("label_3")
  56. self.horizontalLayout_3.addWidget(self.label_3)
  57. self.inputpass = QtWidgets.QLineEdit(Dialog)
  58. self.inputpass.setInputMethodHints(QtCore.Qt.ImhHiddenText)
  59. self.inputpass.setClearButtonEnabled(False)
  60. self.inputpass.setObjectName("inputpass")
  61. self.horizontalLayout_3.addWidget(self.inputpass)
  62. self.horizontalLayout_2.addLayout(self.horizontalLayout_3)
  63. self.verticalLayout_2.addLayout(self.horizontalLayout_2)
  64. self.horizontalLayout_4 = QtWidgets.QHBoxLayout()
  65. self.horizontalLayout_4.setObjectName("horizontalLayout_4")
  66. self.btncancellogin = QtWidgets.QPushButton(Dialog)
  67. self.btncancellogin.setObjectName("btncancellogin")
  68. self.horizontalLayout_4.addWidget(self.btncancellogin)
  69. self.btnlogin = QtWidgets.QPushButton(Dialog)
  70. self.btnlogin.setObjectName("btnlogin")
  71. self.btnlogin.clicked.connect(self.check_login)
  72. self.horizontalLayout_4.addWidget(self.btnlogin)
  73. self.verticalLayout_2.addLayout(self.horizontalLayout_4)
  74.  
  75. self.retranslateUi(Dialog)
  76. QtCore.QMetaObject.connectSlotsByName(Dialog)
  77.  
  78. def check_login(self):
  79. user = self.inputuser.text()
  80. passwd = self.inputpass.text()
  81. print(user)
  82. print(passwd)
  83. result = Employee.EmployeeList()
  84. for i in result:
  85. if user == i[8] and passwd == i[9]:
  86. print("Login successful!")
  87. EmpID = i[0]
  88. print(EmpID)
  89.  
  90. else:
  91. print("Login unsuccessful!")
  92.  
  93.  
  94. def retranslateUi(self, Dialog):
  95. _translate = QtCore.QCoreApplication.translate
  96. Dialog.setWindowTitle(_translate("Dialog", "Dialog"))
  97. self.label.setText(_translate("Dialog", "Hraun Hótel"))
  98. self.label_2.setText(_translate("Dialog", "Username"))
  99. self.label_3.setText(_translate("Dialog", "Password"))
  100. self.btncancellogin.setText(_translate("Dialog", "Cancel"))
  101. self.btnlogin.setText(_translate("Dialog", "Login"))
  102.  
  103.  
  104.  
  105.  
  106. if __name__ == "__main__":
  107. import sys
  108. app = QtWidgets.QApplication(sys.argv)
  109. Dialog = QtWidgets.QDialog()
  110. ui = Ui_Dialog()
  111. ui.setupUi(Dialog)
  112. Dialog.show()
  113. sys.exit(app.exec_())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement