Fix empty database triggering error at first start
This commit is contained in:
@@ -251,12 +251,14 @@ class Library:
|
||||
db_library_directories = database.DatabaseFunctions(
|
||||
self.parent.database_path).fetch_data(
|
||||
('Path',),
|
||||
'books', # This checks the directories table NOT the book one
|
||||
'books', # THIS CHECKS THE BOOKS TABLE
|
||||
{'Path': ''},
|
||||
'LIKE')
|
||||
|
||||
library_directories = {
|
||||
i[0]: (None, None) for i in db_library_directories}
|
||||
library_directories = None
|
||||
if db_library_directories:
|
||||
library_directories = {
|
||||
i[0]: (None, None) for i in db_library_directories}
|
||||
|
||||
def get_tags(all_metadata):
|
||||
path = os.path.dirname(all_metadata['path'])
|
||||
@@ -282,6 +284,7 @@ class Library:
|
||||
return added_string.lower(), None
|
||||
|
||||
# Generate tags for the QStandardItemModel
|
||||
# This isn't triggered for an empty view model
|
||||
for i in range(self.view_model.rowCount()):
|
||||
this_item = self.view_model.item(i, 0)
|
||||
all_metadata = this_item.data(QtCore.Qt.UserRole + 3)
|
||||
|
@@ -53,7 +53,7 @@ class Settings:
|
||||
self.parent.settings['current_view'] = int(self.settings.value('currentView', 0))
|
||||
self.parent.settings['main_window_headers'] = self.settings.value('tableHeaders', None)
|
||||
self.parent.settings['listview_background'] = self.settings.value(
|
||||
'listViewBackground', QtGui.QColor().fromRgb(76, 76, 76))
|
||||
'listViewBackground', QtGui.QColor().fromRgb(33, 33, 33))
|
||||
self.parent.settings['icon_theme'] = self.settings.value('iconTheme', 'DarkIcons')
|
||||
self.settings.endGroup()
|
||||
|
||||
|
Reference in New Issue
Block a user