mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
...
This commit is contained in:
parent
de2e424c88
commit
813e52bbf8
@ -132,6 +132,9 @@ def prints(*args, **kwargs):
|
||||
try:
|
||||
arg = arg.encode(enc)
|
||||
except UnicodeEncodeError:
|
||||
try:
|
||||
arg = arg.encode('utf-8')
|
||||
except:
|
||||
if not safe_encode:
|
||||
raise
|
||||
arg = repr(arg)
|
||||
|
@ -514,7 +514,7 @@ class DocumentView(QWebView):
|
||||
mt = guess_type(path)[0]
|
||||
html = open(path, 'rb').read().decode(path.encoding, 'replace')
|
||||
html = EntityDeclarationProcessor(html).processed_html
|
||||
has_svg = re.search(r'<\S*svg', html) is not None
|
||||
has_svg = re.search(r'<[:a-z]*svg', html) is not None
|
||||
|
||||
if 'xhtml' in mt:
|
||||
html = self.self_closing_pat.sub(self.self_closing_sub, html)
|
||||
@ -522,6 +522,7 @@ class DocumentView(QWebView):
|
||||
self.manager.load_started()
|
||||
self.loading_url = QUrl.fromLocalFile(path)
|
||||
if has_svg:
|
||||
prints('Rendering as XHTML...')
|
||||
self.setContent(QByteArray(html.encode(path.encoding)), mt, QUrl.fromLocalFile(path))
|
||||
else:
|
||||
self.setHtml(html, self.loading_url)
|
||||
|
@ -52,10 +52,13 @@ class BaseJob(object):
|
||||
else:
|
||||
self._status_text = _('Error') if self.failed else _('Finished')
|
||||
if DEBUG:
|
||||
try:
|
||||
prints('Job:', self.id, self.description, 'finished',
|
||||
safe_encode=True)
|
||||
prints('\t'.join(self.details.splitlines(True)),
|
||||
safe_encode=True)
|
||||
except:
|
||||
pass
|
||||
if not self._done_called:
|
||||
self._done_called = True
|
||||
try:
|
||||
|
Loading…
x
Reference in New Issue
Block a user