From 1595268b09de5c697c9fd817a1bf4b264c3cb2ae Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 27 May 2013 16:51:55 +0530 Subject: [PATCH] When reviewing downloaded metadata, add a button to view the book being reviewed. Fixes #1184546 (View the eBook when reviewing download metadata) --- src/calibre/gui2/actions/edit_metadata.py | 3 ++- src/calibre/gui2/metadata/diff.py | 9 +++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/calibre/gui2/actions/edit_metadata.py b/src/calibre/gui2/actions/edit_metadata.py index 0fd5d31944..e5a9bfbc7d 100644 --- a/src/calibre/gui2/actions/edit_metadata.py +++ b/src/calibre/gui2/actions/edit_metadata.py @@ -229,7 +229,8 @@ class EditMetadataAction(InterfaceAction): revert_tooltip=_('Discard the downloaded value for: %s'), intro_msg=_('The downloaded metadata is on the left and the original metadata' ' is on the right. If a downloaded value is blank or unknown,' - ' the original value is used.') + ' the original value is used.'), + action_button=(_('&View Book'), I('view.png'), self.gui.iactions['View'].view_historical), ) if d.exec_() == d.Accepted: nid_map = {} diff --git a/src/calibre/gui2/metadata/diff.py b/src/calibre/gui2/metadata/diff.py index 477743aa7a..32364da687 100644 --- a/src/calibre/gui2/metadata/diff.py +++ b/src/calibre/gui2/metadata/diff.py @@ -440,6 +440,7 @@ class CompareMany(QDialog): reject_all_tooltip=None, revert_tooltip=None, intro_msg=None, + action_button=None, **kwargs): QDialog.__init__(self, parent) self.l = l = QVBoxLayout() @@ -480,6 +481,11 @@ class CompareMany(QDialog): b.setIcon(QIcon(I('minus.png'))) if reject_button_tooltip: b.setToolTip(reject_button_tooltip) + if action_button is not None: + self.acb = b = bb.addButton(action_button[0], bb.ActionRole) + b.setIcon(QIcon(action_button[1])) + self.action_button_action = action_button[2] + b.clicked.connect(self.action_button_clicked) self.nb = b = bb.addButton(_('&Next') if self.total > 1 else _('&OK'), bb.ActionRole) b.setIcon(QIcon(I('forward.png' if self.total > 1 else 'ok.png'))) b.clicked.connect(partial(self.next_item, True)) @@ -498,6 +504,9 @@ class CompareMany(QDialog): self.restoreGeometry(geom) b.setFocus(Qt.OtherFocusReason) + def action_button_clicked(self): + self.action_button_action(self.ids[0]) + def accept(self): gprefs.set('diff_dialog_geom', bytearray(self.saveGeometry())) super(CompareMany, self).accept()