diff --git a/src/calibre/gui2/tweak_book/preview.py b/src/calibre/gui2/tweak_book/preview.py index 839cf1be5b..7db9afc9c4 100644 --- a/src/calibre/gui2/tweak_book/preview.py +++ b/src/calibre/gui2/tweak_book/preview.py @@ -190,7 +190,7 @@ class UrlSchemeHandler(QWebEngineUrlSchemeHandler): QTimer.singleShot(0, self.check_for_parse) else: data = get_data(name) - if isinstance(data, type('')): + if isinstance(data, unicode_type): data = data.encode('utf-8') mime_type = { # Prevent warning in console about mimetype of fonts diff --git a/src/pyj/editor.pyj b/src/pyj/editor.pyj index d33c121472..6ca4dadea8 100644 --- a/src/pyj/editor.pyj +++ b/src/pyj/editor.pyj @@ -143,7 +143,8 @@ def live_css(editor_name, sourceline, tags): for node in document.querySelectorAll(f'[data-lnum="{sourceline}"]'): tn = node.tagName.toLowerCase() if node.tagName else '' if tn is not tags[i]: - to_python.live_css_data(ans) + if to_python.live_css_data: + to_python.live_css_data(ans) return i += 1 target = node @@ -162,7 +163,8 @@ def live_css(editor_name, sourceline, tags): }) target = target.parentNode ancestor_specificity += 1 - to_python.live_css_data(ans) + if to_python.live_css_data: + to_python.live_css_data(ans) document.body.addEventListener('click', onclick, True)