mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Edit book: Pre-select existing cover image (if any) in add cover dialog
This commit is contained in:
parent
022ab0ff3a
commit
ed2662af7b
@ -20,6 +20,7 @@ from PyQt5.Qt import (
|
|||||||
|
|
||||||
from calibre import prepare_string_for_xml, human_readable
|
from calibre import prepare_string_for_xml, human_readable
|
||||||
from calibre.constants import iswindows
|
from calibre.constants import iswindows
|
||||||
|
from calibre.ebooks.oeb.polish.cover import get_raster_cover_name
|
||||||
from calibre.ebooks.oeb.polish.utils import lead_text, guess_type
|
from calibre.ebooks.oeb.polish.utils import lead_text, guess_type
|
||||||
from calibre.gui2 import error_dialog, choose_files, choose_save_file, info_dialog, choose_images
|
from calibre.gui2 import error_dialog, choose_files, choose_save_file, info_dialog, choose_images
|
||||||
from calibre.gui2.tweak_book import tprefs, current_container
|
from calibre.gui2.tweak_book import tprefs, current_container
|
||||||
@ -1091,6 +1092,11 @@ class AddCover(Dialog):
|
|||||||
b.setIcon(QIcon(I('document_open.png')))
|
b.setIcon(QIcon(I('document_open.png')))
|
||||||
self.names.setFocus(Qt.OtherFocusReason)
|
self.names.setFocus(Qt.OtherFocusReason)
|
||||||
self.names.selectionModel().currentChanged.connect(self.current_image_changed)
|
self.names.selectionModel().currentChanged.connect(self.current_image_changed)
|
||||||
|
cname = get_raster_cover_name(self.container)
|
||||||
|
if cname:
|
||||||
|
row = self.names.model().find_name(cname)
|
||||||
|
if row > -1:
|
||||||
|
self.names.setCurrentIndex(self.names.model().index(row))
|
||||||
|
|
||||||
def double_clicked(self):
|
def double_clicked(self):
|
||||||
self.accept()
|
self.accept()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user