def allBookButtonClicked(self): self.layout.removeWidget(self.borrowStatusView) sip.delete(self.borrowStatusView) self.borrowStatusView = BorrowStatusViewer(self.userId) self.storageView = BookStorageViewer() self.layout.addWidget(self.storageView) self.allBookButton.setEnabled(False) self.myBookStatus.setEnabled(True) return
def setUpUI(self): # 总布局 self.layout = QHBoxLayout(self) # 按钮布局 self.buttonLayout = QVBoxLayout() # 按钮 self.borrowBookButton = QPushButton("借书") self.returnBookButton = QPushButton("还书") self.myBookStatus = QPushButton("借阅状态") self.bookDetailButton = QPushButton("书籍详情") self.allBookButton = QPushButton("所有书籍") self.bookCateCountButton = QPushButton("书籍统计") self.buttonLayout.addWidget(self.borrowBookButton) self.buttonLayout.addWidget(self.returnBookButton) self.buttonLayout.addWidget(self.myBookStatus) self.buttonLayout.addWidget(self.bookCateCountButton) self.buttonLayout.addWidget(self.allBookButton) self.buttonLayout.addWidget(self.bookDetailButton) self.borrowBookButton.setFixedWidth(100) self.borrowBookButton.setFixedHeight(42) self.returnBookButton.setFixedWidth(100) self.returnBookButton.setFixedHeight(42) self.myBookStatus.setFixedWidth(100) self.myBookStatus.setFixedHeight(42) self.bookDetailButton.setFixedWidth(100) self.bookDetailButton.setFixedHeight(42) self.allBookButton.setFixedWidth(100) self.allBookButton.setFixedHeight(42) self.bookCateCountButton.setFixedWidth(100) self.bookCateCountButton.setFixedHeight(42) font = QFont() font.setPixelSize(16) self.borrowBookButton.setFont(font) self.returnBookButton.setFont(font) self.myBookStatus.setFont(font) self.bookDetailButton.setFont(font) self.allBookButton.setFont(font) self.bookCateCountButton.setFont(font) self.storageView = BookStorageViewer() self.borrowStatusView = BorrowStatusViewer(self.StudentId) self.bookCateCountView = bookCateCountViewer() self.allBookButton.setEnabled(False) self.layout.addLayout(self.buttonLayout) self.layout.addWidget(self.storageView) self.borrowBookButton.clicked.connect(self.borrowBookButtonClicked) self.returnBookButton.clicked.connect(self.returnBookButtonClicked) self.bookCateCountButton.clicked.connect( self.bookCateCountButtonClicked) self.myBookStatus.clicked.connect(self.myBookStatusClicked) self.bookDetailButton.clicked.connect(self.bookDetailButtonClicked) self.allBookButton.clicked.connect(self.allBookButtonClicked)
def myBookStatusClicked(self): """ 图书借还状态记录 """ self.layout.removeWidget(self.storageView) sip.delete(self.storageView) self.storageView = BookStorageViewer() self.borrowStatusView = BorrowStatusViewer(self.StudentId) self.layout.addWidget(self.borrowStatusView) self.allBookButton.setEnabled(True) self.myBookStatus.setEnabled(False) return
def setUpUI(self): self.resize(1400, 900) self.setWindowTitle("欢迎使用图书馆管理系统") self.layout = QHBoxLayout() self.buttonlayout = QVBoxLayout() self.setLayout(self.layout) font = QFont() font.setPixelSize(16) self.addBookButton = QPushButton("添加书籍") # self.dropBookButton = QPushButton("淘汰书籍") self.userButton = QPushButton("用户鉴权") self.userManageButton = QPushButton("删除用户") self.borrowBookButton = QPushButton("借书") self.returnBookButton = QPushButton("还书") self.myBookStatus = QPushButton("借阅状态") self.allBookButton = QPushButton("所有书籍") self.userManageButton.setFont(font) self.userButton.setFont(font)#-- self.addBookButton.setFont(font) # self.dropBookButton.setFont(font) self.userManageButton.setFixedWidth(100) self.userManageButton.setFixedHeight(42) self.userButton.setFixedWidth(100)#-- self.userButton.setFixedHeight(42)#-- self.addBookButton.setFixedWidth(100) self.addBookButton.setFixedHeight(42) # self.dropBookButton.setFixedWidth(100) # self.dropBookButton.setFixedHeight(42) self.borrowBookButton.setFont(font) self.returnBookButton.setFont(font) # -- self.myBookStatus.setFont(font) self.allBookButton.setFont(font) self.borrowBookButton.setFixedWidth(100) self.borrowBookButton.setFixedHeight(42) self.returnBookButton.setFixedWidth(100) # -- self.returnBookButton.setFixedHeight(42) # -- self.myBookStatus.setFixedWidth(100) self.myBookStatus.setFixedHeight(42) self.allBookButton.setFixedWidth(100) self.allBookButton.setFixedHeight(42) self.buttonlayout.addWidget(self.addBookButton) # self.buttonlayout.addWidget(self.dropBookButton) self.buttonlayout.addWidget(self.userButton)#-- self.buttonlayout.addWidget(self.userManageButton) self.buttonlayout.addWidget(self.borrowBookButton) self.buttonlayout.addWidget(self.returnBookButton) self.buttonlayout.addWidget(self.myBookStatus) # -- self.buttonlayout.addWidget(self.allBookButton) self.layout.addLayout(self.buttonlayout) self.storageView = BookStorageViewer() self.borrowStatusView = BorrowStatusViewer(self.userId) self.allBookButton.setEnabled(False) self.borrowBookButton.setEnabled(False) self.returnBookButton.setEnabled(False) self.myBookStatus.setEnabled(False) self.layout.addWidget(self.storageView) self.addBookButton.clicked.connect(self.addBookButtonClicked) # self.dropBookButton.clicked.connect(self.dropBookButtonClicked) self.userManageButton.clicked.connect(self.userManage) self.userButton.clicked.connect(self.UserButtonClicked) # 借书 self.borrowBookButton.clicked.connect(self.borrowBookButtonClicked) # 还书 self.returnBookButton.clicked.connect(self.returnBookButtonClicked) # 借阅状态 self.myBookStatus.clicked.connect(self.myBookStatusClicked) # 所有书籍 self.allBookButton.clicked.connect(self.allBookButtonClicked)