Fix file duplication

Increase icon size for scan library icon
This commit is contained in:
BasioMeusPuga
2018-03-14 11:53:47 +05:30
parent 3c293a39d3
commit c9559daaf6
5 changed files with 14 additions and 10 deletions

1
TODO
View File

@@ -66,7 +66,6 @@ TODO
Bugs: Bugs:
If there are files open and the database is deleted, TypeErrors result If there are files open and the database is deleted, TypeErrors result
Cover culling does not occur if some other tab has initial focus 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 Slider position change might be acting up too
Secondary: Secondary:

View File

@@ -189,6 +189,7 @@ class MainUI(QtWidgets.QMainWindow, mainwindow.Ui_MainWindow):
# The library refresh button on the Library tab # The library refresh button on the Library tab
self.reloadLibrary.setIcon(self.QImageFactory.get_image('reload')) self.reloadLibrary.setIcon(self.QImageFactory.get_image('reload'))
self.reloadLibrary.setIconSize(QtCore.QSize(22, 22))
self.reloadLibrary.setObjectName('reloadLibrary') self.reloadLibrary.setObjectName('reloadLibrary')
self.reloadLibrary.setToolTip('Scan library') self.reloadLibrary.setToolTip('Scan library')
self.reloadLibrary.setAutoRaise(True) self.reloadLibrary.setAutoRaise(True)
@@ -287,6 +288,9 @@ class MainUI(QtWidgets.QMainWindow, mainwindow.Ui_MainWindow):
self.temp_dir.path()) self.temp_dir.path())
parsed_books = books.initiate_threads() parsed_books = books.initiate_threads()
if not parsed_books:
return
database.DatabaseFunctions(self.database_path).add_to_database(parsed_books) database.DatabaseFunctions(self.database_path).add_to_database(parsed_books)
self.lib_ref.generate_model('addition', parsed_books, True) self.lib_ref.generate_model('addition', parsed_books, True)

View File

@@ -149,7 +149,9 @@ class BookSorter:
# Do not allow addition in case the file # Do not allow addition in case the file
# is already in the database and it remains at its original path # 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.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 return
file_extension = os.path.splitext(filename)[1][1:] file_extension = os.path.splitext(filename)[1][1:]
@@ -247,6 +249,9 @@ class BookSorter:
break break
def initiate_threads(self): def initiate_threads(self):
if not self.file_list:
return None
def pool_creator(): def pool_creator():
_pool = Pool(5) _pool = Pool(5)
self.processed_books = _pool.map( self.processed_books = _pool.map(

View File

@@ -58,7 +58,11 @@ class BackGroundBookAddition(QtCore.QThread):
self.database_path, self.database_path,
self.parent.settings['auto_tags'], self.parent.settings['auto_tags'],
self.parent.temp_dir.path()) self.parent.temp_dir.path())
parsed_books = books.initiate_threads() parsed_books = books.initiate_threads()
if not parsed_books:
return
self.parent.lib_ref.generate_model('addition', parsed_books, False) self.parent.lib_ref.generate_model('addition', parsed_books, False)
if self.prune_required: if self.prune_required:
self.parent.lib_ref.prune_models(self.file_list) self.parent.lib_ref.prune_models(self.file_list)

View File

@@ -237,14 +237,6 @@ class Tab(QtWidgets.QWidget):
self.exit_fs.setContext(QtCore.Qt.ApplicationShortcut) self.exit_fs.setContext(QtCore.Qt.ApplicationShortcut)
self.exit_fs.activated.connect(self.exit_fullscreen) 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): def go_fullscreen(self):
if self.contentView.windowState() == QtCore.Qt.WindowFullScreen: if self.contentView.windowState() == QtCore.Qt.WindowFullScreen:
self.exit_fullscreen() self.exit_fullscreen()