mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Use a special file type for open cover with entries
This commit is contained in:
parent
fd5dad9bce
commit
9a38645fe2
@ -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)
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user