diff --git a/src/calibre/gui2/book_details.py b/src/calibre/gui2/book_details.py index efa9ad4ffc..7b6859ce7d 100644 --- a/src/calibre/gui2/book_details.py +++ b/src/calibre/gui2/book_details.py @@ -219,13 +219,13 @@ class CoverView(QWidget): # {{{ gc.triggered.connect(self.generate_cover) m = QMenu(_('Open cover with...')) - populate_menu(m, self.open_with, 'jpeg') + populate_menu(m, self.open_with, 'cover_image') if len(m.actions()) == 0: cm.addAction(_('Open cover with...'), self.choose_open_with) else: m.addSeparator() m.addAction(_('Add another application to open cover...'), self.choose_open_with) - m.addAction(_('Edit Open With applications...'), partial(edit_programs, 'jpeg', self)) + m.addAction(_('Edit Open With applications...'), partial(edit_programs, 'cover_image', self)) cm.addMenu(m) cm.exec_(ev.globalPos()) @@ -236,7 +236,7 @@ class CoverView(QWidget): # {{{ def choose_open_with(self): from calibre.gui2.open_with import choose_program - entry = choose_program('jpeg', self) + entry = choose_program('cover_image', self) if entry is not None: self.open_with(entry) diff --git a/src/calibre/gui2/open_with.py b/src/calibre/gui2/open_with.py index b5d0930e5a..5f5110f623 100644 --- a/src/calibre/gui2/open_with.py +++ b/src/calibre/gui2/open_with.py @@ -180,19 +180,19 @@ class ChooseProgram(Dialog): # {{{ oprefs.defaults['entries'] = {} def choose_program(file_type='jpeg', parent=None, prefs=oprefs): - file_type = file_type.lower() + oft = file_type = file_type.lower() + file_type = {'cover_image':'jpeg'}.get(oft, oft) d = ChooseProgram(file_type, parent, prefs) d.exec_() entry = choose_manually(file_type, parent) if d.select_manually else d.selected_entry if entry is not None: entry = finalize_entry(entry) - entry['keyboard_shortcut'] = None entry['uuid'] = type('')(uuid.uuid4()) entries = oprefs['entries'] - if file_type not in entries: - entries[file_type] = [] - entries[file_type].append(entry) - entries[file_type].sort(key=entry_sort_key) + if oft not in entries: + entries[oft] = [] + entries[oft].append(entry) + entries[oft].sort(key=entry_sort_key) oprefs['entries'] = entries return entry