Add debug logging to createWindow

This commit is contained in:
Florian Bruhin 2016-09-02 16:27:28 +02:00
parent 2687b59373
commit 8b7d21876f
2 changed files with 10 additions and 9 deletions

View File

@ -63,21 +63,20 @@ class WebEngineView(QWebEngineView):
Return:
The new QWebEngineView object.
"""
debug_type = debug.qenum_key(QWebEnginePage, wintype)
log.webview.debug("createWindow with type {}".format(debug_type))
background = False
if wintype == QWebEnginePage.WebBrowserWindow:
log.webview.warning("WebBrowserWindow requested, but we don't "
"support that!")
if wintype in [QWebEnginePage.WebBrowserWindow,
QWebEnginePage.WebDialog]:
log.webview.warning("{} requested, but we don't support that!".format(
debug_type))
elif wintype == QWebEnginePage.WebBrowserTab:
pass
elif wintype == QWebEnginePage.WebDialog:
log.webview.warning("WebDialog requested, but we don't support "
"that!")
elif (hasattr(QWebEnginePage, 'WebBrowserBackgroundTab') and
wintype == QWebEnginePage.WebBrowserBackgroundTab):
background = True
else:
raise ValueError("Invalid wintype {}".format(debug.qenum_key(
QWebEnginePage, wintype)))
raise ValueError("Invalid wintype {}".format(debug_type))
tabbed_browser = objreg.get('tabbed-browser', scope='window',
window=self._win_id)

View File

@ -29,7 +29,7 @@ from PyQt5.QtWebKitWidgets import QWebView, QWebPage, QWebFrame
from qutebrowser.config import config
from qutebrowser.keyinput import modeman
from qutebrowser.utils import log, usertypes, utils, qtutils, objreg
from qutebrowser.utils import log, usertypes, utils, qtutils, objreg, debug
from qutebrowser.browser.webkit import webpage, webkitelem
@ -218,6 +218,8 @@ class WebView(QWebView):
Return:
The new QWebView object.
"""
debug_type = debug.qenum_key(QWebPage, wintype)
log.webview.debug("createWindow with type {}".format(debug_type))
if wintype == QWebPage.WebModalDialog:
log.webview.warning("WebModalDialog requested, but we don't "
"support that!")