mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Some more iteritems fixes
This commit is contained in:
parent
08dfee0766
commit
9c897eb926
@ -37,7 +37,7 @@ from calibre.gui2.webengine import (
|
||||
)
|
||||
from calibre.gui2.widgets2 import HistoryLineEdit2
|
||||
from calibre.utils.ipc.simple_worker import offload_worker
|
||||
from polyglot.builtins import unicode_type
|
||||
from polyglot.builtins import iteritems, unicode_type
|
||||
from polyglot.queue import Empty, Queue
|
||||
from polyglot.urllib import urlparse
|
||||
|
||||
@ -206,7 +206,7 @@ class UrlSchemeHandler(QWebEngineUrlSchemeHandler):
|
||||
|
||||
def check_for_parse(self):
|
||||
remove = []
|
||||
for name, requests in self.requests.iteritems():
|
||||
for name, requests in iteritems(self.requests):
|
||||
data = parse_worker.get_data(name)
|
||||
if data is not None:
|
||||
if not isinstance(data, bytes):
|
||||
|
@ -25,6 +25,7 @@ from calibre.gui2.webengine import (
|
||||
secure_webengine, to_js
|
||||
)
|
||||
from calibre.utils.config import JSONConfig
|
||||
from polyglot.builtins import iteritems
|
||||
|
||||
try:
|
||||
from PyQt5 import sip
|
||||
@ -301,7 +302,7 @@ class WebView(RestartingWebEngineView):
|
||||
return self._page.bridge
|
||||
|
||||
def on_bridge_ready(self):
|
||||
for func, args in self.pending_bridge_ready_actions.iteritems():
|
||||
for func, args in iteritems(self.pending_bridge_ready_actions):
|
||||
getattr(self.bridge, func)(*args)
|
||||
|
||||
def start_book_load(self):
|
||||
|
@ -12,6 +12,7 @@ from PyQt5.QtWebEngineWidgets import QWebEnginePage, QWebEngineScript, QWebEngin
|
||||
from calibre import prints
|
||||
from calibre.utils.monotonic import monotonic
|
||||
from calibre.utils.rapydscript import special_title
|
||||
from polyglot.builtins import iteritems
|
||||
|
||||
|
||||
def secure_webengine(view_or_page_or_settings, for_viewer=False):
|
||||
@ -77,10 +78,10 @@ class Bridge(QObject):
|
||||
|
||||
def __init__(self, page):
|
||||
QObject.__init__(self, page)
|
||||
self._signals = json.dumps(tuple({k for k, v in self.__class__.__dict__.iteritems() if isinstance(v, pyqtSignal)}))
|
||||
self._signals = json.dumps(tuple({k for k, v in iteritems(self.__class__.__dict__) if isinstance(v, pyqtSignal)}))
|
||||
self._signals_registered = False
|
||||
page.titleChanged.connect(self._title_changed)
|
||||
for k, v in self.__class__.__dict__.iteritems():
|
||||
for k, v in iteritems(self.__class__.__dict__):
|
||||
if isinstance(v, to_js):
|
||||
v.name = k
|
||||
|
||||
@ -98,7 +99,7 @@ class Bridge(QObject):
|
||||
|
||||
def _register_signals(self):
|
||||
self._signals_registered = True
|
||||
for k, v in self.__class__.__dict__.iteritems():
|
||||
for k, v in iteritems(self.__class__.__dict__):
|
||||
if isinstance(v, to_js):
|
||||
setattr(self, k, to_js_bound(self, k))
|
||||
self.page.runJavaScript('python_comm._register_signals(' + self._signals + ')', QWebEngineScript.ApplicationWorld)
|
||||
|
Loading…
x
Reference in New Issue
Block a user