diff --git a/TODO b/TODO index 16de618..e42ced0 100644 --- a/TODO +++ b/TODO @@ -66,7 +66,6 @@ TODO Bugs: If there are files open and the database is deleted, TypeErrors result Cover culling does not occur if some other tab has initial focus - Exiting with Ctrl + Q does not save the cursor position INITIALLY Slider position change might be acting up too Secondary: diff --git a/lector/__main__.py b/lector/__main__.py index f5dedb4..af58682 100755 --- a/lector/__main__.py +++ b/lector/__main__.py @@ -189,6 +189,7 @@ class MainUI(QtWidgets.QMainWindow, mainwindow.Ui_MainWindow): # The library refresh button on the Library tab self.reloadLibrary.setIcon(self.QImageFactory.get_image('reload')) + self.reloadLibrary.setIconSize(QtCore.QSize(22, 22)) self.reloadLibrary.setObjectName('reloadLibrary') self.reloadLibrary.setToolTip('Scan library') self.reloadLibrary.setAutoRaise(True) @@ -287,6 +288,9 @@ class MainUI(QtWidgets.QMainWindow, mainwindow.Ui_MainWindow): self.temp_dir.path()) parsed_books = books.initiate_threads() + if not parsed_books: + return + database.DatabaseFunctions(self.database_path).add_to_database(parsed_books) self.lib_ref.generate_model('addition', parsed_books, True) diff --git a/lector/sorter.py b/lector/sorter.py index ee0f482..99be152 100644 --- a/lector/sorter.py +++ b/lector/sorter.py @@ -149,7 +149,9 @@ class BookSorter: # Do not allow addition in case the file # is already in the database and it remains at its original path if self.mode == 'addition' and file_md5 in self.hashes_and_paths: - if self.hashes_and_paths[file_md5] == filename: + if (self.hashes_and_paths[file_md5] == filename + and os.path.exists(self.hashes_and_paths[file_md5])): + print(f'{os.path.basename(filename)} is already in database') return file_extension = os.path.splitext(filename)[1][1:] @@ -247,6 +249,9 @@ class BookSorter: break def initiate_threads(self): + if not self.file_list: + return None + def pool_creator(): _pool = Pool(5) self.processed_books = _pool.map( diff --git a/lector/threaded.py b/lector/threaded.py index fa90a46..badde53 100644 --- a/lector/threaded.py +++ b/lector/threaded.py @@ -58,7 +58,11 @@ class BackGroundBookAddition(QtCore.QThread): self.database_path, self.parent.settings['auto_tags'], self.parent.temp_dir.path()) + parsed_books = books.initiate_threads() + if not parsed_books: + return + self.parent.lib_ref.generate_model('addition', parsed_books, False) if self.prune_required: self.parent.lib_ref.prune_models(self.file_list) diff --git a/lector/widgets.py b/lector/widgets.py index e2b8fa2..ebee063 100644 --- a/lector/widgets.py +++ b/lector/widgets.py @@ -237,14 +237,6 @@ class Tab(QtWidgets.QWidget): self.exit_fs.setContext(QtCore.Qt.ApplicationShortcut) self.exit_fs.activated.connect(self.exit_fullscreen) - # TODO - # See why Ctrl + Q won't work on a non fullscreened contentView - # widget in case the following is in code - - # self.exit_all = QtWidgets.QShortcut( - # QtGui.QKeySequence('Ctrl+Q'), self.contentView) - # self.exit_all.activated.connect(self.sneaky_exit) - def go_fullscreen(self): if self.contentView.windowState() == QtCore.Qt.WindowFullScreen: self.exit_fullscreen()