Fix javaScriptPrompt override for newer PyQt versions
This commit is contained in:
parent
62d258190f
commit
013c2691d5
@ -22,7 +22,7 @@
|
|||||||
import os
|
import os
|
||||||
import functools
|
import functools
|
||||||
|
|
||||||
from PyQt5.QtCore import pyqtSignal, pyqtSlot, QUrl
|
from PyQt5.QtCore import pyqtSignal, pyqtSlot, QUrl, PYQT_VERSION
|
||||||
# pylint: disable=no-name-in-module,import-error,useless-suppression
|
# pylint: disable=no-name-in-module,import-error,useless-suppression
|
||||||
from PyQt5.QtWebEngineWidgets import QWebEngineView, QWebEnginePage
|
from PyQt5.QtWebEngineWidgets import QWebEngineView, QWebEnginePage
|
||||||
# pylint: enable=no-name-in-module,import-error,useless-suppression
|
# pylint: enable=no-name-in-module,import-error,useless-suppression
|
||||||
@ -228,17 +228,19 @@ class WebEnginePage(QWebEnginePage):
|
|||||||
except shared.CallSuper:
|
except shared.CallSuper:
|
||||||
return super().javaScriptConfirm(url, js_msg)
|
return super().javaScriptConfirm(url, js_msg)
|
||||||
|
|
||||||
# Can't override javaScriptPrompt currently
|
if PYQT_VERSION > 0x050700:
|
||||||
# https://www.riverbankcomputing.com/pipermail/pyqt/2016-November/038293.html
|
# WORKAROUND
|
||||||
# def javaScriptPrompt(self, url, js_msg, default, result):
|
# Can't override javaScriptPrompt with older PyQt versions
|
||||||
# if self._is_shutting_down:
|
# https://www.riverbankcomputing.com/pipermail/pyqt/2016-November/038293.html
|
||||||
# return (False, "")
|
def javaScriptPrompt(self, url, js_msg, default, result):
|
||||||
# try:
|
if self._is_shutting_down:
|
||||||
# return shared.javascript_prompt(url, js_msg, default,
|
return (False, "")
|
||||||
# abort_on=[self.loadStarted,
|
try:
|
||||||
# self.shutting_down])
|
return shared.javascript_prompt(url, js_msg, default,
|
||||||
# except shared.CallSuper:
|
abort_on=[self.loadStarted,
|
||||||
# return super().javaScriptPrompt(url, js_msg, default)
|
self.shutting_down])
|
||||||
|
except shared.CallSuper:
|
||||||
|
return super().javaScriptPrompt(url, js_msg, default)
|
||||||
|
|
||||||
def javaScriptAlert(self, url, js_msg):
|
def javaScriptAlert(self, url, js_msg):
|
||||||
"""Override javaScriptAlert to use qutebrowser prompts."""
|
"""Override javaScriptAlert to use qutebrowser prompts."""
|
||||||
|
Loading…
Reference in New Issue
Block a user