Skip to content

Commit

Permalink
Quality Check - suppress Fix summary dialogs
Browse files Browse the repository at this point in the history
  • Loading branch information
kiwidude68 committed Aug 5, 2024
1 parent 66603eb commit ade81ba
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 7 deletions.
6 changes: 6 additions & 0 deletions quality_check/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Quality Check Change Log

## [1.13.14] - 2024-08-05
### Added
- Added a 'Suppress Fix summary dialogs' option to prevent a summary dialog showing the success/failure of the operation.
### Fixed
- Some of the icon sizes in the Configure dialog had larger icons.

## [1.13.13] - 2024-08-02
### Fixed
- The 'Check unused image files' feature for ePUB now also checks inline style elements.
Expand Down
2 changes: 1 addition & 1 deletion quality_check/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class ActionQualityCheck(InterfaceActionBase):
description = 'Query your library for poor quality covers or invalid metadata'
supported_platforms = ['windows', 'osx', 'linux']
author = 'Grant Drake with updates by others'
version = (1, 13, 13)
version = (1, 13, 14)
minimum_calibre_version = (3, 41, 0)

#: This field defines the GUI plugin class that contains all the code
Expand Down
21 changes: 17 additions & 4 deletions quality_check/check_fix.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,8 @@ def evaluate_book(book_id, db):
(total_count, self.updated_format_count, len(result_ids), cancelled_msg)
self.gui.status_bar.showMessage(msg)
if len(result_ids) == 0:
return info_dialog(self.gui, 'No Matches%s'%cancelled_msg, _('All book format sizes are correct'), show=True)
self.gui.status_bar.showMessage(_('All book format sizes are correct'))
return
self.gui.library_view.model().refresh_ids(list(result_ids))


Expand All @@ -203,7 +204,8 @@ def evaluate_book(book_id, db):
(total_count, len(result_ids), cancelled_msg)
self.gui.status_bar.showMessage(msg)
if len(result_ids) == 0:
return info_dialog(self.gui, _('No Matches%s')%cancelled_msg, _('All books have up to date paths'), show=True)
self.gui.status_bar.showMessage(_('All books have up to date paths'))
return
self.gui.library_view.model().refresh_ids(list(result_ids))


Expand All @@ -230,8 +232,14 @@ def cleanup_opf_folders(self):
self._cleanup_directory_if_needed(path, messages, errors, delete_parent=False)

if len(messages) == 0 and len(errors) == 0:
return info_dialog(self.gui, _('No files deleted'),
_('No files/folders were found to be deleted'), show=True)
self.gui.status_bar.showMessage(_('No files/folders were found to be deleted'))
return

c = cfg.plugin_prefs[cfg.STORE_OPTIONS]
suppress_dialog = c.get(cfg.KEY_SUPPRESS_FIX_DIALOG, False)
if suppress_dialog:
self.gui.status_bar.showMessage(_('Cleanup completed'))
return

msg = _('Deleted %d files/folders with %d errors. See details for more info.') % \
(len(messages), len(errors))
Expand Down Expand Up @@ -358,6 +366,11 @@ def apply_fix(book_id):
d = ApplyFixProgressDialog(self.gui, _('Fixing ASIN for %d books'), book_ids, tdir, apply_fix)
d.exec_()

c = cfg.plugin_prefs[cfg.STORE_OPTIONS]
suppress_dialog = c.get(cfg.KEY_SUPPRESS_FIX_DIALOG, False)
if suppress_dialog:
self.gui.status_bar.showMessage(_('Fix ASIN completed'))
return
sd = ResultsSummaryDialog(self.gui, _('Quality Check'),
_('%d books updated, see log for details')%len(d.updated_ids),
self.log)
Expand Down
13 changes: 11 additions & 2 deletions quality_check/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
pass # load_translations() added in calibre 1.9

try:
from qt.core import (QWidget, QVBoxLayout, QLabel, QUrl,
from qt.core import (QWidget, QVBoxLayout, QLabel, QUrl, QCheckBox, QSize,
QGroupBox, QGridLayout, QListWidget, QListWidgetItem,
QAbstractItemView, Qt, QPushButton, QSpinBox)
except:
from PyQt5.Qt import (QWidget, QVBoxLayout, QLabel, QUrl,
from PyQt5.Qt import (QWidget, QVBoxLayout, QLabel, QUrl, QCheckBox, QSize,
QGroupBox, QGridLayout, QListWidget, QListWidgetItem,
QAbstractItemView, Qt, QPushButton, QSpinBox)

Expand Down Expand Up @@ -61,6 +61,7 @@
KEY_EXCLUSIONS_BY_CHECK = 'exclusionsByCheck'
KEY_AUTHOR_INITIALS_MODE = 'authorInitialsMode'
AUTHOR_INITIALS_MODES = ['A.B.', 'A. B.', 'A B', 'AB']
KEY_SUPPRESS_FIX_DIALOG = 'suppressFixDialog'

DEFAULT_LIBRARY_VALUES = {
KEY_EXCLUSIONS_BY_CHECK: { },
Expand Down Expand Up @@ -242,6 +243,7 @@ def __init__(self, parent=None):
QListWidget.__init__(self, parent)
self.setSelectionBehavior(QAbstractItemView.SelectRows)
self.setSelectionMode(QAbstractItemView.SingleSelection)
self.setIconSize(QSize(16,16))
self.populate()

def populate(self):
Expand Down Expand Up @@ -316,6 +318,12 @@ def __init__(self, plugin_action, all_tags):
initials_mode = c.get(KEY_AUTHOR_INITIALS_MODE, AUTHOR_INITIALS_MODES[0])
self.initials_combo = KeyValueComboBox(self, initials_map, initials_mode)
other_layout.addWidget(self.initials_combo, 0, 1, 1, 1)

self.suppress_dialog_checkbox = QCheckBox(_('Suppress Fix summary dialogs'), self)
self.suppress_dialog_checkbox.setToolTip(_('Uncheck this option if you do not want interactive dialogs to appear summarising the operation'))
if c.get(KEY_SUPPRESS_FIX_DIALOG, False):
self.suppress_dialog_checkbox.setCheckState(Qt.Checked)
other_layout.addWidget(self.suppress_dialog_checkbox, 1, 0, 1, 2)
other_layout.setColumnStretch(2, 1)

menus_groupbox = QGroupBox(_('Visible menus'))
Expand Down Expand Up @@ -349,6 +357,7 @@ def save_settings(self):
exclude_tag_text = exclude_tag_text[:-1]
new_prefs[KEY_MAX_TAG_EXCLUSIONS] = [t.strip() for t in exclude_tag_text.split(',')]
new_prefs[KEY_AUTHOR_INITIALS_MODE] = self.initials_combo.selected_key()
new_prefs[KEY_SUPPRESS_FIX_DIALOG] = self.suppress_dialog_checkbox.checkState() == Qt.Checked
new_prefs[KEY_SEARCH_SCOPE] = plugin_prefs[STORE_OPTIONS].get(KEY_SEARCH_SCOPE, SCOPE_LIBRARY)

new_prefs[KEY_HIDDEN_MENUS] = self.visible_menus_list.get_hidden_menus()
Expand Down

0 comments on commit ade81ba

Please sign in to comment.