-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
64 lines (56 loc) · 1.75 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import sys,mydpi
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QApplication, QMainWindow, QWidget, QPushButton, QMessageBox, QDialog
from loginpage import Ui_Form
from dialogF import Ui_Dialog
from pageN import Ui_MainWindow
class NoteP():
def __init__(self):
self.app = QApplication(sys.argv)
self.login = QWidget()
self.ui = Ui_Form()
self.ui.setupUi(self.login)
self.ui.btn_login.clicked.connect(self.loginp)
self.ui.frame.keyPressEvent = self.loginPK
self.login.show()
self.app.exec_()
def loginPK(self, e):
if e.key() == Qt.Key_Return:
self.loginp()
def loginp(self):
user_ = self.ui.userline.text()
pass_ = self.ui.passline.text()
if (user_ != "") & (pass_ != ""):
if (user_ =='admin') & (pass_=='admin'):
print("Login")
# print(user_+'\n'+pass_)
self.PageNotePad()
else:
print('Error login')
# self.ui.userline.setText('')
self.ui.passline.setText('')
Dialog_Error()
else:
print('Not Empty Field')
Dialog_Error()
def PageNotePad(self):
self.window = QMainWindow()
self.ui = Ui_MainWindow()
self.ui.setupU(self.window)
self.window.show()
self.login.hide()
class Dialog_Error():
def __init__(self):
dialog = QDialog()
self.ui = Ui_Dialog()
self.ui.setupUi(dialog)
dialog.show()
res = dialog.exec_()
if res == QDialog.Accepted:
print('Ok')
NoteP.loginp
else:
print('cancel')
sys.exit()
if __name__ =='__main__':
ex = NoteP()