mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Metadata download review dialog: Add an option to mark rejected books in the main book list after the review is completed. Fixes #1507198 [[feature request] Mark rejected download results](https://bugs.launchpad.net/calibre/+bug/1507198)
This commit is contained in:
parent
b5b681d525
commit
06c5f0c1f2
@ -138,6 +138,7 @@ defs['gpm_template_editor_font_size'] = 10
|
||||
defs['show_emblems'] = False
|
||||
defs['emblem_size'] = 32
|
||||
defs['emblem_position'] = 'left'
|
||||
defs['metadata_diff_mark_rejected'] = False
|
||||
del defs
|
||||
# }}}
|
||||
|
||||
|
@ -173,6 +173,7 @@ class EditMetadataAction(InterfaceAction):
|
||||
good_ids, tdir, log_file, lm_map, failed_ids = payload
|
||||
if not good_ids:
|
||||
return
|
||||
restrict_to_failed = False
|
||||
|
||||
modified = set()
|
||||
db = self.gui.current_db
|
||||
@ -244,6 +245,9 @@ class EditMetadataAction(InterfaceAction):
|
||||
db=db
|
||||
)
|
||||
if d.exec_() == d.Accepted:
|
||||
if d.mark_rejected:
|
||||
failed_ids |= d.rejected_ids
|
||||
restrict_to_failed = True
|
||||
nid_map = {}
|
||||
for book_id, (changed, mi) in d.accepted.iteritems():
|
||||
if mi is None: # discarded
|
||||
@ -263,7 +267,7 @@ class EditMetadataAction(InterfaceAction):
|
||||
else:
|
||||
id_map = {}
|
||||
|
||||
restrict_to_failed = bool(args and args[0])
|
||||
restrict_to_failed = restrict_to_failed or bool(args and args[0])
|
||||
if restrict_to_failed:
|
||||
db.data.set_marked_ids(failed_ids)
|
||||
|
||||
|
@ -15,7 +15,7 @@ from PyQt5.Qt import (
|
||||
QDialog, QWidget, QGridLayout, QLabel, QToolButton, QIcon,
|
||||
QVBoxLayout, QDialogButtonBox, QApplication, pyqtSignal, QFont, QPixmap,
|
||||
QSize, QPainter, Qt, QColor, QPen, QSizePolicy, QScrollArea, QFrame,
|
||||
QKeySequence, QAction, QMenu)
|
||||
QKeySequence, QAction, QMenu, QHBoxLayout, QCheckBox)
|
||||
|
||||
from calibre import fit_image
|
||||
from calibre.ebooks.metadata import title_sort, authors_to_sort_string, fmt_sidx
|
||||
@ -539,6 +539,7 @@ class CompareMany(QDialog):
|
||||
self.ids = list(ids)
|
||||
self.total = len(self.ids)
|
||||
self.accepted = OrderedDict()
|
||||
self.rejected_ids = set()
|
||||
self.window_title = window_title or _('Compare metadata')
|
||||
|
||||
if intro_msg:
|
||||
@ -585,7 +586,14 @@ class CompareMany(QDialog):
|
||||
b.setIcon(QIcon(I('forward.png' if self.total > 1 else 'ok.png')))
|
||||
b.clicked.connect(partial(self.next_item, True))
|
||||
b.setDefault(True)
|
||||
l.addWidget(bb)
|
||||
self.bbh = h = QHBoxLayout()
|
||||
h.setContentsMargins(0, 0, 0, 0)
|
||||
l.addLayout(h)
|
||||
self.markq = m = QCheckBox(_('&Mark rejected books'))
|
||||
m.setChecked(gprefs['metadata_diff_mark_rejected'])
|
||||
m.stateChanged[int].connect(lambda : gprefs.set('metadata_diff_mark_rejected', m.isChecked()))
|
||||
m.setToolTip(_('Mark rejected books in the book list after this dialog is closed'))
|
||||
h.addWidget(m), h.addWidget(bb)
|
||||
|
||||
self.next_item(True)
|
||||
|
||||
@ -599,6 +607,10 @@ class CompareMany(QDialog):
|
||||
self.restoreGeometry(geom)
|
||||
b.setFocus(Qt.OtherFocusReason)
|
||||
|
||||
@property
|
||||
def mark_rejected(self):
|
||||
return self.markq.isChecked()
|
||||
|
||||
def action_button_clicked(self):
|
||||
self.action_button_action(self.ids[0])
|
||||
|
||||
@ -623,6 +635,8 @@ class CompareMany(QDialog):
|
||||
changed = self.compare_widget.apply_changes()
|
||||
if self.current_mi is not None:
|
||||
old_id = self.ids.pop(0)
|
||||
if not accept:
|
||||
self.rejected_ids.add(old_id)
|
||||
self.accepted[old_id] = (changed, self.current_mi) if accept else (False, None)
|
||||
if not self.ids:
|
||||
return self.accept()
|
||||
@ -645,6 +659,7 @@ class CompareMany(QDialog):
|
||||
return
|
||||
self.next_item(False)
|
||||
for id_ in self.ids:
|
||||
self.rejected_ids.add(id_)
|
||||
oldmi, newmi = self.get_metadata(id_)
|
||||
self.accepted[id_] = (False, None)
|
||||
self.ids = []
|
||||
|
Loading…
x
Reference in New Issue
Block a user