def read_next_unread_chapter(self, viewmode="single"): title = self.manga_list.currentItem().text() manga = Library.create_manga_from_db_by_title(title) chapter = manga.get_next_chapter_to_read() self.reader_view_window = reading_window.ReaderWindow(self, chapter, viewmode) self.reader_view_window.show()
def download_manga(self): title = self.manga_list.currentItem().text() manga = Library.create_manga_from_db_by_title(title) self.download_task = bg_downloaded.ChapterDownloadWorker(self) self.download_task.data_downloaded.connect(self.status_message) for chapter in manga.chapter_list: self.download_task.push(chapter) self.download_task.start()
def update_chapter_table(self): item = self.manga_list.currentItem() title = item.text() table = [] manga = Library.create_manga_from_db_by_title(title) for chapter in manga.chapter_list: table.append([chapter.title, chapter.number, chapter.completed, chapter.downloaded]) self.chapter_model.update(table) self.chapter_table.selectionModel().clear()
def set_chapter_as_complete(self): manga_title = self.manga_list.currentItem().text() manga = Library.create_manga_from_db_by_title(manga_title) rows = self.chapter_table.selectionModel().selectedRows() for index in rows: title = self.chapter_model.table[index.row()][0] Library.db.cursor().execute( "UPDATE chapter SET completed=1 WHERE manga_id={} and title='{}'".format(manga.hash, title) ) Library.db.commit() self.update_chapter_table()
def read_chapter(self, view_mode=None): if not self.chapter_model.table: self.read_next_unread_chapter(view_mode) return title = self.manga_list.currentItem().text() manga = Library.create_manga_from_db_by_title(title) index = self.chapter_table.selectionModel().currentIndex() title = self.chapter_model.table[index.row()][0] chapter = manga.get_chapter_by_title(title) self.reader_view_window = reading_window.ReaderWindow(self, chapter, view_mode) self.reader_view_window.show()
def remove_manga(self): title = self.manga_list.currentItem().text() manga = Library.create_manga_from_db_by_title(title) Library.remove_manga(manga) self.statusBar().showMessage("Removed: {}".format(title), 5000) self.update_manga_list()