QtWebEngineWidgets.py 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. # -*- coding: utf-8 -*-
  2. #
  3. # Copyright © 2014-2015 Colin Duquesnoy
  4. # Copyright © 2009- The Spyder development Team
  5. #
  6. # Licensed under the terms of the MIT License
  7. # (see LICENSE.txt for details)
  8. """
  9. Provides QtWebEngineWidgets classes and functions.
  10. """
  11. from . import PYQT5,PYSIDE2, PYQT4, PYSIDE, PythonQtError
  12. # To test if we are using WebEngine or WebKit
  13. WEBENGINE = True
  14. if PYQT5:
  15. try:
  16. from PyQt5.QtWebEngineWidgets import QWebEnginePage
  17. from PyQt5.QtWebEngineWidgets import QWebEngineView
  18. from PyQt5.QtWebEngineWidgets import QWebEngineSettings
  19. except ImportError:
  20. from PyQt5.QtWebKitWidgets import QWebPage as QWebEnginePage
  21. from PyQt5.QtWebKitWidgets import QWebView as QWebEngineView
  22. from PyQt5.QtWebKit import QWebSettings as QWebEngineSettings
  23. WEBENGINE = False
  24. elif PYSIDE2:
  25. from PySide2.QtWebEngineWidgets import QWebEnginePage
  26. from PySide2.QtWebEngineWidgets import QWebEngineView
  27. from PySide2.QtWebEngineWidgets import QWebEngineSettings
  28. elif PYQT4:
  29. from PyQt4.QtWebKit import QWebPage as QWebEnginePage
  30. from PyQt4.QtWebKit import QWebView as QWebEngineView
  31. from PyQt4.QtWebKit import QWebSettings as QWebEngineSettings
  32. WEBENGINE = False
  33. elif PYSIDE:
  34. from PySide.QtWebKit import QWebPage as QWebEnginePage
  35. from PySide.QtWebKit import QWebView as QWebEngineView
  36. from PySide.QtWebKit import QWebSettings as QWebEngineSettings
  37. WEBENGINE = False
  38. else:
  39. raise PythonQtError('No Qt bindings could be found')