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.

40 lines
1.4 KiB

from PySide6.QtWidgets import QDialog, QVBoxLayout, QHBoxLayout, QLabel, QLineEdit, QPushButton
from core.usermanager import UserManager
class AddBook(QDialog):
def __init__(self, user_manager: UserManager):
super().__init__()
self.user_manager = user_manager
self.layout = QVBoxLayout()
self.setWindowTitle("添加图书")
self.isbn = QHBoxLayout()
self.isbn.addWidget(QLabel("ISBN"))
self.isbn_line_edit = QLineEdit()
self.isbn.addWidget(self.isbn_line_edit)
self.layout.addLayout(self.isbn)
self.book_id = QHBoxLayout()
self.book_id.addWidget(QLabel("BookID"))
self.book_id_line_edit = QLineEdit()
self.book_id.addWidget(self.book_id_line_edit)
self.layout.addLayout(self.book_id)
self.location = QHBoxLayout()
self.location.addWidget(QLabel("图书位置"))
self.location_line_edit = QLineEdit()
self.location.addWidget(self.location_line_edit)
self.layout.addLayout(self.location)
self.add_button = QPushButton("添加图书")
self.add_button.clicked.connect(self.add)
self.layout.addWidget(self.add_button)
self.setLayout(self.layout)
def add(self):
self.user_manager.add_book(self.book_id_line_edit.text(), self.isbn_line_edit.text(), self.location_line_edit.text())