From b5acce6449d6317ee37436ca7e61890fca683f59 Mon Sep 17 00:00:00 2001 From: BasioMeusPuga Date: Mon, 19 Mar 2018 18:26:43 +0530 Subject: [PATCH] Small fixes --- TODO | 1 + lector/settingsdialog.py | 1 + lector/sorter.py | 2 +- lector/threaded.py | 10 +++++++--- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/TODO b/TODO index b09c64f..5959405 100644 --- a/TODO +++ b/TODO @@ -1,5 +1,6 @@ TODO General: + ✓ Internationalization Application icon .desktop file Options: diff --git a/lector/settingsdialog.py b/lector/settingsdialog.py index 27f5e43..4d6feab 100644 --- a/lector/settingsdialog.py +++ b/lector/settingsdialog.py @@ -226,6 +226,7 @@ class SettingsUI(QtWidgets.QDialog, settingswindow.Ui_Dialog): # The books the search thread has found # are now in self.thread.valid_files if not self.thread.valid_files: + self.parent.move_on() return # Hey, messaging is important, okay? diff --git a/lector/sorter.py b/lector/sorter.py index e8a8b4d..ddadfcb 100644 --- a/lector/sorter.py +++ b/lector/sorter.py @@ -151,7 +151,7 @@ class BookSorter: # 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 - and os.path.exists(self.hashes_and_paths[file_md5])): + or os.path.exists(self.hashes_and_paths[file_md5])): if not self.hashes_and_paths[file_md5] == filename: print(f'{os.path.basename(filename)} is already in database') diff --git a/lector/threaded.py b/lector/threaded.py index 7bc1dfe..3f8cba0 100644 --- a/lector/threaded.py +++ b/lector/threaded.py @@ -89,7 +89,8 @@ class BackGroundBookSearch(QtCore.QThread): # Filter for checked directories self.valid_directories = [ - [i[0], i[1], i[2]] for i in data_list if i[3] == QtCore.Qt.Checked] + [i[0], i[1], i[2]] for i in data_list if i[ + 3] == QtCore.Qt.Checked and os.path.exists(i[0])] self.unwanted_directories = [ pathlib.Path(i[0]) for i in data_list if i[3] == QtCore.Qt.Unchecked] @@ -117,8 +118,11 @@ class BackGroundBookSearch(QtCore.QThread): _pool.close() _pool.join() - initiate_threads() - print(len(self.valid_files), 'books found') + if self.valid_directories: + initiate_threads() + print(len(self.valid_files), 'books found') + else: + print('No valid directories') class BackGroundCacheRefill(QtCore.QThread):