You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
1.4 KiB

from PySide6.QtWidgets import QApplication, QDialog, QVBoxLayout, QLabel, QLineEdit, QPushButton, QHBoxLayout, QTextEdit
from gui.LibrarySystemUI import LibrarySystemUI
class LoginDialog(QDialog):
def __init__(self, user_manager):
super().__init__()
self.user_manager = user_manager
self.layout = QVBoxLayout()
self.setWindowTitle("请登录")
self.label = QLabel("请输入您的用户名称和密码")
self.layout.addWidget(self.label)
self.userID_line_edit = QLineEdit()
self.userID = QHBoxLayout()
self.userID.addWidget(QLabel("账户"))
self.userID.addWidget(self.userID_line_edit)
self.layout.addLayout(self.userID)
self.password_line_edit = QLineEdit()
self.password = QHBoxLayout()
self.password.addWidget(QLabel("密码"))
self.password.addWidget(self.password_line_edit)
self.layout.addLayout(self.password)
self.login_button = QPushButton("登录")
self.login_button.clicked.connect(self.login)
self.layout.addWidget(self.login_button)
self.setLayout(self.layout)
def login(self):
userID = self.userID_line_edit.text()
password = self.password_line_edit.text()
login = self.user_manager.login(userID, password)
if login:
self.hide()
self.lsu = LibrarySystemUI(self.user_manager)
self.lsu.show()