mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Register the clbr: fake network scheme with web engine
This commit is contained in:
parent
289c42b87f
commit
08dfee0766
@ -8,8 +8,9 @@ import sys
|
||||
import time
|
||||
|
||||
from PyQt5.Qt import QIcon
|
||||
from PyQt5.QtWebEngineCore import QWebEngineUrlScheme
|
||||
|
||||
from calibre.constants import EDITOR_APP_UID, islinux
|
||||
from calibre.constants import EDITOR_APP_UID, FAKE_PROTOCOL, islinux
|
||||
from calibre.gui2 import (
|
||||
Application, decouple, set_gui_prefs, setup_gui_option_parser
|
||||
)
|
||||
@ -52,6 +53,10 @@ def _run(args, notify=None):
|
||||
# Ensure we can continue to function if GUI is closed
|
||||
os.environ.pop('CALIBRE_WORKER_TEMP_DIR', None)
|
||||
reset_base_dir()
|
||||
scheme = QWebEngineUrlScheme(FAKE_PROTOCOL.encode('ascii'))
|
||||
scheme.setSyntax(QWebEngineUrlScheme.Syntax.Host)
|
||||
scheme.setFlags(QWebEngineUrlScheme.SecureScheme)
|
||||
QWebEngineUrlScheme.registerScheme(scheme)
|
||||
|
||||
# The following two lines are needed to prevent circular imports causing
|
||||
# errors during initialization of plugins that use the polish container
|
||||
|
@ -11,9 +11,10 @@ import sys
|
||||
from threading import Thread
|
||||
|
||||
from PyQt5.Qt import QIcon, QObject, Qt, QTimer, pyqtSignal
|
||||
from PyQt5.QtWebEngineCore import QWebEngineUrlScheme
|
||||
|
||||
from calibre import as_unicode, prints
|
||||
from calibre.constants import VIEWER_APP_UID, islinux, iswindows
|
||||
from calibre.constants import FAKE_PROTOCOL, VIEWER_APP_UID, islinux, iswindows
|
||||
from calibre.gui2 import (
|
||||
Application, error_dialog, set_app_uid, setup_gui_option_parser
|
||||
)
|
||||
@ -125,6 +126,10 @@ def main(args=sys.argv):
|
||||
# Ensure viewer can continue to function if GUI is closed
|
||||
os.environ.pop('CALIBRE_WORKER_TEMP_DIR', None)
|
||||
reset_base_dir()
|
||||
scheme = QWebEngineUrlScheme(FAKE_PROTOCOL.encode('ascii'))
|
||||
scheme.setSyntax(QWebEngineUrlScheme.Syntax.Host)
|
||||
scheme.setFlags(QWebEngineUrlScheme.SecureScheme)
|
||||
QWebEngineUrlScheme.registerScheme(scheme)
|
||||
if iswindows:
|
||||
# Ensure that all ebook viewer instances are grouped together in the task
|
||||
# bar. This prevents them from being grouped with the editor process when
|
||||
|
@ -6,8 +6,8 @@ from __future__ import absolute_import, division, print_function, unicode_litera
|
||||
|
||||
import json
|
||||
|
||||
from PyQt5.Qt import QObject, Qt, QWebEnginePage, pyqtSignal
|
||||
from PyQt5.QtWebEngineWidgets import QWebEngineScript, QWebEngineView
|
||||
from PyQt5.Qt import QObject, Qt, pyqtSignal
|
||||
from PyQt5.QtWebEngineWidgets import QWebEnginePage, QWebEngineScript, QWebEngineView
|
||||
|
||||
from calibre import prints
|
||||
from calibre.utils.monotonic import monotonic
|
||||
|
Loading…
x
Reference in New Issue
Block a user