Move _on_proxy_authentication_required to WebEngineTab
This commit is contained in:
parent
e2e9bbacce
commit
78bddaefe6
@ -20,7 +20,6 @@
|
||||
"""The main browser widget for QtWebEngine."""
|
||||
|
||||
import functools
|
||||
import html
|
||||
|
||||
from PyQt5.QtCore import pyqtSignal, pyqtSlot, QUrl, PYQT_VERSION
|
||||
from PyQt5.QtGui import QPalette
|
||||
@ -134,8 +133,6 @@ class WebEnginePage(QWebEnginePage):
|
||||
self._is_shutting_down = False
|
||||
self.featurePermissionRequested.connect(
|
||||
self._on_feature_permission_requested)
|
||||
self.proxyAuthenticationRequired.connect(
|
||||
self._on_proxy_authentication_required)
|
||||
self._theme_color = theme_color
|
||||
self._set_bg_color()
|
||||
objreg.get('config').changed.connect(self._set_bg_color)
|
||||
@ -147,20 +144,6 @@ class WebEnginePage(QWebEnginePage):
|
||||
col = self._theme_color
|
||||
self.setBackgroundColor(col)
|
||||
|
||||
@pyqtSlot(QUrl, 'QAuthenticator*', 'QString')
|
||||
def _on_proxy_authentication_required(self, _url, authenticator,
|
||||
proxy_host):
|
||||
"""Called when a proxy needs authentication."""
|
||||
msg = "<b>{}</b> requires a username and password.".format(
|
||||
html.escape(proxy_host))
|
||||
answer = message.ask(
|
||||
title="Proxy authentication required", text=msg,
|
||||
mode=usertypes.PromptMode.user_pwd,
|
||||
abort_on=[self.loadStarted, self.shutting_down])
|
||||
if answer is not None:
|
||||
authenticator.setUser(answer.user)
|
||||
authenticator.setPassword(answer.password)
|
||||
|
||||
@pyqtSlot(QUrl, 'QWebEnginePage::Feature')
|
||||
def _on_feature_permission_requested(self, url, feature):
|
||||
"""Ask the user for approval for geolocation/media/etc.."""
|
||||
|
Loading…
Reference in New Issue
Block a user