mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
MOBI Output: If the SVG rasterizer is not avaialbale continue anyway
This commit is contained in:
parent
b9ca3bfe3a
commit
ee6fc5c15b
@ -154,7 +154,7 @@ class MOBIOutput(OutputFormatPlugin):
|
|||||||
MobiWriter, PALMDOC, UNCOMPRESSED
|
MobiWriter, PALMDOC, UNCOMPRESSED
|
||||||
from calibre.ebooks.mobi.mobiml import MobiMLizer
|
from calibre.ebooks.mobi.mobiml import MobiMLizer
|
||||||
from calibre.ebooks.oeb.transforms.manglecase import CaseMangler
|
from calibre.ebooks.oeb.transforms.manglecase import CaseMangler
|
||||||
from calibre.ebooks.oeb.transforms.rasterize import SVGRasterizer
|
from calibre.ebooks.oeb.transforms.rasterize import SVGRasterizer, Unavailable
|
||||||
from calibre.ebooks.oeb.transforms.htmltoc import HTMLTOCAdder
|
from calibre.ebooks.oeb.transforms.htmltoc import HTMLTOCAdder
|
||||||
from calibre.customize.ui import plugin_for_input_format
|
from calibre.customize.ui import plugin_for_input_format
|
||||||
imagemax = PALM_MAX_IMAGE_SIZE if opts.rescale_images else None
|
imagemax = PALM_MAX_IMAGE_SIZE if opts.rescale_images else None
|
||||||
@ -163,8 +163,11 @@ class MOBIOutput(OutputFormatPlugin):
|
|||||||
tocadder(oeb, opts)
|
tocadder(oeb, opts)
|
||||||
mangler = CaseMangler()
|
mangler = CaseMangler()
|
||||||
mangler(oeb, opts)
|
mangler(oeb, opts)
|
||||||
rasterizer = SVGRasterizer()
|
try:
|
||||||
rasterizer(oeb, opts)
|
rasterizer = SVGRasterizer()
|
||||||
|
rasterizer(oeb, opts)
|
||||||
|
except Unavailable:
|
||||||
|
self.log.warn('SVG rasterizer unavailable, SVG will not be converted')
|
||||||
mobimlizer = MobiMLizer(ignore_tables=opts.linearize_tables)
|
mobimlizer = MobiMLizer(ignore_tables=opts.linearize_tables)
|
||||||
mobimlizer(oeb, opts)
|
mobimlizer(oeb, opts)
|
||||||
self.check_for_periodical()
|
self.check_for_periodical()
|
||||||
|
@ -27,11 +27,14 @@ from calibre.ebooks.oeb.stylizer import Stylizer
|
|||||||
IMAGE_TAGS = set([XHTML('img'), XHTML('object')])
|
IMAGE_TAGS = set([XHTML('img'), XHTML('object')])
|
||||||
KEEP_ATTRS = set(['class', 'style', 'width', 'height', 'align'])
|
KEEP_ATTRS = set(['class', 'style', 'width', 'height', 'align'])
|
||||||
|
|
||||||
|
class Unavailable(Exception):
|
||||||
|
pass
|
||||||
|
|
||||||
class SVGRasterizer(object):
|
class SVGRasterizer(object):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
from calibre.gui2 import is_ok_to_use_qt
|
from calibre.gui2 import is_ok_to_use_qt
|
||||||
if not is_ok_to_use_qt():
|
if not is_ok_to_use_qt():
|
||||||
raise Exception('Not OK to use Qt')
|
raise Unavailable('Not OK to use Qt')
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def config(cls, cfg):
|
def config(cls, cfg):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user