From 6ac47205730ca8d536dd39d06bbdec1bc6fa2d89 Mon Sep 17 00:00:00 2001 From: Julien Schueller Date: Sat, 16 Oct 2021 00:21:12 +0200 Subject: [PATCH 1/2] More modules --- qtpy/Qt3DCore.py | 6 +++++- qtpy/Qt3DExtras.py | 6 +++++- qtpy/Qt3DInput.py | 6 +++++- qtpy/Qt3DLogic.py | 6 +++++- qtpy/Qt3DRender.py | 6 +++++- qtpy/QtCharts.py | 6 +++++- qtpy/QtDBus.py | 19 +++++++++++++++++++ qtpy/QtDesigner.py | 6 +++++- qtpy/QtHelp.py | 6 +++++- qtpy/QtMultimedia.py | 6 +++++- qtpy/QtMultimediaWidgets.py | 6 +++++- qtpy/QtNetwork.py | 4 +++- qtpy/QtNetworkAuth.py | 19 +++++++++++++++++++ qtpy/QtOpenGL.py | 2 ++ qtpy/QtOpenGLWidgets.py | 17 +++++++++++++++++ qtpy/QtPrintSupport.py | 4 +++- qtpy/QtQml.py | 4 +++- qtpy/QtQuick.py | 4 +++- qtpy/QtQuickWidgets.py | 4 +++- qtpy/QtRemoteObjects.py | 21 +++++++++++++++++++++ qtpy/QtSensors.py | 21 +++++++++++++++++++++ qtpy/QtSerialPort.py | 8 +++++++- qtpy/QtSql.py | 4 +++- qtpy/QtWebChannel.py | 4 +++- qtpy/QtWebEngineCore.py | 21 +++++++++++++++++++++ qtpy/QtWebEngineQuick.py | 17 +++++++++++++++++ qtpy/QtWebEngineWidgets.py | 7 ++++++- qtpy/QtWebSockets.py | 4 +++- qtpy/QtXml.py | 21 +++++++++++++++++++++ qtpy/tests/test_patch_qheaderview.py | 4 ++-- qtpy/tests/test_qt3dcore.py | 4 ++-- qtpy/tests/test_qt3dextras.py | 2 -- qtpy/tests/test_qt3dinput.py | 2 -- qtpy/tests/test_qt3dlogic.py | 2 -- qtpy/tests/test_qt3drender.py | 4 ++-- qtpy/tests/test_qtcharts.py | 4 ++-- qtpy/tests/test_qtcore.py | 4 ++-- qtpy/tests/test_qtdatavisualization.py | 3 --- qtpy/tests/test_qtdbus.py | 12 ++++++++++++ qtpy/tests/test_qtdesigner.py | 4 ++-- qtpy/tests/test_qtmultimedia.py | 6 +++--- qtpy/tests/test_qtnetwork.py | 4 ++-- qtpy/tests/test_qtnetworkauth.py | 13 +++++++++++++ qtpy/tests/test_qtopenglwidgets.py | 9 +++++++++ qtpy/tests/test_qtremoteobjects.py | 13 +++++++++++++ qtpy/tests/test_qtsensors.py | 11 +++++++++++ qtpy/tests/test_qtserialport.py | 4 ++-- qtpy/tests/test_qtsvg.py | 4 ++-- qtpy/tests/test_qtwebenginecore.py | 9 +++++++++ qtpy/tests/test_qtwebenginequick.py | 10 ++++++++++ qtpy/tests/test_qtwebenginewidgets.py | 6 +++--- qtpy/tests/test_qtxml.py | 23 +++++++++++++++++++++++ qtpy/tests/test_qtxmlpatterns.py | 4 ++-- 53 files changed, 371 insertions(+), 55 deletions(-) create mode 100644 qtpy/QtDBus.py create mode 100644 qtpy/QtNetworkAuth.py create mode 100644 qtpy/QtOpenGLWidgets.py create mode 100644 qtpy/QtRemoteObjects.py create mode 100644 qtpy/QtSensors.py create mode 100644 qtpy/QtWebEngineCore.py create mode 100644 qtpy/QtWebEngineQuick.py create mode 100644 qtpy/QtXml.py create mode 100644 qtpy/tests/test_qtdbus.py create mode 100644 qtpy/tests/test_qtnetworkauth.py create mode 100644 qtpy/tests/test_qtopenglwidgets.py create mode 100644 qtpy/tests/test_qtremoteobjects.py create mode 100644 qtpy/tests/test_qtsensors.py create mode 100644 qtpy/tests/test_qtwebenginecore.py create mode 100644 qtpy/tests/test_qtwebenginequick.py create mode 100644 qtpy/tests/test_qtxml.py diff --git a/qtpy/Qt3DCore.py b/qtpy/Qt3DCore.py index cb9cc85c..57f1ef1c 100644 --- a/qtpy/Qt3DCore.py +++ b/qtpy/Qt3DCore.py @@ -7,10 +7,14 @@ """Provides Qt3DCore classes and functions.""" # Local imports -from . import PYQT5, PYSIDE2, PythonQtError +from . import PYQT5, PYQT6, PYSIDE2, PYSIDE6, PythonQtError if PYQT5: from PyQt5.Qt3DCore import * +elif PYQT6: + from PyQt6.Qt3DCore import * +elif PYSIDE6: + from PySide6.Qt3DCore.Qt3DCore import * elif PYSIDE2: # https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-1026 import PySide2.Qt3DCore as __temp diff --git a/qtpy/Qt3DExtras.py b/qtpy/Qt3DExtras.py index 86b2635a..4397caa1 100644 --- a/qtpy/Qt3DExtras.py +++ b/qtpy/Qt3DExtras.py @@ -7,10 +7,14 @@ """Provides Qt3DExtras classes and functions.""" # Local imports -from . import PYQT5, PYSIDE2, PythonQtError +from . import PYQT5, PYQT6, PYSIDE2, PYSIDE6, PythonQtError if PYQT5: from PyQt5.Qt3DExtras import * +elif PYQT6: + from PyQt6.Qt3DExtras import * +elif PYSIDE6: + from PySide6.Qt3DExtras.Qt3DExtras import * elif PYSIDE2: # https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-1026 import PySide2.Qt3DExtras as __temp diff --git a/qtpy/Qt3DInput.py b/qtpy/Qt3DInput.py index 27a4ff77..45ebf2ac 100644 --- a/qtpy/Qt3DInput.py +++ b/qtpy/Qt3DInput.py @@ -7,10 +7,14 @@ """Provides Qt3DInput classes and functions.""" # Local imports -from . import PYQT5, PYSIDE2, PythonQtError +from . import PYQT5, PYQT6, PYSIDE2, PYSIDE6, PythonQtError if PYQT5: from PyQt5.Qt3DInput import * +elif PYQT6: + from PyQt6.Qt3DInput import * +elif PYSIDE6: + from PySide6.Qt3DInput.Qt3DInput import * elif PYSIDE2: # https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-1026 import PySide2.Qt3DInput as __temp diff --git a/qtpy/Qt3DLogic.py b/qtpy/Qt3DLogic.py index e1187da3..2a71d0af 100644 --- a/qtpy/Qt3DLogic.py +++ b/qtpy/Qt3DLogic.py @@ -7,10 +7,14 @@ """Provides Qt3DLogic classes and functions.""" # Local imports -from . import PYQT5, PYSIDE2, PythonQtError +from . import PYQT5, PYQT6, PYSIDE2, PYSIDE6, PythonQtError if PYQT5: from PyQt5.Qt3DLogic import * +elif PYQT6: + from PyQt6.Qt3DLogic import * +elif PYSIDE6: + from PySide6.Qt3DLogic.Qt3DLogic import * elif PYSIDE2: # https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-1026 import PySide2.Qt3DLogic as __temp diff --git a/qtpy/Qt3DRender.py b/qtpy/Qt3DRender.py index 27610e84..4e9ada31 100644 --- a/qtpy/Qt3DRender.py +++ b/qtpy/Qt3DRender.py @@ -7,10 +7,14 @@ """Provides Qt3DRender classes and functions.""" # Local imports -from . import PYQT5, PYSIDE2, PythonQtError +from . import PYQT5, PYQT6, PYSIDE2, PYSIDE6, PythonQtError if PYQT5: from PyQt5.Qt3DRender import * +elif PYSIDE6: + from PySide6.Qt3DRender.Qt3DRender import * +elif PYQT6: + from PyQt6.Qt3DRender import * elif PYSIDE2: # https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-1026 import PySide2.Qt3DRender as __temp diff --git a/qtpy/QtCharts.py b/qtpy/QtCharts.py index af309b13..5b897172 100644 --- a/qtpy/QtCharts.py +++ b/qtpy/QtCharts.py @@ -7,7 +7,7 @@ """Provides QtChart classes and functions.""" # Local imports -from . import PYQT5, PYSIDE2, PythonQtError +from . import PYQT5, PYQT6, PYSIDE2, PYSIDE6, PythonQtError if PYQT5: try: @@ -15,6 +15,10 @@ except ImportError: raise PythonQtError('The QtChart module was not found. ' 'It needs to be installed separately for PyQt5.') +elif PYQT6: + from PyQt6 import QtCharts +elif PYSIDE6: + from PySide6 import QtCharts elif PYSIDE2: from PySide2.QtCharts import * else: diff --git a/qtpy/QtDBus.py b/qtpy/QtDBus.py new file mode 100644 index 00000000..9499a9f7 --- /dev/null +++ b/qtpy/QtDBus.py @@ -0,0 +1,19 @@ +# ----------------------------------------------------------------------------- +# Copyright © 2009- The Spyder Development Team +# +# Licensed under the terms of the MIT License +# (see LICENSE.txt for details) +# ----------------------------------------------------------------------------- +"""Provides QtDBus classes and functions.""" + +# Local imports +from . import PYQT5, PYQT6, PYSIDE2, PYSIDE6, PythonQtError + +if PYQT5: + from PyQt5.QtDBus import * +elif PYQT6: + from PyQt6.QtDBus import * +elif PYSIDE6: + from PySide6.QtDBus import * +else: + raise PythonQtError('No Qt bindings could be found') diff --git a/qtpy/QtDesigner.py b/qtpy/QtDesigner.py index a906f5ab..2b086bbe 100644 --- a/qtpy/QtDesigner.py +++ b/qtpy/QtDesigner.py @@ -8,10 +8,14 @@ Provides QtDesigner classes and functions. """ -from . import PYQT5, PythonQtError +from . import PYQT5, PYQT6, PYSIDE6, PythonQtError if PYQT5: from PyQt5.QtDesigner import * +elif PYQT6: + from PyQt6.QtDesigner import * +elif PYSIDE6: + from PySide6.QtDesigner import * else: raise PythonQtError('No Qt bindings could be found') diff --git a/qtpy/QtHelp.py b/qtpy/QtHelp.py index b53a40e6..2fcfdcc9 100644 --- a/qtpy/QtHelp.py +++ b/qtpy/QtHelp.py @@ -8,11 +8,15 @@ import warnings -from . import PYQT5, PYSIDE6, PYSIDE2 +from . import PYQT5, PYQT6, PYSIDE6, PYSIDE2, PythonQtError if PYQT5: from PyQt5.QtHelp import * +elif PYQT6: + from PyQt6.QtHelp import * elif PYSIDE6: from PySide6.QtHelp import * elif PYSIDE2: from PySide2.QtHelp import * +else: + raise PythonQtError('No Qt bindings could be found') diff --git a/qtpy/QtMultimedia.py b/qtpy/QtMultimedia.py index 88cbdf10..683c3bb1 100644 --- a/qtpy/QtMultimedia.py +++ b/qtpy/QtMultimedia.py @@ -1,12 +1,16 @@ import warnings -from . import PYQT5 +from . import PYQT5, PYQT6 from . import PYSIDE2 from . import PYSIDE6 if PYQT5: from PyQt5.QtMultimedia import * +elif PYQT6: + from PyQt6.QtMultimedia import * elif PYSIDE6: from PySide6.QtMultimedia import * elif PYSIDE2: from PySide2.QtMultimedia import * +else: + raise PythonQtError('No Qt bindings could be found') diff --git a/qtpy/QtMultimediaWidgets.py b/qtpy/QtMultimediaWidgets.py index 328e166f..ee8db677 100644 --- a/qtpy/QtMultimediaWidgets.py +++ b/qtpy/QtMultimediaWidgets.py @@ -7,11 +7,15 @@ """Provides QtMultimediaWidgets classes and functions.""" # Local imports -from . import PYSIDE2, PYQT5, PythonQtError +from . import PYSIDE2, PYSIDE6, PYQT5, PYQT6, PythonQtError if PYQT5: from PyQt5.QtMultimediaWidgets import * +elif PYQT6: + from PyQt6.QtMultimediaWidgets import * elif PYSIDE2: from PySide2.QtMultimediaWidgets import * +elif PYSIDE6: + from PySide6.QtMultimediaWidgets import * else: raise PythonQtError('No Qt bindings could be found') diff --git a/qtpy/QtNetwork.py b/qtpy/QtNetwork.py index e2507d64..b053fc41 100644 --- a/qtpy/QtNetwork.py +++ b/qtpy/QtNetwork.py @@ -9,11 +9,13 @@ Provides QtNetwork classes and functions. """ -from . import PYQT5, PYSIDE2, PYSIDE6, PythonQtError +from . import PYQT5, PYQT6, PYSIDE2, PYSIDE6, PythonQtError if PYQT5: from PyQt5.QtNetwork import * +elif PYQT6: + from PyQt6.QtNetwork import * elif PYSIDE6: from PySide6.QtNetwork import * elif PYSIDE2: diff --git a/qtpy/QtNetworkAuth.py b/qtpy/QtNetworkAuth.py new file mode 100644 index 00000000..1a377778 --- /dev/null +++ b/qtpy/QtNetworkAuth.py @@ -0,0 +1,19 @@ +# ----------------------------------------------------------------------------- +# Copyright © 2009- The Spyder Development Team +# +# Licensed under the terms of the MIT License +# (see LICENSE.txt for details) +# ----------------------------------------------------------------------------- +"""Provides QtNetworkAuth classes and functions.""" + +# Local imports +from . import PYQT5, PYQT6, PYSIDE2, PYSIDE6, PythonQtError + +if PYQT6: + from PyQt6.QtNetworkAuth import * +elif PYQT5: + from PyQt5.QtNetworkAuth import * +elif PYSIDE6: + from PySide6.QtNetworkAuth import * +else: + raise PythonQtError('No Qt bindings could be found') diff --git a/qtpy/QtOpenGL.py b/qtpy/QtOpenGL.py index fdcb5c71..458da27a 100644 --- a/qtpy/QtOpenGL.py +++ b/qtpy/QtOpenGL.py @@ -11,6 +11,8 @@ if PYQT5: from PyQt5.QtOpenGL import * +elif PYQT6: + from PyQt6.QtOpenGL import * elif PYSIDE6: from PySide6.QtOpenGL import * elif PYSIDE2: diff --git a/qtpy/QtOpenGLWidgets.py b/qtpy/QtOpenGLWidgets.py new file mode 100644 index 00000000..4df07110 --- /dev/null +++ b/qtpy/QtOpenGLWidgets.py @@ -0,0 +1,17 @@ +# ----------------------------------------------------------------------------- +# Copyright © 2009- The Spyder Development Team +# +# Licensed under the terms of the MIT License +# (see LICENSE.txt for details) +# ----------------------------------------------------------------------------- +"""Provides QtOpenGLWidgets classes and functions.""" + +# Local imports +from . import PYQT5, PYQT6, PYSIDE2, PYSIDE6, PythonQtError + +if PYQT6: + from PyQt6.QtOpenGLWidgets import * +elif PYSIDE6: + from PySide6.QtOpenGLWidgets import * +else: + raise PythonQtError('No Qt bindings could be found') diff --git a/qtpy/QtPrintSupport.py b/qtpy/QtPrintSupport.py index 4e512e71..4f1b6d25 100644 --- a/qtpy/QtPrintSupport.py +++ b/qtpy/QtPrintSupport.py @@ -8,11 +8,13 @@ Provides QtPrintSupport classes and functions. """ -from . import PYQT5, PYSIDE6, PYSIDE2, PythonQtError +from . import PYQT5, PYQT6, PYSIDE6, PYSIDE2, PythonQtError if PYQT5: from PyQt5.QtPrintSupport import * +elif PYQT6: + from PyQt6.QtPrintSupport import * elif PYSIDE6: from PySide6.QtPrintSupport import * elif PYSIDE2: diff --git a/qtpy/QtQml.py b/qtpy/QtQml.py index 213706e9..ec6934a7 100644 --- a/qtpy/QtQml.py +++ b/qtpy/QtQml.py @@ -7,10 +7,12 @@ """Provides QtQml classes and functions.""" # Local imports -from . import PYQT5, PYSIDE2, PYSIDE6, PythonQtError +from . import PYQT5, PYQT6, PYSIDE2, PYSIDE6, PythonQtError if PYQT5: from PyQt5.QtQml import * +elif PYQT6: + from PyQt6.QtQml import * elif PYSIDE6: from PySide6.QtQml import * elif PYSIDE2: diff --git a/qtpy/QtQuick.py b/qtpy/QtQuick.py index b0697da1..10f6a41c 100644 --- a/qtpy/QtQuick.py +++ b/qtpy/QtQuick.py @@ -7,10 +7,12 @@ """Provides QtQuick classes and functions.""" # Local imports -from . import PYQT5, PYSIDE6, PYSIDE2, PythonQtError +from . import PYQT5, PYQT6, PYSIDE6, PYSIDE2, PythonQtError if PYQT5: from PyQt5.QtQuick import * +elif PYQT6: + from PyQt6.QtQuick import * elif PYSIDE6: from PySide6.QtQuick import * elif PYSIDE2: diff --git a/qtpy/QtQuickWidgets.py b/qtpy/QtQuickWidgets.py index fb534cff..dfadb2c0 100644 --- a/qtpy/QtQuickWidgets.py +++ b/qtpy/QtQuickWidgets.py @@ -7,10 +7,12 @@ """Provides QtQuickWidgets classes and functions.""" # Local imports -from . import PYQT5, PYSIDE6, PYSIDE2, PythonQtError +from . import PYQT5, PYQT6, PYSIDE6, PYSIDE2, PythonQtError if PYQT5: from PyQt5.QtQuickWidgets import * +elif PYQT6: + from PyQt6.QtQuickWidgets import * elif PYSIDE6: from PySide6.QtQuickWidgets import * elif PYSIDE2: diff --git a/qtpy/QtRemoteObjects.py b/qtpy/QtRemoteObjects.py new file mode 100644 index 00000000..d1515c57 --- /dev/null +++ b/qtpy/QtRemoteObjects.py @@ -0,0 +1,21 @@ +# ----------------------------------------------------------------------------- +# Copyright © 2009- The Spyder Development Team +# +# Licensed under the terms of the MIT License +# (see LICENSE.txt for details) +# ----------------------------------------------------------------------------- +"""Provides QtRemoteObjects classes and functions.""" + +# Local imports +from . import PYQT5, PYQT6, PYSIDE2, PYSIDE6, PythonQtError + +if PYQT5: + from PyQt5.QtRemoteObjects import * +elif PYQT6: + from PyQt6.QtRemoteObjects import * +elif PYSIDE6: + from PySide6.QtRemoteObjects import * +elif PYSIDE2: + from PySide2.QtRemoteObjects import * +else: + raise PythonQtError('No Qt bindings could be found') diff --git a/qtpy/QtSensors.py b/qtpy/QtSensors.py new file mode 100644 index 00000000..96ac1b12 --- /dev/null +++ b/qtpy/QtSensors.py @@ -0,0 +1,21 @@ +# ----------------------------------------------------------------------------- +# Copyright © 2009- The Spyder Development Team +# +# Licensed under the terms of the MIT License +# (see LICENSE.txt for details) +# ----------------------------------------------------------------------------- +"""Provides QtSensors classes and functions.""" + +# Local imports +from . import PYQT5, PYQT6, PYSIDE2, PYSIDE6, PythonQtError + +if PYQT5: + from PyQt5.QtSensors import * +elif PYQT6: + from PyQt6.QtSensors import * +elif PYSIDE6: + from PySide6.QtSensors import * +elif PYSIDE2: + from PySide2.QtSensors import * +else: + raise PythonQtError('No Qt bindings could be found') diff --git a/qtpy/QtSerialPort.py b/qtpy/QtSerialPort.py index 774005c7..426cb8f5 100644 --- a/qtpy/QtSerialPort.py +++ b/qtpy/QtSerialPort.py @@ -8,9 +8,15 @@ """Provides QtSerialPort classes and functions.""" # Local imports -from . import PYQT5, PythonQtError +from . import PYQT5, PYQT6, PYSIDE2, PYSIDE6, PythonQtError if PYQT5: from PyQt5.QtSerialPort import * +elif PYQT6: + from PyQt6.QtSerialPort import * +elif PYSIDE6: + from PySide6.QtSerialPort import * +elif PYSIDE2: + from PySide2.QtSerialPort import * else: raise PythonQtError('No Qt bindings could be found') diff --git a/qtpy/QtSql.py b/qtpy/QtSql.py index 44f02884..4f5565d2 100644 --- a/qtpy/QtSql.py +++ b/qtpy/QtSql.py @@ -7,10 +7,12 @@ """Provides QtSql classes and functions.""" # Local imports -from . import PYQT5, PYSIDE6, PYSIDE2, PythonQtError +from . import PYQT5, PYQT6, PYSIDE6, PYSIDE2, PythonQtError if PYQT5: from PyQt5.QtSql import * +elif PYQT6: + from PyQt6.QtSql import * elif PYSIDE6: from PySide6.QtSql import * elif PYSIDE2: diff --git a/qtpy/QtWebChannel.py b/qtpy/QtWebChannel.py index ad4fbea3..efd402c8 100644 --- a/qtpy/QtWebChannel.py +++ b/qtpy/QtWebChannel.py @@ -7,10 +7,12 @@ """Provides QtWebChannel classes and functions.""" # Local imports -from . import PYSIDE2, PYSIDE6, PYQT5, PythonQtError +from . import PYSIDE2, PYSIDE6, PYQT5, PYQT6, PythonQtError if PYQT5: from PyQt5.QtWebChannel import * +elif PYQT6: + from PyQt6.QtWebChannel import * elif PYSIDE6: from PySide6.QtWebChannel import * elif PYSIDE2: diff --git a/qtpy/QtWebEngineCore.py b/qtpy/QtWebEngineCore.py new file mode 100644 index 00000000..591b14f2 --- /dev/null +++ b/qtpy/QtWebEngineCore.py @@ -0,0 +1,21 @@ +# ----------------------------------------------------------------------------- +# Copyright © 2009- The Spyder Development Team +# +# Licensed under the terms of the MIT License +# (see LICENSE.txt for details) +# ----------------------------------------------------------------------------- +"""Provides QtWebEngineCore classes and functions.""" + +# Local imports +from . import PYQT5, PYQT6, PYSIDE2, PYSIDE6, PythonQtError + +if PYQT5: + from PyQt5.QtWebEngineCore import * +elif PYQT6: + from PyQt6.QtWebEngineCore import * +elif PYSIDE2: + from PySide2.QtWebEngineCore import * +elif PYSIDE6: + from PySide6.QtWebEngineCore import * +else: + raise PythonQtError('No Qt bindings could be found') diff --git a/qtpy/QtWebEngineQuick.py b/qtpy/QtWebEngineQuick.py new file mode 100644 index 00000000..e5d9afdc --- /dev/null +++ b/qtpy/QtWebEngineQuick.py @@ -0,0 +1,17 @@ +# ----------------------------------------------------------------------------- +# Copyright © 2009- The Spyder Development Team +# +# Licensed under the terms of the MIT License +# (see LICENSE.txt for details) +# ----------------------------------------------------------------------------- +"""Provides QtWebEngineQuick classes and functions.""" + +# Local imports +from . import PYQT5, PYQT6, PYSIDE2, PYSIDE6, PythonQtError + +if PYQT6: + from PyQt6.QtWebEngineQuick import * +elif PYSIDE6: + from PySide6.QtWebEngineQuick import * +else: + raise PythonQtError('No Qt bindings could be found') diff --git a/qtpy/QtWebEngineWidgets.py b/qtpy/QtWebEngineWidgets.py index e246ab51..ead018d0 100644 --- a/qtpy/QtWebEngineWidgets.py +++ b/qtpy/QtWebEngineWidgets.py @@ -9,7 +9,7 @@ Provides QtWebEngineWidgets classes and functions. """ -from . import PYQT5, PYSIDE2, PYSIDE6, PythonQtError +from . import PYQT5, PYQT6, PYSIDE2, PYSIDE6, PythonQtError # To test if we are using WebEngine or WebKit @@ -28,6 +28,11 @@ from PyQt5.QtWebKitWidgets import QWebView as QWebEngineView from PyQt5.QtWebKit import QWebSettings as QWebEngineSettings WEBENGINE = False +elif PYQT6: + from PyQt6.QtWebEngineWidgets import * + from PyQt6.QtWebEngineCore import QWebEnginePage + from PyQt6.QtWebEngineCore import QWebEngineSettings + from PyQt6.QtWebEngineCore import QWebEngineProfile elif PYSIDE6: from PySide6.QtWebEngineWidgets import * from PySide6.QtWebEngineCore import QWebEnginePage diff --git a/qtpy/QtWebSockets.py b/qtpy/QtWebSockets.py index 9f5b3731..7b2118b8 100644 --- a/qtpy/QtWebSockets.py +++ b/qtpy/QtWebSockets.py @@ -7,10 +7,12 @@ """Provides QtWebSockets classes and functions.""" # Local imports -from . import PYSIDE2, PYQT5, PythonQtError +from . import PYSIDE2, PYQT5, PYQT6, PythonQtError if PYQT5: from PyQt5.QtWebSockets import * +elif PYQT6: + from PyQt6.QtWebSockets import * elif PYSIDE2: from PySide2.QtWebSockets import * else: diff --git a/qtpy/QtXml.py b/qtpy/QtXml.py new file mode 100644 index 00000000..3c160e60 --- /dev/null +++ b/qtpy/QtXml.py @@ -0,0 +1,21 @@ +# ----------------------------------------------------------------------------- +# Copyright © 2009- The Spyder Development Team +# +# Licensed under the terms of the MIT License +# (see LICENSE.txt for details) +# ----------------------------------------------------------------------------- +"""Provides QtXml classes and functions.""" + +# Local imports +from . import PYSIDE2, PYSIDE6, PYQT5, PYQT6, PythonQtError + +if PYQT5: + from PyQt5.QtXml import * +elif PYQT6: + from PyQt6.QtXml import * +elif PYSIDE6: + from PySide6.QtXml import * +elif PYSIDE2: + from PySide2.QtXml import * +else: + raise PythonQtError('No Qt bindings could be found') diff --git a/qtpy/tests/test_patch_qheaderview.py b/qtpy/tests/test_patch_qheaderview.py index 37fae6ed..42e9e3bd 100644 --- a/qtpy/tests/test_patch_qheaderview.py +++ b/qtpy/tests/test_patch_qheaderview.py @@ -2,7 +2,7 @@ import pytest -from qtpy import PYSIDE2, PYSIDE6, QT_VERSION +from qtpy import PYQT6, PYSIDE2, PYSIDE6, QT_VERSION from qtpy.QtWidgets import QApplication from qtpy.QtWidgets import QHeaderView from qtpy.QtCore import Qt @@ -17,7 +17,7 @@ def get_qapp(icon_path=None): @pytest.mark.skipif( - QT_VERSION.startswith('5.15') or PYSIDE6 or + QT_VERSION.startswith('5.15') or PYSIDE6 or PYQT6 or ((PYSIDE2) and sys.version_info.major == 3 and sys.version_info.minor == 8 and (sys.platform == 'darwin' or sys.platform.startswith('linux')) ), diff --git a/qtpy/tests/test_qt3dcore.py b/qtpy/tests/test_qt3dcore.py index e3ccac8d..b3fdada4 100644 --- a/qtpy/tests/test_qt3dcore.py +++ b/qtpy/tests/test_qt3dcore.py @@ -1,7 +1,7 @@ import pytest -from qtpy import PYQT5, PYSIDE2 +from qtpy import PYQT6 -@pytest.mark.skipif(not (PYQT5 or PYSIDE2), reason="Only available in Qt5 bindings") +@pytest.mark.skipif(PYQT6, reason="Not complete in PyQt6") def test_qt3dcore(): """Test the qtpy.Qt3DCore namespace""" Qt3DCore = pytest.importorskip("qtpy.Qt3DCore") diff --git a/qtpy/tests/test_qt3dextras.py b/qtpy/tests/test_qt3dextras.py index 4a30fcdc..500ee2a6 100644 --- a/qtpy/tests/test_qt3dextras.py +++ b/qtpy/tests/test_qt3dextras.py @@ -1,7 +1,5 @@ import pytest -from qtpy import PYQT5, PYSIDE2 -@pytest.mark.skipif(not (PYQT5 or PYSIDE2), reason="Only available in Qt5 bindings") def test_qt3dextras(): """Test the qtpy.Qt3DExtras namespace""" Qt3DExtras = pytest.importorskip("qtpy.Qt3DExtras") diff --git a/qtpy/tests/test_qt3dinput.py b/qtpy/tests/test_qt3dinput.py index 3f6118b0..73ec711a 100644 --- a/qtpy/tests/test_qt3dinput.py +++ b/qtpy/tests/test_qt3dinput.py @@ -1,7 +1,5 @@ import pytest -from qtpy import PYQT5, PYSIDE2 -@pytest.mark.skipif(not (PYQT5 or PYSIDE2), reason="Only available in Qt5 bindings") def test_qt3dinput(): """Test the qtpy.Qt3DInput namespace""" Qt3DInput = pytest.importorskip("qtpy.Qt3DInput") diff --git a/qtpy/tests/test_qt3dlogic.py b/qtpy/tests/test_qt3dlogic.py index 8a01c33f..4c2df821 100644 --- a/qtpy/tests/test_qt3dlogic.py +++ b/qtpy/tests/test_qt3dlogic.py @@ -1,7 +1,5 @@ import pytest -from qtpy import PYQT5, PYSIDE2 -@pytest.mark.skipif(not (PYQT5 or PYSIDE2), reason="Only available in Qt5 bindings") def test_qt3dlogic(): """Test the qtpy.Qt3DLogic namespace""" Qt3DLogic = pytest.importorskip("qtpy.Qt3DLogic") diff --git a/qtpy/tests/test_qt3drender.py b/qtpy/tests/test_qt3drender.py index 8f8813aa..e0c4e99c 100644 --- a/qtpy/tests/test_qt3drender.py +++ b/qtpy/tests/test_qt3drender.py @@ -1,7 +1,7 @@ import pytest -from qtpy import PYQT5, PYSIDE2 +from qtpy import PYQT6 -@pytest.mark.skipif(not (PYQT5 or PYSIDE2), reason="Only available in Qt5 bindings") +@pytest.mark.skipif(PYQT6, reason="Not complete in PyQt6") def test_qt3drender(): """Test the qtpy.Qt3DRender namespace""" Qt3DRender = pytest.importorskip("qtpy.Qt3DRender") diff --git a/qtpy/tests/test_qtcharts.py b/qtpy/tests/test_qtcharts.py index 3b3f8a14..9d28459e 100644 --- a/qtpy/tests/test_qtcharts.py +++ b/qtpy/tests/test_qtcharts.py @@ -1,8 +1,8 @@ import pytest -from qtpy import PYSIDE2 +from qtpy import PYSIDE2, PYSIDE6 -@pytest.mark.skipif(not PYSIDE2, reason="Only available by default in PySide2") +@pytest.mark.skipif(not (PYSIDE2 or PYSIDE6), reason="Only available by default in PySide") def test_qtcharts(): """Test the qtpy.QtCharts namespace""" from qtpy import QtCharts diff --git a/qtpy/tests/test_qtcore.py b/qtpy/tests/test_qtcore.py index 196f3de2..eff7a661 100644 --- a/qtpy/tests/test_qtcore.py +++ b/qtpy/tests/test_qtcore.py @@ -1,5 +1,5 @@ import pytest -from qtpy import PYQT5, PYSIDE2, QtCore +from qtpy import PYQT5, PYQT6, PYSIDE2, QtCore """Test QtCore.""" @@ -16,7 +16,7 @@ def test_DateTime_toPython(): assert QtCore.QDateTime.toPython is not None -@pytest.mark.skipif(PYSIDE2, +@pytest.mark.skipif(PYSIDE2 or PYQT6, reason="Doesn't seem to be present on PySide2") def test_QtCore_SignalInstance(): class ClassWithSignal(QtCore.QObject): diff --git a/qtpy/tests/test_qtdatavisualization.py b/qtpy/tests/test_qtdatavisualization.py index 4c9968fa..09f19f31 100644 --- a/qtpy/tests/test_qtdatavisualization.py +++ b/qtpy/tests/test_qtdatavisualization.py @@ -1,9 +1,6 @@ import pytest -from qtpy import PYQT5, PYSIDE2 - -@pytest.mark.skipif(not (PYQT5 or PYSIDE2), reason="Only available in Qt5 bindings") def test_qtdatavisualization(): """Test the qtpy.QtDataVisualization namespace""" # Using import skip here since with Python 3 you need to install another package diff --git a/qtpy/tests/test_qtdbus.py b/qtpy/tests/test_qtdbus.py new file mode 100644 index 00000000..2eaf4f5b --- /dev/null +++ b/qtpy/tests/test_qtdbus.py @@ -0,0 +1,12 @@ +import pytest +from qtpy import PYSIDE2, PYSIDE6, PYQT5, PYQT6 + +@pytest.mark.skipif(PYSIDE2 or PYSIDE6, reason="Not available in PySide2, not on CI for PySide6") +def test_qtdbus(): + """Test the qtpy.QtDBus namespace""" + from qtpy import QtDBus + + assert QtDBus.QDBusAbstractAdaptor is not None + assert QtDBus.QDBusAbstractInterface is not None + assert QtDBus.QDBusArgument is not None + assert QtDBus.QDBusConnection is not None diff --git a/qtpy/tests/test_qtdesigner.py b/qtpy/tests/test_qtdesigner.py index 4e96b563..254de11f 100644 --- a/qtpy/tests/test_qtdesigner.py +++ b/qtpy/tests/test_qtdesigner.py @@ -1,7 +1,7 @@ import pytest -from qtpy import PYSIDE6, PYSIDE2 +from qtpy import PYSIDE2 -@pytest.mark.skipif((PYSIDE6 or PYSIDE2), reason="QtDesigner is not avalaible in PySide2/PySide6") +@pytest.mark.skipif(PYSIDE2, reason="QtDesigner is not avalaible in PySide2") def test_qtdesigner(): from qtpy import QtDesigner """Test the qtpy.QtDesigner namespace""" diff --git a/qtpy/tests/test_qtmultimedia.py b/qtpy/tests/test_qtmultimedia.py index 369ca19e..6558b2ba 100644 --- a/qtpy/tests/test_qtmultimedia.py +++ b/qtpy/tests/test_qtmultimedia.py @@ -2,10 +2,10 @@ import pytest -from qtpy import PYSIDE6 +from qtpy import PYSIDE6, PYQT6 @pytest.mark.skipif( - sys.platform.startswith('linux') and PYSIDE6, + sys.platform.startswith('linux') and (PYSIDE6 or PYQT6), reason="Needs to setup GStreamer on Linux") def test_qtmultimedia(): """Test the qtpy.QtMultimedia namespace""" @@ -14,7 +14,7 @@ def test_qtmultimedia(): assert QtMultimedia.QAudio is not None assert QtMultimedia.QAudioInput is not None - if not PYSIDE6: + if not (PYSIDE6 or PYQT6): assert QtMultimedia.QAbstractVideoBuffer is not None assert QtMultimedia.QAudioDeviceInfo is not None assert QtMultimedia.QSound is not None diff --git a/qtpy/tests/test_qtnetwork.py b/qtpy/tests/test_qtnetwork.py index 54b3b17a..eb8ec387 100644 --- a/qtpy/tests/test_qtnetwork.py +++ b/qtpy/tests/test_qtnetwork.py @@ -1,5 +1,5 @@ import pytest -from qtpy import PYSIDE2, PYSIDE6, QtNetwork +from qtpy import PYSIDE2, PYSIDE6, PYQT6, QtNetwork def test_qtnetwork(): @@ -15,7 +15,7 @@ def test_qtnetwork(): assert QtNetwork.QNetworkDiskCache is not None assert QtNetwork.QNetworkReply is not None assert QtNetwork.QNetworkRequest is not None - if not PYSIDE6: + if not (PYSIDE6 or PYQT6): assert QtNetwork.QNetworkConfigurationManager is not None assert QtNetwork.QNetworkConfiguration is not None assert QtNetwork.QNetworkSession is not None diff --git a/qtpy/tests/test_qtnetworkauth.py b/qtpy/tests/test_qtnetworkauth.py new file mode 100644 index 00000000..cea1aa78 --- /dev/null +++ b/qtpy/tests/test_qtnetworkauth.py @@ -0,0 +1,13 @@ +import pytest +from qtpy import PYQT5, PYQT6, PYSIDE2, PYSIDE6 + +@pytest.mark.skipif(PYSIDE2 or PYQT5, reason="Not available in CI") +def test_qtnetworkauth(): + """Test the qtpy.QtNetworkAuth namespace""" + from qtpy import QtNetworkAuth + assert QtNetworkAuth.QAbstractOAuth is not None + assert QtNetworkAuth.QAbstractOAuth2 is not None + assert QtNetworkAuth.QAbstractOAuthReplyHandler is not None + assert QtNetworkAuth.QOAuth1 is not None + assert QtNetworkAuth.QOAuth1Signature is not None + assert QtNetworkAuth.QOAuth2AuthorizationCodeFlow is not None diff --git a/qtpy/tests/test_qtopenglwidgets.py b/qtpy/tests/test_qtopenglwidgets.py new file mode 100644 index 00000000..3085c078 --- /dev/null +++ b/qtpy/tests/test_qtopenglwidgets.py @@ -0,0 +1,9 @@ +import pytest +from qtpy import PYSIDE2, PYSIDE6, PYQT5, PYQT6 + +@pytest.mark.skipif(PYSIDE2 or PYQT5, reason="Not available in PySide2/PyQt5") +def test_qtopenglwidgets(): + """Test the qtpy.QtOpenGLWidgets namespace""" + from qtpy import QtOpenGLWidgets + + assert QtOpenGLWidgets.QOpenGLWidget is not None diff --git a/qtpy/tests/test_qtremoteobjects.py b/qtpy/tests/test_qtremoteobjects.py new file mode 100644 index 00000000..c7a1d10b --- /dev/null +++ b/qtpy/tests/test_qtremoteobjects.py @@ -0,0 +1,13 @@ +import pytest +from qtpy import PYSIDE2, PYSIDE6, PYQT5, PYQT6 + +@pytest.mark.skipif(True, reason="Not available in CI") +def test_qtremoteobjects(): + """Test the qtpy.QtRemoteObjects namespace""" + from qtpy import QtRemoteObjects + + assert QtRemoteObjects.QRemoteObjectAbstractPersistedStore is not None + assert QtRemoteObjects.QRemoteObjectDynamicReplica is not None + assert QtRemoteObjects.QRemoteObjectHost is not None + assert QtRemoteObjects.QRemoteObjectHostBase is not None + assert QtRemoteObjects.QRemoteObjectNode is not None diff --git a/qtpy/tests/test_qtsensors.py b/qtpy/tests/test_qtsensors.py new file mode 100644 index 00000000..b0d1f21f --- /dev/null +++ b/qtpy/tests/test_qtsensors.py @@ -0,0 +1,11 @@ +import pytest +from qtpy import PYSIDE6, PYQT6 + +def test_qtsensors(): + """Test the qtpy.QtSensors namespace""" + from qtpy import QtSensors + + assert QtSensors.QAccelerometer is not None + assert QtSensors.QAccelerometerFilter is not None + assert QtSensors.QAccelerometerReading is not None + diff --git a/qtpy/tests/test_qtserialport.py b/qtpy/tests/test_qtserialport.py index 0d740b2e..cb913427 100644 --- a/qtpy/tests/test_qtserialport.py +++ b/qtpy/tests/test_qtserialport.py @@ -1,7 +1,7 @@ import pytest -from qtpy import PYQT5 +from qtpy import PYSIDE2 -@pytest.mark.skipif(not PYQT5, reason="Only available in Qt5 bindings, but still not in PySide2") +@pytest.mark.skipif(PYSIDE2, reason="Not available in CI") def test_qtserialport(): """Test the qtpy.QtSerialPort namespace""" from qtpy import QtSerialPort diff --git a/qtpy/tests/test_qtsvg.py b/qtpy/tests/test_qtsvg.py index 56d962b1..1eef81e2 100644 --- a/qtpy/tests/test_qtsvg.py +++ b/qtpy/tests/test_qtsvg.py @@ -1,11 +1,11 @@ import pytest -from qtpy import PYSIDE6 +from qtpy import PYSIDE6, PYQT6 def test_qtsvg(): """Test the qtpy.QtSvg namespace""" from qtpy import QtSvg - if not PYSIDE6: + if not (PYSIDE6 or PYQT6): assert QtSvg.QGraphicsSvgItem is not None assert QtSvg.QSvgWidget is not None assert QtSvg.QSvgGenerator is not None diff --git a/qtpy/tests/test_qtwebenginecore.py b/qtpy/tests/test_qtwebenginecore.py new file mode 100644 index 00000000..591b0763 --- /dev/null +++ b/qtpy/tests/test_qtwebenginecore.py @@ -0,0 +1,9 @@ +import pytest +from qtpy import PYQT5, PYQT6, PYSIDE2, PYSIDE6 + +def test_qtwebenginecore(): + """Test the qtpy.QtWebEngineCore namespace""" + from qtpy import QtWebEngineCore + + assert QtWebEngineCore.QWebEngineHttpRequest is not None + diff --git a/qtpy/tests/test_qtwebenginequick.py b/qtpy/tests/test_qtwebenginequick.py new file mode 100644 index 00000000..26074760 --- /dev/null +++ b/qtpy/tests/test_qtwebenginequick.py @@ -0,0 +1,10 @@ +import pytest +from qtpy import PYQT5, PYQT6, PYSIDE2, PYSIDE6 + +@pytest.mark.skipif(PYQT5 or PYSIDE2, reason="Only available in Qt6 bindings") +def test_qtwebenginequick(): + """Test the qtpy.QtWebEngineQuick namespace""" + from qtpy import QtWebEngineQuick + assert QtWebEngineQuick.QtWebEngineQuick is not None + assert QtWebEngineQuick.QQuickWebEngineProfile is not None + diff --git a/qtpy/tests/test_qtwebenginewidgets.py b/qtpy/tests/test_qtwebenginewidgets.py index 276f5ff0..513b6c59 100644 --- a/qtpy/tests/test_qtwebenginewidgets.py +++ b/qtpy/tests/test_qtwebenginewidgets.py @@ -1,9 +1,9 @@ import pytest -from qtpy import PYSIDE6 +from qtpy import PYSIDE6, PYQT6 -@pytest.mark.skipif(PYSIDE6, reason="Only available in Qt<6 bindings") +@pytest.mark.skipif(PYSIDE6 or PYQT6, reason="Only available in Qt<6,>=6.2 bindings") def test_qtwebenginewidgets(): - """Test the qtpy.QtWebSockets namespace""" + """Test the qtpy.QtWebEngineWidget namespace""" QtWebEngineWidgets = pytest.importorskip("qtpy.QtWebEngineWidgets") diff --git a/qtpy/tests/test_qtxml.py b/qtpy/tests/test_qtxml.py new file mode 100644 index 00000000..27d4f235 --- /dev/null +++ b/qtpy/tests/test_qtxml.py @@ -0,0 +1,23 @@ +import pytest + +def test_qtxml(): + """Test the qtpy.QtXml namespace""" + from qtpy import QtXml + + assert QtXml.QDomAttr is not None + assert QtXml.QDomCDATASection is not None + assert QtXml.QDomCharacterData is not None + assert QtXml.QDomComment is not None + assert QtXml.QDomDocument is not None + assert QtXml.QDomDocumentFragment is not None + assert QtXml.QDomDocumentType is not None + assert QtXml.QDomElement is not None + assert QtXml.QDomEntity is not None + assert QtXml.QDomEntityReference is not None + assert QtXml.QDomImplementation is not None + assert QtXml.QDomNamedNodeMap is not None + assert QtXml.QDomNode is not None + assert QtXml.QDomNodeList is not None + assert QtXml.QDomNotation is not None + assert QtXml.QDomProcessingInstruction is not None + assert QtXml.QDomText is not None diff --git a/qtpy/tests/test_qtxmlpatterns.py b/qtpy/tests/test_qtxmlpatterns.py index 4f8da789..a2984879 100644 --- a/qtpy/tests/test_qtxmlpatterns.py +++ b/qtpy/tests/test_qtxmlpatterns.py @@ -1,7 +1,7 @@ import pytest -from qtpy import PYSIDE2, PYSIDE6 +from qtpy import PYSIDE2, PYSIDE6, PYQT6 -@pytest.mark.skipif(PYSIDE6, reason="not available with qt 6.0") +@pytest.mark.skipif((PYSIDE6 or PYQT6), reason="not available with qt 6.0") def test_qtxmlpatterns(): """Test the qtpy.QtXmlPatterns namespace""" from qtpy import QtXmlPatterns From ec048350c130c36b58750aaf7fe369981f010387 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Althviz=20Mor=C3=A9?= Date: Thu, 21 Oct 2021 10:46:19 -0500 Subject: [PATCH 2/2] Apply missing suggestions from code review --- qtpy/tests/test_qtcore.py | 2 +- qtpy/tests/test_qtremoteobjects.py | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/qtpy/tests/test_qtcore.py b/qtpy/tests/test_qtcore.py index eff7a661..e9b22ae7 100644 --- a/qtpy/tests/test_qtcore.py +++ b/qtpy/tests/test_qtcore.py @@ -17,7 +17,7 @@ def test_DateTime_toPython(): @pytest.mark.skipif(PYSIDE2 or PYQT6, - reason="Doesn't seem to be present on PySide2") + reason="Doesn't seem to be present on PySide2 and PyQt6") def test_QtCore_SignalInstance(): class ClassWithSignal(QtCore.QObject): signal = QtCore.Signal() diff --git a/qtpy/tests/test_qtremoteobjects.py b/qtpy/tests/test_qtremoteobjects.py index c7a1d10b..88234b9d 100644 --- a/qtpy/tests/test_qtremoteobjects.py +++ b/qtpy/tests/test_qtremoteobjects.py @@ -1,10 +1,9 @@ import pytest from qtpy import PYSIDE2, PYSIDE6, PYQT5, PYQT6 -@pytest.mark.skipif(True, reason="Not available in CI") def test_qtremoteobjects(): """Test the qtpy.QtRemoteObjects namespace""" - from qtpy import QtRemoteObjects + QtRemoteObjects = pytest.importorskip("qtpy.QtRemoteObjects") assert QtRemoteObjects.QRemoteObjectAbstractPersistedStore is not None assert QtRemoteObjects.QRemoteObjectDynamicReplica is not None