Merge pull request #1385 from davvid/bindir
[git-cola.git] / qtpy / QtWebEngineWidgets.py
bloba39885f3438d3789b635e92b079a91767ffa0512
1 # -----------------------------------------------------------------------------
2 # Copyright © 2014-2015 Colin Duquesnoy
3 # Copyright © 2009- The Spyder development Team
5 # Licensed under the terms of the MIT License
6 # (see LICENSE.txt for details)
7 # -----------------------------------------------------------------------------
9 """Provides QtWebEngineWidgets classes and functions."""
11 from . import (
12 PYQT5,
13 PYQT6,
14 PYSIDE2,
15 PYSIDE6,
16 QtModuleNotInstalledError,
19 # To test if we are using WebEngine or WebKit
20 # NOTE: This constant is imported by other projects (e.g. Spyder), so please
21 # don't remove it.
22 WEBENGINE = True
25 if PYQT5:
26 try:
27 # Based on the work at https://github.com/spyder-ide/qtpy/pull/203
28 from PyQt5.QtWebEngineWidgets import (
29 QWebEnginePage,
30 QWebEngineProfile,
31 QWebEngineScript,
32 QWebEngineSettings,
33 QWebEngineView,
35 except ModuleNotFoundError as error:
36 raise QtModuleNotInstalledError(
37 name="QtWebEngineWidgets",
38 missing_package="PyQtWebEngine",
39 ) from error
40 elif PYQT6:
41 try:
42 from PyQt6.QtWebEngineCore import (
43 QWebEnginePage,
44 QWebEngineProfile,
45 QWebEngineScript,
46 QWebEngineSettings,
48 from PyQt6.QtWebEngineWidgets import *
49 except ModuleNotFoundError as error:
50 raise QtModuleNotInstalledError(
51 name="QtWebEngineWidgets",
52 missing_package="PyQt6-WebEngine",
53 ) from error
54 elif PYSIDE2:
55 # Based on the work at https://github.com/spyder-ide/qtpy/pull/203
56 from PySide2.QtWebEngineWidgets import (
57 QWebEnginePage,
58 QWebEngineProfile,
59 QWebEngineScript,
60 QWebEngineSettings,
61 QWebEngineView,
63 elif PYSIDE6:
64 from PySide6.QtWebEngineCore import (
65 QWebEnginePage,
66 QWebEngineProfile,
67 QWebEngineScript,
68 QWebEngineSettings,
70 from PySide6.QtWebEngineWidgets import *