예제 #1
0
 def __init__(self, appInfo, author):
     super(EditingAuthorMenu, self).__init__()
     loadUi('adding_author.ui', self)
     this_author = Author()
     for book in author.book_list:
         this_author.add_book(book)
     for genre in author.genre_list:
         this_author.add_genre(genre)
     appInfo.library.delete_author(author.name)
     self.lineEdit.setText(author.name)
     self.lineEdit_2.setText(str(author.birth_year))
     self.lineEdit_3.setText(str(author.death_year))
     self.textEdit.setText(author.description)
     self.pushButton_8.clicked.connect(self.closing)
     self.pushButton_9.clicked.connect(
         lambda: self.adding(appInfo, this_author, author.name))
     self.pushButton_5.clicked.connect(
         lambda: self.adding_book(this_author, appInfo))
     self.pushButton_6.clicked.connect(
         lambda: self.adding_genre(this_author))
     self.pushButton_10.clicked.connect(
         lambda: self.delete_book(this_author))
     self.pushButton_11.clicked.connect(
         lambda: self.delete_genre(this_author))
     self.update_tables(this_author)
예제 #2
0
 def add_new_author(self, appInfo, book):
     author = Author(book.author)
     book_list = [book.name]
     appInfo.authors_database.insert_one({
         "name": book.author,
         "birth_year": 0,
         "death_year": 0,
         "description": '',
         "books": book_list,
         "genres": book.genre_list
     })
     author.add_book(book.name)
     new_window = EditingAuthorMenu(appInfo, author)
     new_window.exec_()
     self.close()