Fix font size selection index, Cleanup

This commit is contained in:
BasioMeusPuga
2018-01-29 05:35:41 +05:30
parent ce90c0a6ea
commit 7bc28f5172
5 changed files with 14 additions and 17 deletions

4
TODO
View File

@@ -7,6 +7,7 @@ TODO
✓ Remember files
✓ Check files (hashes) upon restart
✓ Draw shadows
Perform culling
Library:
✓ sqlite3 for cover images cache
✓ sqlite3 for storing metadata
@@ -42,6 +43,9 @@ TODO
✓ View and hide toolbar actions in a list
Graphical themes
Comic view keyboard shortcuts
Comic view modes
Continuous paging
Double pages
Record progress
Pagination
Set context menu for definitions and the like

View File

@@ -140,7 +140,7 @@ class MainUI(QtWidgets.QMainWindow, mainwindow.Ui_MainWindow):
self.bookToolBar.profileBox.setCurrentIndex(self.current_profile_index)
self.bookToolBar.fontBox.currentFontChanged.connect(self.modify_font)
self.bookToolBar.fontSizeBox.currentTextChanged.connect(self.modify_font)
self.bookToolBar.fontSizeBox.currentIndexChanged.connect(self.modify_font)
self.bookToolBar.lineSpacingUp.triggered.connect(self.modify_font)
self.bookToolBar.lineSpacingDown.triggered.connect(self.modify_font)
self.bookToolBar.paddingUp.triggered.connect(self.modify_font)
@@ -663,9 +663,10 @@ class MainUI(QtWidgets.QMainWindow, mainwindow.Ui_MainWindow):
if signal_sender == 'fontSizeBox':
old_size = current_profile['font_size']
new_size = self.bookToolBar.fontSizeBox.currentText()
new_size = self.bookToolBar.fontSizeBox.itemText(
self.bookToolBar.fontSizeBox.currentIndex())
if new_size.isdigit():
current_profile['font_size'] = int(new_size)
current_profile['font_size'] = new_size
else:
current_profile['font_size'] = old_size
@@ -769,7 +770,9 @@ class MainUI(QtWidgets.QMainWindow, mainwindow.Ui_MainWindow):
self.bookToolBar.fontBox.blockSignals(True)
self.bookToolBar.fontSizeBox.blockSignals(True)
self.bookToolBar.fontBox.setCurrentText(font)
self.bookToolBar.fontSizeBox.setCurrentText(str(font_size))
current_index = self.bookToolBar.fontSizeBox.findText(
str(font_size), QtCore.Qt.MatchExactly)
self.bookToolBar.fontSizeBox.setCurrentIndex(current_index)
self.bookToolBar.fontBox.blockSignals(False)
self.bookToolBar.fontSizeBox.blockSignals(False)

View File

@@ -165,7 +165,6 @@ class Library:
self.parent.libraryToolBar.searchBar.text())
def create_proxymodel(self):
# self.proxy_model = QtCore.QSortFilterProxyModel()
self.proxy_model = ItemProxyModel()
self.proxy_model.setSourceModel(self.view_model)
self.proxy_model.setSortCaseSensitivity(False)
@@ -252,13 +251,6 @@ class Library:
this_item.setData(directory_name, QtCore.Qt.UserRole + 10)
this_item.setData(directory_tags, QtCore.Qt.UserRole + 11)
# search_workaround_base = this_item.data(QtCore.Qt.UserRole + 10)
# for j in get_tags(all_metadata):
# if j:
# search_workaround_base += j
# this_item.setData(search_workaround_base, QtCore.Qt.UserRole + 4)
# Table Model
for count, i in enumerate(self.table_model.display_data):
all_metadata = i[5]

View File

@@ -52,7 +52,9 @@ class ItemProxyModel(QtCore.QSortFilterProxyModel):
if not self.filter_text:
return True
else:
valid_data = [i.lower() for i in (title, author, tags, directory_name, directory_tags) if i is not None]
valid_data = [
i.lower() for i in (
title, author, tags, directory_name, directory_tags) if i is not None]
for i in valid_data:
if self.filter_text.lower() in i:
return True

View File

@@ -95,10 +95,6 @@ class BookSorter:
progress_object_generator()
def database_hashes(self):
# TODO
# Overwrite book if deleted and then re-added
# Also fetch the path of the file here
all_hashes_and_paths = database.DatabaseFunctions(
self.database_path).fetch_data(
('Hash', 'Path'),