Update flatpak manifest
Implement automated missing cover downloading
This commit is contained in:
@@ -165,7 +165,10 @@ class MainUI(QtWidgets.QMainWindow, mainwindow.Ui_MainWindow):
|
||||
self.libraryToolBar.reloadLibraryButton.triggered.connect(
|
||||
self.settingsDialog.start_library_scan)
|
||||
self.libraryToolBar.colorButton.triggered.connect(self.get_color)
|
||||
self.libraryToolBar.settingsButton.triggered.connect(self.show_settings)
|
||||
self.libraryToolBar.settingsButton.triggered.connect(
|
||||
lambda: self.show_settings(0))
|
||||
self.libraryToolBar.aboutButton.triggered.connect(
|
||||
lambda: self.show_settings(3))
|
||||
self.libraryToolBar.searchBar.textChanged.connect(self.lib_ref.update_proxymodels)
|
||||
self.libraryToolBar.sortingBox.activated.connect(self.lib_ref.update_proxymodels)
|
||||
self.libraryToolBar.libraryFilterButton.setPopupMode(QtWidgets.QToolButton.InstantPopup)
|
||||
@@ -369,7 +372,7 @@ class MainUI(QtWidgets.QMainWindow, mainwindow.Ui_MainWindow):
|
||||
file_list,
|
||||
('addition', 'manual'),
|
||||
self.database_path,
|
||||
self.settings['auto_tags'],
|
||||
self.settings,
|
||||
self.temp_dir.path())
|
||||
|
||||
parsed_books = books.initiate_threads()
|
||||
@@ -423,7 +426,7 @@ class MainUI(QtWidgets.QMainWindow, mainwindow.Ui_MainWindow):
|
||||
file_paths,
|
||||
('reading', None),
|
||||
self.database_path,
|
||||
True,
|
||||
self.settings,
|
||||
self.temp_dir.path()).initiate_threads()
|
||||
|
||||
# TODO
|
||||
@@ -739,9 +742,15 @@ class MainUI(QtWidgets.QMainWindow, mainwindow.Ui_MainWindow):
|
||||
else:
|
||||
self.statusBar.setVisible(True)
|
||||
|
||||
def show_settings(self):
|
||||
def show_settings(self, stacked_widget_index):
|
||||
if not self.settingsDialog.isVisible():
|
||||
self.settingsDialog.show()
|
||||
self.settingsDialog.okButton.setVisible(False)
|
||||
index = self.settingsDialog.listModel.index(
|
||||
stacked_widget_index, 0)
|
||||
self.settingsDialog.listView.setCurrentIndex(index)
|
||||
self.settingsDialog.stackedWidget.setCurrentIndex(
|
||||
stacked_widget_index)
|
||||
else:
|
||||
self.settingsDialog.hide()
|
||||
|
||||
|
@@ -64,6 +64,8 @@ class FB2:
|
||||
'author').getText(separator=' ').replace('\n', ' ')
|
||||
if author == '' or author is None:
|
||||
author = '<Unknown>'
|
||||
else:
|
||||
author = author.strip()
|
||||
|
||||
# TODO
|
||||
# Account for other date formats
|
||||
|
@@ -175,6 +175,20 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_16">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="autoCover">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Attempt to download missing book covers from Google books - SLOW</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Download missing covers</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
|
@@ -106,6 +106,12 @@ class Ui_Dialog(object):
|
||||
self.attenuateTitles.setObjectName("attenuateTitles")
|
||||
self.horizontalLayout_9.addWidget(self.attenuateTitles)
|
||||
self.verticalLayout_2.addLayout(self.horizontalLayout_9)
|
||||
self.horizontalLayout_16 = QtWidgets.QHBoxLayout()
|
||||
self.horizontalLayout_16.setObjectName("horizontalLayout_16")
|
||||
self.autoCover = QtWidgets.QCheckBox(self.groupBox)
|
||||
self.autoCover.setObjectName("autoCover")
|
||||
self.horizontalLayout_16.addWidget(self.autoCover)
|
||||
self.verticalLayout_2.addLayout(self.horizontalLayout_16)
|
||||
self.gridLayout_4.addLayout(self.verticalLayout_2, 0, 0, 1, 1)
|
||||
self.verticalLayout.addWidget(self.groupBox)
|
||||
self.groupBox_2 = QtWidgets.QGroupBox(self.switchPage)
|
||||
@@ -342,6 +348,8 @@ class Ui_Dialog(object):
|
||||
self.performCulling.setText(_translate("Dialog", "Load covers only when needed"))
|
||||
self.autoTags.setText(_translate("Dialog", "Generate tags from files"))
|
||||
self.attenuateTitles.setText(_translate("Dialog", "Shrink long book titles"))
|
||||
self.autoCover.setToolTip(_translate("Dialog", "<html><head/><body><p>Attempt to download missing book covers from Google books - SLOW</p></body></html>"))
|
||||
self.autoCover.setText(_translate("Dialog", "Download missing covers"))
|
||||
self.groupBox_2.setTitle(_translate("Dialog", "Reading"))
|
||||
self.hideScrollBars.setToolTip(_translate("Dialog", "Horizontal scrolling with Alt + Scroll\n"
|
||||
"Reopen book to see changes"))
|
||||
|
@@ -122,6 +122,8 @@ class Settings:
|
||||
'cachingEnabled', 'True').capitalize())
|
||||
self.parent.settings['hide_scrollbars'] = literal_eval(self.settings.value(
|
||||
'hideScrollBars', 'False').capitalize())
|
||||
self.parent.settings['auto_cover'] = literal_eval(self.settings.value(
|
||||
'autoCover', 'False').capitalize())
|
||||
self.parent.settings['scroll_speed'] = int(self.settings.value('scrollSpeed', 7))
|
||||
self.parent.settings['consider_read_at'] = int(self.settings.value('considerReadAt', 95))
|
||||
self.parent.settings['small_increment'] = int(self.settings.value('smallIncrement', 4))
|
||||
@@ -211,6 +213,7 @@ class Settings:
|
||||
self.settings.setValue('cachingEnabled', str(current_settings['caching_enabled']))
|
||||
self.settings.setValue('hideScrollBars', str(current_settings['hide_scrollbars']))
|
||||
self.settings.setValue('attenuateTitles', str(current_settings['attenuate_titles']))
|
||||
self.settings.setValue('autoCover', str(current_settings['auto_cover']))
|
||||
self.settings.setValue('scrollSpeed', current_settings['scroll_speed'])
|
||||
self.settings.setValue('considerReadAt', current_settings['consider_read_at'])
|
||||
self.settings.setValue('mangaMode', str(current_settings['manga_mode']))
|
||||
|
@@ -99,6 +99,7 @@ class SettingsUI(QtWidgets.QDialog, settingswindow.Ui_Dialog):
|
||||
self.cachingEnabled.setChecked(self.main_window.settings['caching_enabled'])
|
||||
self.hideScrollBars.setChecked(self.main_window.settings['hide_scrollbars'])
|
||||
self.attenuateTitles.setChecked(self.main_window.settings['attenuate_titles'])
|
||||
self.autoCover.setChecked(self.main_window.settings['auto_cover'])
|
||||
self.scrollSpeedSlider.setValue(self.main_window.settings['scroll_speed'])
|
||||
self.readAtPercent.setValue(self.main_window.settings['consider_read_at'])
|
||||
self.smallIncrementBox.setValue(self.main_window.settings['small_increment'])
|
||||
@@ -112,6 +113,7 @@ class SettingsUI(QtWidgets.QDialog, settingswindow.Ui_Dialog):
|
||||
self.cachingEnabled.clicked.connect(self.manage_checkboxes)
|
||||
self.hideScrollBars.clicked.connect(self.manage_checkboxes)
|
||||
self.attenuateTitles.clicked.connect(self.manage_checkboxes)
|
||||
self.autoCover.clicked.connect(self.manage_checkboxes)
|
||||
self.scrollSpeedSlider.valueChanged.connect(self.change_scroll_speed)
|
||||
self.readAtPercent.valueChanged.connect(self.change_read_at)
|
||||
self.smallIncrementBox.valueChanged.connect(self.change_increment)
|
||||
@@ -390,7 +392,8 @@ class SettingsUI(QtWidgets.QDialog, settingswindow.Ui_Dialog):
|
||||
'performCulling': 'perform_culling',
|
||||
'cachingEnabled': 'caching_enabled',
|
||||
'hideScrollBars': 'hide_scrollbars',
|
||||
'attenuateTitles': 'attenuate_titles'}
|
||||
'attenuateTitles': 'attenuate_titles',
|
||||
'autoCover': 'auto_cover'}
|
||||
|
||||
self.main_window.settings[
|
||||
sender_dict[sender]] = not self.main_window.settings[sender_dict[sender]]
|
||||
|
@@ -102,7 +102,7 @@ class UpdateProgress(QtCore.QObject):
|
||||
|
||||
|
||||
class BookSorter:
|
||||
def __init__(self, file_list, mode, database_path, auto_tags=True, temp_dir=None):
|
||||
def __init__(self, file_list, mode, database_path, settings, temp_dir=None):
|
||||
# Have the GUI pass a list of files straight to here
|
||||
# Then, on the basis of what is needed, pass the
|
||||
# filenames to the requisite functions
|
||||
@@ -115,7 +115,8 @@ class BookSorter:
|
||||
self.work_mode = mode[0]
|
||||
self.addition_mode = mode[1]
|
||||
self.database_path = database_path
|
||||
self.auto_tags = auto_tags
|
||||
self.auto_tags = settings['auto_tags']
|
||||
self.auto_cover = settings['auto_cover']
|
||||
self.temp_dir = temp_dir
|
||||
if database_path:
|
||||
self.database_hashes()
|
||||
@@ -245,10 +246,9 @@ class BookSorter:
|
||||
if cover_image_raw:
|
||||
cover_image = resize_image(cover_image_raw)
|
||||
else:
|
||||
# TODO
|
||||
# Needs an option
|
||||
# cover_image = fetch_cover(title, author)
|
||||
cover_image = None
|
||||
if self.auto_cover:
|
||||
cover_image = fetch_cover(title, author)
|
||||
|
||||
this_book[file_md5]['cover_image'] = cover_image
|
||||
this_book[file_md5]['addition_mode'] = self.addition_mode
|
||||
|
@@ -65,7 +65,7 @@ class BackGroundBookAddition(QtCore.QThread):
|
||||
self.file_list,
|
||||
('addition', self.addition_mode),
|
||||
self.database_path,
|
||||
self.main_window.settings['auto_tags'],
|
||||
self.main_window.settings,
|
||||
self.main_window.temp_dir.path())
|
||||
|
||||
parsed_books = books.initiate_threads()
|
||||
|
@@ -383,16 +383,6 @@ class LibraryToolBar(QtWidgets.QToolBar):
|
||||
image_factory.get_image('remove'),
|
||||
self._translate('LibraryToolBar', 'Delete book'),
|
||||
self)
|
||||
self.colorButton = QtWidgets.QAction(
|
||||
image_factory.get_image('color-picker'),
|
||||
self._translate('LibraryToolBar', 'Library background color'),
|
||||
self)
|
||||
self.colorButton.setObjectName('libraryBackground')
|
||||
self.settingsButton = QtWidgets.QAction(
|
||||
image_factory.get_image('settings'),
|
||||
self._translate('LibraryToolBar', 'Settings'),
|
||||
self)
|
||||
self.settingsButton.setCheckable(True)
|
||||
|
||||
self.coverViewButton = QtWidgets.QAction(
|
||||
image_factory.get_image('view-grid'),
|
||||
@@ -416,6 +406,22 @@ class LibraryToolBar(QtWidgets.QToolBar):
|
||||
self.libraryFilterButton.setToolTip(
|
||||
self._translate('LibraryToolBar', 'Filter library'))
|
||||
|
||||
self.colorButton = QtWidgets.QAction(
|
||||
image_factory.get_image('color-picker'),
|
||||
self._translate('LibraryToolBar', 'Library background color'),
|
||||
self)
|
||||
self.colorButton.setObjectName('libraryBackground')
|
||||
self.settingsButton = QtWidgets.QAction(
|
||||
image_factory.get_image('settings'),
|
||||
self._translate('LibraryToolBar', 'Settings'),
|
||||
self)
|
||||
self.settingsButton.setCheckable(True)
|
||||
|
||||
self.aboutButton = QtWidgets.QAction(
|
||||
image_factory.get_image('about'),
|
||||
self._translate('LibraryToolBar', 'About'),
|
||||
self)
|
||||
|
||||
# Auto unchecks the other QToolButton in case of clicking
|
||||
self.viewButtons = QtWidgets.QActionGroup(self)
|
||||
self.viewButtons.setExclusive(True)
|
||||
@@ -434,6 +440,7 @@ class LibraryToolBar(QtWidgets.QToolBar):
|
||||
self.addSeparator()
|
||||
self.addAction(self.colorButton)
|
||||
self.addAction(self.settingsButton)
|
||||
self.addAction(self.aboutButton)
|
||||
|
||||
# Filter
|
||||
sizePolicy = QtWidgets.QSizePolicy(
|
||||
|
Reference in New Issue
Block a user