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