Skip to content

Commit

Permalink
Fix importing QtWebEngine after toolkit selection (#853)
Browse files Browse the repository at this point in the history
* Import QtWebKit before creating QApplication

* Update optional dependencies for PyQt5

* Revert change to extras_require

* Add reference to the issue
  • Loading branch information
kitchoi authored Jan 19, 2021
1 parent 9419755 commit 8cc824e
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions pyface/ui/qt4/init.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,17 @@
_app = QtGui.QApplication.instance()

if _app is None:
try:
# pyface.qt.QtWebKit tries QtWebEngineWidgets first, but
# if QtWebEngineWidgets is present, it must be imported prior to
# creating a QCoreApplication instance, otherwise importing
# QtWebEngineWidgets later would fail (see enthought/pyface#581).
# Import it here first before creating the instance.
from pyface.qt import QtWebKit
except ImportError:
# This error will be raised in the context where
# QtWebKit/QtWebEngine widgets are required.
pass
_app = QtGui.QApplication(sys.argv)


Expand Down

0 comments on commit 8cc824e

Please sign in to comment.