Add workaround for black screen with QtWebEngine

Fixes #2441
This commit is contained in:
Florian Bruhin 2017-03-14 08:51:39 +01:00
parent 3a88b70eca
commit 0877092cea
2 changed files with 20 additions and 1 deletions

View File

@ -28,6 +28,12 @@ Changed
- When using QtWebEngine, the underlying Chromium version is now shown in the
version info.
Fixed
~~~~~
- Added a workaround for a black screen with QtWebEngine with some setups
(requires PyOpenGL to be installed)
v0.10.1
-------

View File

@ -25,6 +25,7 @@ Module attributes:
"""
import os
import logging
# pylint: disable=no-name-in-module,import-error,useless-suppression
from PyQt5.QtWebEngineWidgets import (QWebEngineSettings, QWebEngineProfile,
@ -33,7 +34,7 @@ from PyQt5.QtWebEngineWidgets import (QWebEngineSettings, QWebEngineProfile,
from qutebrowser.browser import shared
from qutebrowser.config import config, websettings
from qutebrowser.utils import objreg, utils, standarddir, javascript
from qutebrowser.utils import objreg, utils, standarddir, javascript, log
class Attribute(websettings.Attribute):
@ -159,6 +160,18 @@ def init(args):
if args.enable_webengine_inspector:
os.environ['QTWEBENGINE_REMOTE_DEBUGGING'] = str(utils.random_port())
# Workaround for a black screen with some setups
# https://github.com/spyder-ide/spyder/issues/3226
if not os.environ.get('QUTE_NO_OPENGL_WORKAROUND'):
# Hide "No OpenGL_accelerate module loaded: ..." message
logging.getLogger('OpenGL.acceleratesupport').propagate = False
try:
from OpenGL import GL
except ImportError:
pass
else:
log.misc.debug("Imported PyOpenGL as workaround")
profile = QWebEngineProfile.defaultProfile()
_init_profile(profile)
_init_stylesheet(profile)