You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
1.9 KiB

4 years ago
  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. try:
  26. from PySide2.QtWebEngineWidgets import QWebEnginePage
  27. from PySide2.QtWebEngineWidgets import QWebEngineView
  28. # Current PySide2 wheels seem to be missing this.
  29. # from PySide2.QtWebEngineWidgets import QWebEngineSettings
  30. except ImportError:
  31. from PySide2.QtWebKitWidgets import QWebPage as QWebEnginePage
  32. from PySide2.QtWebKitWidgets import QWebView as QWebEngineView
  33. # Current PySide2 wheels seem to be missing this.
  34. # from PySide2.QtWebKit import QWebSettings as QWebEngineSettings
  35. WEBENGINE = False
  36. elif PYQT4:
  37. from PyQt4.QtWebKit import QWebPage as QWebEnginePage
  38. from PyQt4.QtWebKit import QWebView as QWebEngineView
  39. from PyQt4.QtWebKit import QWebSettings as QWebEngineSettings
  40. WEBENGINE = False
  41. elif PYSIDE:
  42. from PySide.QtWebKit import QWebPage as QWebEnginePage
  43. from PySide.QtWebKit import QWebView as QWebEngineView
  44. from PySide.QtWebKit import QWebSettings as QWebEngineSettings
  45. WEBENGINE = False
  46. else:
  47. raise PythonQtError('No Qt bindings could be found')