mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Edit Book: Add a tool to download external resources (images/stylesheets/etc) that are not included in the book. Fixes #1620058 [[Enhancement] External image links](https://bugs.launchpad.net/calibre/+bug/1620058)
This commit is contained in:
parent
b6dd54575a
commit
a2f3490aca
@ -583,6 +583,25 @@ class Boss(QObject):
|
||||
return
|
||||
self.show_current_diff()
|
||||
|
||||
def get_external_resources(self):
|
||||
if not self.ensure_book(_('You must first open a book in order to transform styles.')):
|
||||
return
|
||||
from calibre.gui2.tweak_book.download import DownloadResources
|
||||
with BusyCursor():
|
||||
self.add_savepoint(_('Before get external resources'))
|
||||
try:
|
||||
d = DownloadResources(self.gui)
|
||||
d.exec_()
|
||||
except Exception:
|
||||
self.rewind_savepoint()
|
||||
raise
|
||||
if d.resources_replaced:
|
||||
self.apply_container_update_to_gui()
|
||||
if d.show_diff:
|
||||
self.show_current_diff()
|
||||
else:
|
||||
self.rewind_savepoint()
|
||||
|
||||
def manage_fonts(self):
|
||||
self.commit_all_editors_to_container()
|
||||
self.gui.manage_fonts.display()
|
||||
|
@ -399,7 +399,9 @@ class Main(MainWindow):
|
||||
'Check external links in the book'))
|
||||
self.action_compress_images = treg('compress-image.png', _('Compress &images losslessly'), self.boss.compress_images, 'compress-images', (), _(
|
||||
'Compress images losslessly'))
|
||||
self.action_transform_styles = treg('wizard.png', _('Transform &styles'), self.boss.transform_styles, 'transform-styles', (), _(
|
||||
self.action_transform_styles = treg('wizard.png', _('Transform &styles'), self.boss.transform_styles, 'get-external-resources', (), _(
|
||||
'Download external resources in the book (images/stylesheets/etc/ that are not included in the book)'))
|
||||
self.action_get_ext_resources = treg('download-metadata.png', _('Get external &resources'), self.boss.get_external_resources, 'transform-styles', (), _(
|
||||
'Transform styles used in the book'))
|
||||
|
||||
def ereg(icon, text, target, sid, keys, description):
|
||||
@ -564,6 +566,7 @@ class Main(MainWindow):
|
||||
e.addAction(self.action_filter_css)
|
||||
e.addAction(self.action_spell_check_book)
|
||||
e.addAction(self.action_check_external_links)
|
||||
e.addAction(self.action_get_ext_resources)
|
||||
e.addAction(self.action_check_book)
|
||||
e.addAction(self.action_reports)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user