mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
When setting cover from a PDF file and the user clicks cancel, do not delete the existing cover
This commit is contained in:
parent
e64afede00
commit
bee21462e0
@ -872,12 +872,15 @@ class EditMetadataAction(InterfaceAction):
|
|||||||
'Cannot read cover as the %s file is missing from this book') % 'PDF', show=True)
|
'Cannot read cover as the %s file is missing from this book') % 'PDF', show=True)
|
||||||
from calibre.gui2.metadata.pdf_covers import PDFCovers
|
from calibre.gui2.metadata.pdf_covers import PDFCovers
|
||||||
d = PDFCovers(pdfpath, parent=self.gui)
|
d = PDFCovers(pdfpath, parent=self.gui)
|
||||||
if d.exec_() == d.Accepted:
|
ret = d.exec_()
|
||||||
|
if ret == d.Accepted:
|
||||||
cpath = d.cover_path
|
cpath = d.cover_path
|
||||||
if cpath:
|
if cpath:
|
||||||
with open(cpath, 'rb') as f:
|
with open(cpath, 'rb') as f:
|
||||||
cdata = f.read()
|
cdata = f.read()
|
||||||
d.cleanup()
|
d.cleanup()
|
||||||
|
if ret != d.Accepted:
|
||||||
|
return
|
||||||
else:
|
else:
|
||||||
stream = BytesIO()
|
stream = BytesIO()
|
||||||
try:
|
try:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user