Merge pull request #1237 from scop/fix/editor-fallback
[git-cola.git] / qtpy / QtWebEngineWidgets.py
blob33a66575c5081e6d577a65a2c5af0d2a5264247a
1 # -*- coding: utf-8 -*-
3 # Copyright © 2014-2015 Colin Duquesnoy
4 # Copyright © 2009- The Spyder development Team
6 # Licensed under the terms of the MIT License
7 # (see LICENSE.txt for details)
9 """
10 Provides QtWebEngineWidgets classes and functions.
11 """
13 from . import PYQT5,PYSIDE2, PYQT4, PYSIDE, PythonQtError
16 # To test if we are using WebEngine or WebKit
17 WEBENGINE = True
20 if PYQT5:
21 try:
22 from PyQt5.QtWebEngineWidgets import QWebEnginePage
23 from PyQt5.QtWebEngineWidgets import QWebEngineView
24 from PyQt5.QtWebEngineWidgets import QWebEngineSettings
25 # Based on the work at https://github.com/spyder-ide/qtpy/pull/203
26 from PyQt5.QtWebEngineWidgets import QWebEngineProfile
27 except ImportError:
28 from PyQt5.QtWebKitWidgets import QWebPage as QWebEnginePage
29 from PyQt5.QtWebKitWidgets import QWebView as QWebEngineView
30 from PyQt5.QtWebKit import QWebSettings as QWebEngineSettings
31 WEBENGINE = False
32 elif PYSIDE2:
33 from PySide2.QtWebEngineWidgets import QWebEnginePage
34 from PySide2.QtWebEngineWidgets import QWebEngineView
35 from PySide2.QtWebEngineWidgets import QWebEngineSettings
36 # Based on the work at https://github.com/spyder-ide/qtpy/pull/203
37 from PySide2.QtWebEngineWidgets import QWebEngineProfile
38 elif PYQT4:
39 from PyQt4.QtWebKit import QWebPage as QWebEnginePage
40 from PyQt4.QtWebKit import QWebView as QWebEngineView
41 from PyQt4.QtWebKit import QWebSettings as QWebEngineSettings
42 WEBENGINE = False
43 elif PYSIDE:
44 from PySide.QtWebKit import QWebPage as QWebEnginePage
45 from PySide.QtWebKit import QWebView as QWebEngineView
46 from PySide.QtWebKit import QWebSettings as QWebEngineSettings
47 WEBENGINE = False
48 else:
49 raise PythonQtError('No Qt bindings could be found')