mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix errors reported by pyflakes
This commit is contained in:
parent
af59788c71
commit
163f90f083
@ -1,7 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
store_version = 5 # Needed for dynamic plugin loading
|
||||
store_version = 6 # Needed for dynamic plugin loading
|
||||
|
||||
__license__ = 'GPL 3'
|
||||
__copyright__ = '2011-2020, Tomasz Długosz <tomek3d@gmail.com>'
|
||||
@ -9,6 +9,7 @@ __docformat__ = 'restructuredtext en'
|
||||
|
||||
import re
|
||||
from contextlib import closing
|
||||
from base64 import standard_b64encode
|
||||
try:
|
||||
from urllib.parse import quote_plus
|
||||
except ImportError:
|
||||
@ -29,7 +30,7 @@ from calibre.gui2.store.web_store_dialog import WebStoreDialog
|
||||
def as_base64(data):
|
||||
if not isinstance(data, bytes):
|
||||
data = data.encode('utf-8')
|
||||
ans = b64encode(data)
|
||||
ans = standard_b64encode(data)
|
||||
if isinstance(ans, bytes):
|
||||
ans = ans.decode('ascii')
|
||||
return ans
|
||||
|
@ -8,8 +8,6 @@ import textwrap
|
||||
import time
|
||||
from collections import defaultdict
|
||||
from functools import partial
|
||||
from threading import Thread
|
||||
|
||||
from PyQt5.Qt import (
|
||||
QApplication, QByteArray, QHBoxLayout, QIcon, QLabel, QMenu, QSize, QSizePolicy,
|
||||
QStackedLayout, Qt, QTimer, QToolBar, QUrl, QVBoxLayout, QWidget, pyqtSignal
|
||||
@ -18,6 +16,7 @@ from PyQt5.QtWebEngineCore import QWebEngineUrlSchemeHandler
|
||||
from PyQt5.QtWebEngineWidgets import (
|
||||
QWebEnginePage, QWebEngineProfile, QWebEngineScript, QWebEngineView
|
||||
)
|
||||
from threading import Thread
|
||||
|
||||
from calibre import prints
|
||||
from calibre.constants import (
|
||||
@ -25,7 +24,9 @@ from calibre.constants import (
|
||||
)
|
||||
from calibre.ebooks.oeb.base import OEB_DOCS, XHTML_MIME, serialize
|
||||
from calibre.ebooks.oeb.polish.parsing import parse
|
||||
from calibre.gui2 import NO_URL_FORMATTING, error_dialog, is_dark_theme, safe_open_url
|
||||
from calibre.gui2 import (
|
||||
NO_URL_FORMATTING, error_dialog, is_dark_theme, safe_open_url
|
||||
)
|
||||
from calibre.gui2.palette import dark_color, dark_link_color, dark_text_color
|
||||
from calibre.gui2.tweak_book import TOP, actions, current_container, editors, tprefs
|
||||
from calibre.gui2.tweak_book.file_list import OpenWithHandler
|
||||
@ -459,7 +460,7 @@ class WebView(RestartingWebEngineView, OpenWithHandler):
|
||||
menu.addAction(actions['reload-preview'])
|
||||
menu.addAction(QIcon(I('debug.png')), _('Inspect element'), self.inspect)
|
||||
if url.partition(':')[0].lower() in {'http', 'https'}:
|
||||
menu.addAction(_('Open link'), partial(open_url, data.linkUrl()))
|
||||
menu.addAction(_('Open link'), partial(safe_open_url, data.linkUrl()))
|
||||
if data.MediaTypeImage <= data.mediaType() <= data.MediaTypeFile:
|
||||
url = data.mediaUrl()
|
||||
if url.scheme() == FAKE_PROTOCOL:
|
||||
|
Loading…
x
Reference in New Issue
Block a user