From aa0d9bbd14dd6938e583316df60e98bef6873f46 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 31 Jan 2014 09:16:12 +0530 Subject: [PATCH] Only show compare for supported formats --- src/calibre/gui2/book_details.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/calibre/gui2/book_details.py b/src/calibre/gui2/book_details.py index e2a40079f3..8e77afc7d0 100644 --- a/src/calibre/gui2/book_details.py +++ b/src/calibre/gui2/book_details.py @@ -527,8 +527,10 @@ class BookInfo(QWebView): traceback.print_exc() else: from calibre.gui2.ui import get_gui + from calibre.ebooks.oeb.polish.main import SUPPORTED db = get_gui().current_db.new_api ofmt = fmt.upper() if fmt.startswith('ORIGINAL_') else 'ORIGINAL_' + fmt + nfmt = ofmt[len('ORIGINAL_'):] fmts = {x.upper() for x in db.formats(book_id)} for a, t in [('remove', _('Delete the %s format')), ('save', _('Save the %s format to disk')), @@ -538,7 +540,7 @@ class BookInfo(QWebView): if a == 'restore' and not fmt.startswith('ORIGINAL_'): continue if a == 'compare': - if ofmt not in fmts: + if ofmt not in fmts or nfmt not in SUPPORTED: continue t = _('Compare to the %s format') % (fmt[9:] if fmt.startswith('ORIGINAL_') else ofmt) else: