Multiple fixes
This commit is contained in:
@@ -21,7 +21,6 @@
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
from PyQt5 import QtWidgets, QtGui, QtCore
|
||||
|
||||
import sorter
|
||||
@@ -443,6 +442,9 @@ class MainUI(QtWidgets.QMainWindow, mainwindow.Ui_MainWindow):
|
||||
self.lib_ref.create_proxymodel()
|
||||
self.lib_ref.generate_library_tags()
|
||||
|
||||
if not self.settings['perform_culling']:
|
||||
self.load_all_covers()
|
||||
|
||||
def switch_library_view(self):
|
||||
if self.libraryToolBar.coverViewButton.isChecked():
|
||||
self.stackedWidget.setCurrentIndex(0)
|
||||
|
@@ -34,7 +34,7 @@ class Library:
|
||||
self.table_proxy_model = None
|
||||
self.table_rows = []
|
||||
|
||||
def generate_model(self, mode, parsed_books=None):
|
||||
def generate_model(self, mode, parsed_books=None, is_database_ready=True):
|
||||
if mode == 'build':
|
||||
self.table_rows = []
|
||||
self.view_model = QtGui.QStandardItemModel()
|
||||
@@ -137,7 +137,9 @@ class Library:
|
||||
self.table_rows.append(
|
||||
[title, author, None, year, tags, all_metadata, i[8]])
|
||||
|
||||
if not self.parent.settings['perform_culling']:
|
||||
# The is_database_ready boolean is required when a new thread sends
|
||||
# books here for model generation.
|
||||
if not self.parent.settings['perform_culling'] and is_database_ready:
|
||||
self.parent.load_all_covers()
|
||||
|
||||
def create_table_model(self):
|
||||
@@ -235,6 +237,8 @@ class Library:
|
||||
directory_name = library_directories[i][0]
|
||||
if directory_name:
|
||||
directory_name = directory_name.lower()
|
||||
else:
|
||||
directory_name = path.rsplit('/')[-1].lower()
|
||||
|
||||
directory_tags = library_directories[i][1]
|
||||
if directory_tags:
|
||||
|
@@ -33,8 +33,6 @@ class ItemProxyModel(QtCore.QSortFilterProxyModel):
|
||||
self.active_library_filters = active_library_filters
|
||||
|
||||
def filterAcceptsRow(self, row, parent):
|
||||
return True
|
||||
|
||||
model = self.sourceModel()
|
||||
|
||||
this_index = model.index(row, 0)
|
||||
@@ -46,7 +44,7 @@ class ItemProxyModel(QtCore.QSortFilterProxyModel):
|
||||
directory_tags = model.data(this_index, QtCore.Qt.UserRole + 11)
|
||||
|
||||
if self.active_library_filters:
|
||||
if directory_name.lower() not in [i.lower() for i in self.active_library_filters]:
|
||||
if directory_name not in [i.lower() for i in self.active_library_filters]:
|
||||
return False
|
||||
else:
|
||||
return False
|
||||
@@ -173,8 +171,6 @@ class TableProxyModel(QtCore.QSortFilterProxyModel):
|
||||
self.active_library_filters = active_library_filters
|
||||
|
||||
def filterAcceptsRow(self, row_num, parent):
|
||||
return True
|
||||
|
||||
if self.filter_string is None or self.filter_columns is None:
|
||||
return True
|
||||
|
||||
|
@@ -57,7 +57,7 @@ class BackGroundBookAddition(QtCore.QThread):
|
||||
self.database_path,
|
||||
self.parent.settings['auto_tags'])
|
||||
parsed_books = books.initiate_threads()
|
||||
self.parent.lib_ref.generate_model('addition', parsed_books)
|
||||
self.parent.lib_ref.generate_model('addition', parsed_books, False)
|
||||
if self.prune_required:
|
||||
self.parent.lib_ref.prune_models(self.file_list)
|
||||
database.DatabaseFunctions(self.database_path).add_to_database(parsed_books)
|
||||
|
@@ -707,6 +707,10 @@ class PliantQTextBrowser(QtWidgets.QTextBrowser):
|
||||
self.setMouseTracking(True)
|
||||
|
||||
def wheelEvent(self, event):
|
||||
if self.verticalScrollBar().maximum() == 0:
|
||||
self.common_functions.wheelEvent(event, False)
|
||||
return
|
||||
|
||||
self.parent.metadata['position']['scroll_value'] = (
|
||||
self.verticalScrollBar().value() / self.verticalScrollBar().maximum())
|
||||
|
||||
|
Reference in New Issue
Block a user