From eca9abaced9061e062c8fb99b1a55c2bb5c079a6 Mon Sep 17 00:00:00 2001 From: Christoph Hellmann Santos Date: Mon, 29 Aug 2022 21:55:28 +0200 Subject: [PATCH 1/3] add pyqt imports to mimic python_qt_bindings --- src/python_qt_binding/Qt3DAnimation.py | 1 + src/python_qt_binding/Qt3DCore.py | 1 + src/python_qt_binding/Qt3DExtras.py | 1 + src/python_qt_binding/Qt3DInput.py | 1 + src/python_qt_binding/Qt3DLogic.py | 1 + src/python_qt_binding/Qt3DRender.py | 1 + src/python_qt_binding/QtCharts.py | 1 + src/python_qt_binding/QtCore.py | 1 + src/python_qt_binding/QtDBus.py | 1 + src/python_qt_binding/QtDataVisualization.py | 1 + src/python_qt_binding/QtDesigner.py | 1 + src/python_qt_binding/QtGui.py | 1 + src/python_qt_binding/QtHelp.py | 1 + src/python_qt_binding/QtLocation.py | 1 + src/python_qt_binding/QtMultimedia.py | 1 + src/python_qt_binding/QtMultimediaWidgets.py | 1 + src/python_qt_binding/QtNetwork.py | 1 + src/python_qt_binding/QtNetworkAuth.py | 1 + src/python_qt_binding/QtOpenGL.py | 1 + src/python_qt_binding/QtOpenGLWidgets.py | 1 + src/python_qt_binding/QtPositioning.py | 1 + src/python_qt_binding/QtPrintSupport.py | 1 + src/python_qt_binding/QtQml.py | 1 + src/python_qt_binding/QtQuick.py | 1 + src/python_qt_binding/QtQuickWidgets.py | 1 + src/python_qt_binding/QtRemoteObjects.py | 1 + src/python_qt_binding/QtSensors.py | 1 + src/python_qt_binding/QtSerialPort.py | 1 + src/python_qt_binding/QtSql.py | 1 + src/python_qt_binding/QtSvg.py | 1 + src/python_qt_binding/QtTest.py | 1 + src/python_qt_binding/QtTextToSpeech.py | 1 + src/python_qt_binding/QtWebChannel.py | 1 + src/python_qt_binding/QtWebEngine.py | 1 + src/python_qt_binding/QtWebEngineCore.py | 1 + src/python_qt_binding/QtWebEngineQuick.py | 1 + src/python_qt_binding/QtWebEngineWidgets.py | 1 + src/python_qt_binding/QtWebSockets.py | 1 + src/python_qt_binding/QtWidgets.py | 1 + src/python_qt_binding/QtWinExtras.py | 1 + src/python_qt_binding/QtXml.py | 1 + src/python_qt_binding/QtXmlPatterns.py | 1 + src/python_qt_binding/__init__.py | 42 ++++---------------- 43 files changed, 50 insertions(+), 34 deletions(-) create mode 100644 src/python_qt_binding/Qt3DAnimation.py create mode 100644 src/python_qt_binding/Qt3DCore.py create mode 100644 src/python_qt_binding/Qt3DExtras.py create mode 100644 src/python_qt_binding/Qt3DInput.py create mode 100644 src/python_qt_binding/Qt3DLogic.py create mode 100644 src/python_qt_binding/Qt3DRender.py create mode 100644 src/python_qt_binding/QtCharts.py create mode 100644 src/python_qt_binding/QtCore.py create mode 100644 src/python_qt_binding/QtDBus.py create mode 100644 src/python_qt_binding/QtDataVisualization.py create mode 100644 src/python_qt_binding/QtDesigner.py create mode 100644 src/python_qt_binding/QtGui.py create mode 100644 src/python_qt_binding/QtHelp.py create mode 100644 src/python_qt_binding/QtLocation.py create mode 100644 src/python_qt_binding/QtMultimedia.py create mode 100644 src/python_qt_binding/QtMultimediaWidgets.py create mode 100644 src/python_qt_binding/QtNetwork.py create mode 100644 src/python_qt_binding/QtNetworkAuth.py create mode 100644 src/python_qt_binding/QtOpenGL.py create mode 100644 src/python_qt_binding/QtOpenGLWidgets.py create mode 100644 src/python_qt_binding/QtPositioning.py create mode 100644 src/python_qt_binding/QtPrintSupport.py create mode 100644 src/python_qt_binding/QtQml.py create mode 100644 src/python_qt_binding/QtQuick.py create mode 100644 src/python_qt_binding/QtQuickWidgets.py create mode 100644 src/python_qt_binding/QtRemoteObjects.py create mode 100644 src/python_qt_binding/QtSensors.py create mode 100644 src/python_qt_binding/QtSerialPort.py create mode 100644 src/python_qt_binding/QtSql.py create mode 100644 src/python_qt_binding/QtSvg.py create mode 100644 src/python_qt_binding/QtTest.py create mode 100644 src/python_qt_binding/QtTextToSpeech.py create mode 100644 src/python_qt_binding/QtWebChannel.py create mode 100644 src/python_qt_binding/QtWebEngine.py create mode 100644 src/python_qt_binding/QtWebEngineCore.py create mode 100644 src/python_qt_binding/QtWebEngineQuick.py create mode 100644 src/python_qt_binding/QtWebEngineWidgets.py create mode 100644 src/python_qt_binding/QtWebSockets.py create mode 100644 src/python_qt_binding/QtWidgets.py create mode 100644 src/python_qt_binding/QtWinExtras.py create mode 100644 src/python_qt_binding/QtXml.py create mode 100644 src/python_qt_binding/QtXmlPatterns.py diff --git a/src/python_qt_binding/Qt3DAnimation.py b/src/python_qt_binding/Qt3DAnimation.py new file mode 100644 index 0000000..b10bd5e --- /dev/null +++ b/src/python_qt_binding/Qt3DAnimation.py @@ -0,0 +1 @@ +from qtpy.Qt3DAnimation import * # noqa: F401, F403 diff --git a/src/python_qt_binding/Qt3DCore.py b/src/python_qt_binding/Qt3DCore.py new file mode 100644 index 0000000..a36d89c --- /dev/null +++ b/src/python_qt_binding/Qt3DCore.py @@ -0,0 +1 @@ +from qtpy.Qt3DCore import * # noqa: F401, F403 diff --git a/src/python_qt_binding/Qt3DExtras.py b/src/python_qt_binding/Qt3DExtras.py new file mode 100644 index 0000000..578bdbf --- /dev/null +++ b/src/python_qt_binding/Qt3DExtras.py @@ -0,0 +1 @@ +from qtpy.Qt3DExtras import * # noqa: F401, F403 diff --git a/src/python_qt_binding/Qt3DInput.py b/src/python_qt_binding/Qt3DInput.py new file mode 100644 index 0000000..ca45b95 --- /dev/null +++ b/src/python_qt_binding/Qt3DInput.py @@ -0,0 +1 @@ +from qtpy.Qt3DInput import * # noqa: F401, F403 diff --git a/src/python_qt_binding/Qt3DLogic.py b/src/python_qt_binding/Qt3DLogic.py new file mode 100644 index 0000000..8b9e461 --- /dev/null +++ b/src/python_qt_binding/Qt3DLogic.py @@ -0,0 +1 @@ +from qtpy.Qt3DLogic import * # noqa: F401, F403 diff --git a/src/python_qt_binding/Qt3DRender.py b/src/python_qt_binding/Qt3DRender.py new file mode 100644 index 0000000..bdeec75 --- /dev/null +++ b/src/python_qt_binding/Qt3DRender.py @@ -0,0 +1 @@ +from qtpy.Qt3DRender import * # noqa: F401, F403 diff --git a/src/python_qt_binding/QtCharts.py b/src/python_qt_binding/QtCharts.py new file mode 100644 index 0000000..5d1fa78 --- /dev/null +++ b/src/python_qt_binding/QtCharts.py @@ -0,0 +1 @@ +from qtpy.QtCharts import * # noqa: F401, F403 diff --git a/src/python_qt_binding/QtCore.py b/src/python_qt_binding/QtCore.py new file mode 100644 index 0000000..b63fdb3 --- /dev/null +++ b/src/python_qt_binding/QtCore.py @@ -0,0 +1 @@ +from qtpy.QtCore import * # noqa: F401, F403 diff --git a/src/python_qt_binding/QtDBus.py b/src/python_qt_binding/QtDBus.py new file mode 100644 index 0000000..ee155e5 --- /dev/null +++ b/src/python_qt_binding/QtDBus.py @@ -0,0 +1 @@ +from qtpy.QtDBus import * # noqa: F401, F403 diff --git a/src/python_qt_binding/QtDataVisualization.py b/src/python_qt_binding/QtDataVisualization.py new file mode 100644 index 0000000..3fa4f83 --- /dev/null +++ b/src/python_qt_binding/QtDataVisualization.py @@ -0,0 +1 @@ +from qtpy.QtDataVisualization import * # noqa: F401, F403 diff --git a/src/python_qt_binding/QtDesigner.py b/src/python_qt_binding/QtDesigner.py new file mode 100644 index 0000000..a637c9a --- /dev/null +++ b/src/python_qt_binding/QtDesigner.py @@ -0,0 +1 @@ +from qtpy.QtDesigner import * # noqa: F401, F403 diff --git a/src/python_qt_binding/QtGui.py b/src/python_qt_binding/QtGui.py new file mode 100644 index 0000000..1e82c39 --- /dev/null +++ b/src/python_qt_binding/QtGui.py @@ -0,0 +1 @@ +from qtpy.QtGui import * # noqa: F401, F403 diff --git a/src/python_qt_binding/QtHelp.py b/src/python_qt_binding/QtHelp.py new file mode 100644 index 0000000..33c38fb --- /dev/null +++ b/src/python_qt_binding/QtHelp.py @@ -0,0 +1 @@ +from qtpy.QtHelp import * # noqa: F401, F403 diff --git a/src/python_qt_binding/QtLocation.py b/src/python_qt_binding/QtLocation.py new file mode 100644 index 0000000..9337ca5 --- /dev/null +++ b/src/python_qt_binding/QtLocation.py @@ -0,0 +1 @@ +from qtpy.QtLocation import * # noqa: F401, F403 diff --git a/src/python_qt_binding/QtMultimedia.py b/src/python_qt_binding/QtMultimedia.py new file mode 100644 index 0000000..7194a9e --- /dev/null +++ b/src/python_qt_binding/QtMultimedia.py @@ -0,0 +1 @@ +from qtpy.QtMultimedia import * # noqa: F401, F403 diff --git a/src/python_qt_binding/QtMultimediaWidgets.py b/src/python_qt_binding/QtMultimediaWidgets.py new file mode 100644 index 0000000..8c9ffe5 --- /dev/null +++ b/src/python_qt_binding/QtMultimediaWidgets.py @@ -0,0 +1 @@ +from qtpy.QtMultimediaWidgets import * # noqa: F401, F403 diff --git a/src/python_qt_binding/QtNetwork.py b/src/python_qt_binding/QtNetwork.py new file mode 100644 index 0000000..3f62c93 --- /dev/null +++ b/src/python_qt_binding/QtNetwork.py @@ -0,0 +1 @@ +from qtpy.QtNetwork import * # noqa: F401, F403 diff --git a/src/python_qt_binding/QtNetworkAuth.py b/src/python_qt_binding/QtNetworkAuth.py new file mode 100644 index 0000000..efd7762 --- /dev/null +++ b/src/python_qt_binding/QtNetworkAuth.py @@ -0,0 +1 @@ +from qtpy.QtNetworkAuth import * # noqa: F401, F403 diff --git a/src/python_qt_binding/QtOpenGL.py b/src/python_qt_binding/QtOpenGL.py new file mode 100644 index 0000000..b4c5038 --- /dev/null +++ b/src/python_qt_binding/QtOpenGL.py @@ -0,0 +1 @@ +from qtpy.QtOpenGL import * # noqa: F401, F403 diff --git a/src/python_qt_binding/QtOpenGLWidgets.py b/src/python_qt_binding/QtOpenGLWidgets.py new file mode 100644 index 0000000..8ffaedd --- /dev/null +++ b/src/python_qt_binding/QtOpenGLWidgets.py @@ -0,0 +1 @@ +from qtpy.QtOpenGLWidgets import * # noqa: F401, F403 diff --git a/src/python_qt_binding/QtPositioning.py b/src/python_qt_binding/QtPositioning.py new file mode 100644 index 0000000..949f50a --- /dev/null +++ b/src/python_qt_binding/QtPositioning.py @@ -0,0 +1 @@ +from qtpy.QtPositioning import * # noqa: F401, F403 diff --git a/src/python_qt_binding/QtPrintSupport.py b/src/python_qt_binding/QtPrintSupport.py new file mode 100644 index 0000000..b1df769 --- /dev/null +++ b/src/python_qt_binding/QtPrintSupport.py @@ -0,0 +1 @@ +from qtpy.QtPrintSupport import * # noqa: F401, F403 diff --git a/src/python_qt_binding/QtQml.py b/src/python_qt_binding/QtQml.py new file mode 100644 index 0000000..8f35f28 --- /dev/null +++ b/src/python_qt_binding/QtQml.py @@ -0,0 +1 @@ +from qtpy.QtQml import * # noqa: F401, F403 diff --git a/src/python_qt_binding/QtQuick.py b/src/python_qt_binding/QtQuick.py new file mode 100644 index 0000000..b6e6548 --- /dev/null +++ b/src/python_qt_binding/QtQuick.py @@ -0,0 +1 @@ +from qtpy.QtQuick import * # noqa: F401, F403 diff --git a/src/python_qt_binding/QtQuickWidgets.py b/src/python_qt_binding/QtQuickWidgets.py new file mode 100644 index 0000000..99a7de7 --- /dev/null +++ b/src/python_qt_binding/QtQuickWidgets.py @@ -0,0 +1 @@ +from qtpy.QtQuickWidgets import * # noqa: F401, F403 diff --git a/src/python_qt_binding/QtRemoteObjects.py b/src/python_qt_binding/QtRemoteObjects.py new file mode 100644 index 0000000..c870b85 --- /dev/null +++ b/src/python_qt_binding/QtRemoteObjects.py @@ -0,0 +1 @@ +from qtpy.QtRemoteObjects import * # noqa: F401, F403 diff --git a/src/python_qt_binding/QtSensors.py b/src/python_qt_binding/QtSensors.py new file mode 100644 index 0000000..ce0ca1b --- /dev/null +++ b/src/python_qt_binding/QtSensors.py @@ -0,0 +1 @@ +from qtpy.QtSensors import * # noqa: F401, F403 diff --git a/src/python_qt_binding/QtSerialPort.py b/src/python_qt_binding/QtSerialPort.py new file mode 100644 index 0000000..5cf9f78 --- /dev/null +++ b/src/python_qt_binding/QtSerialPort.py @@ -0,0 +1 @@ +from qtpy.QtSerialPort import * # noqa: F401, F403 diff --git a/src/python_qt_binding/QtSql.py b/src/python_qt_binding/QtSql.py new file mode 100644 index 0000000..b01107a --- /dev/null +++ b/src/python_qt_binding/QtSql.py @@ -0,0 +1 @@ +from qtpy.QtSql import * # noqa: F401, F403 diff --git a/src/python_qt_binding/QtSvg.py b/src/python_qt_binding/QtSvg.py new file mode 100644 index 0000000..e6c1786 --- /dev/null +++ b/src/python_qt_binding/QtSvg.py @@ -0,0 +1 @@ +from qtpy.QtSvg import * # noqa: F401, F403 diff --git a/src/python_qt_binding/QtTest.py b/src/python_qt_binding/QtTest.py new file mode 100644 index 0000000..2f24bbb --- /dev/null +++ b/src/python_qt_binding/QtTest.py @@ -0,0 +1 @@ +from qtpy.QtTest import * # noqa: F401, F403 diff --git a/src/python_qt_binding/QtTextToSpeech.py b/src/python_qt_binding/QtTextToSpeech.py new file mode 100644 index 0000000..3526e24 --- /dev/null +++ b/src/python_qt_binding/QtTextToSpeech.py @@ -0,0 +1 @@ +from qtpy.QtTextToSpeech import * # noqa: F401, F403 diff --git a/src/python_qt_binding/QtWebChannel.py b/src/python_qt_binding/QtWebChannel.py new file mode 100644 index 0000000..b3873fb --- /dev/null +++ b/src/python_qt_binding/QtWebChannel.py @@ -0,0 +1 @@ +from qtpy.QtWebChannel import * # noqa: F401, F403 diff --git a/src/python_qt_binding/QtWebEngine.py b/src/python_qt_binding/QtWebEngine.py new file mode 100644 index 0000000..b409cf8 --- /dev/null +++ b/src/python_qt_binding/QtWebEngine.py @@ -0,0 +1 @@ +from qtpy.QtWebEngine import * # noqa: F401, F403 diff --git a/src/python_qt_binding/QtWebEngineCore.py b/src/python_qt_binding/QtWebEngineCore.py new file mode 100644 index 0000000..a7f5125 --- /dev/null +++ b/src/python_qt_binding/QtWebEngineCore.py @@ -0,0 +1 @@ +from qtpy.QtWebEngineCore import * # noqa: F401, F403 diff --git a/src/python_qt_binding/QtWebEngineQuick.py b/src/python_qt_binding/QtWebEngineQuick.py new file mode 100644 index 0000000..70991e7 --- /dev/null +++ b/src/python_qt_binding/QtWebEngineQuick.py @@ -0,0 +1 @@ +from qtpy.QtWebEngineQuick import * # noqa: F401, F403 diff --git a/src/python_qt_binding/QtWebEngineWidgets.py b/src/python_qt_binding/QtWebEngineWidgets.py new file mode 100644 index 0000000..31f5194 --- /dev/null +++ b/src/python_qt_binding/QtWebEngineWidgets.py @@ -0,0 +1 @@ +from qtpy.QtWebEngineWidgets import * # noqa: F401, F403 diff --git a/src/python_qt_binding/QtWebSockets.py b/src/python_qt_binding/QtWebSockets.py new file mode 100644 index 0000000..1e10c7b --- /dev/null +++ b/src/python_qt_binding/QtWebSockets.py @@ -0,0 +1 @@ +from qtpy.QtWebSockets import * # noqa: F401, F403 diff --git a/src/python_qt_binding/QtWidgets.py b/src/python_qt_binding/QtWidgets.py new file mode 100644 index 0000000..6a6d0ce --- /dev/null +++ b/src/python_qt_binding/QtWidgets.py @@ -0,0 +1 @@ +from qtpy.QtWidgets import * # noqa: F401, F403 diff --git a/src/python_qt_binding/QtWinExtras.py b/src/python_qt_binding/QtWinExtras.py new file mode 100644 index 0000000..8d2511f --- /dev/null +++ b/src/python_qt_binding/QtWinExtras.py @@ -0,0 +1 @@ +from qtpy.QtWinExtras import * # noqa: F401, F403 diff --git a/src/python_qt_binding/QtXml.py b/src/python_qt_binding/QtXml.py new file mode 100644 index 0000000..8fa3446 --- /dev/null +++ b/src/python_qt_binding/QtXml.py @@ -0,0 +1 @@ +from qtpy.QtXml import * # noqa: F401, F403 diff --git a/src/python_qt_binding/QtXmlPatterns.py b/src/python_qt_binding/QtXmlPatterns.py new file mode 100644 index 0000000..5c0b691 --- /dev/null +++ b/src/python_qt_binding/QtXmlPatterns.py @@ -0,0 +1 @@ +from qtpy.QtXmlPatterns import * # noqa: F401, F403 diff --git a/src/python_qt_binding/__init__.py b/src/python_qt_binding/__init__.py index 1e209de..3dcc6fd 100644 --- a/src/python_qt_binding/__init__.py +++ b/src/python_qt_binding/__init__.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (c) 2011, Dirk Thomas, Dorian Scholz, TU Darmstadt +# 2022, Christoph Hellmann Santos, Fraunhofer IPA # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -30,39 +31,12 @@ # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. -""" -Abstraction for different Python Qt bindings. -Supported Python Qt 5 bindings are PyQt and PySide. -The Qt modules can be imported like this: +import warnings +from qtpy.uic import loadUi # noqa: F401 -from python_qt_binding.QtCore import QObject -from python_qt_binding import QtGui, loadUi - -The name of the selected binding is available in QT_BINDING. -The version of the selected binding is available in QT_BINDING_VERSION. -All available Qt modules are listed in QT_BINDING_MODULES. - -The default binding order ('pyqt', 'pyside') can be overridden with a -SELECT_QT_BINDING_ORDER attribute on sys: - setattr(sys, 'SELECT_QT_BINDING_ORDER', [FIRST_NAME, NEXT_NAME, ..]) - -A specific binding can be selected with a SELECT_QT_BINDING attribute on sys: - setattr(sys, 'SELECT_QT_BINDING', MY_BINDING_NAME) -""" - -import sys - -from python_qt_binding.binding_helper import loadUi # noqa: F401 -from python_qt_binding.binding_helper import QT_BINDING # noqa: F401 -from python_qt_binding.binding_helper import QT_BINDING_MODULES -from python_qt_binding.binding_helper import QT_BINDING_VERSION # noqa: F401 - -# register binding modules as sub modules of this package (python_qt_binding) for easy importing -for module_name, module in QT_BINDING_MODULES.items(): - sys.modules[__name__ + '.' + module_name] = module - setattr(sys.modules[__name__], module_name, module) - del module_name - del module - -del sys +_DEPRECATION_MESSAGE = ("Using python_qt_bindings package in python is deprecated." + "The package should be replaced by python3-qtpy system dep." + "python_qt_bindings will only cater generation scrips in the future.") +warnings.warn(_DEPRECATION_MESSAGE, + DeprecationWarning, 2) From 03cb54b7f664890eceb8fe94f68d1cc1852e4076 Mon Sep 17 00:00:00 2001 From: Christoph Hellmann Santos Date: Mon, 29 Aug 2022 21:59:03 +0200 Subject: [PATCH 2/3] add new dependy keys --- package.xml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/package.xml b/package.xml index 55a4a67..8656989 100644 --- a/package.xml +++ b/package.xml @@ -26,9 +26,11 @@ ament_cmake qtbase5-dev - python3-qt5-bindings + python3_qtpy + python3-pyqt5 - python3-qt5-bindings + python3-qtpy + python3-pyqt5 ament_cmake_pytest ament_lint_auto From 18a4ab61e0747508a436828ffcffafc22cbb7757 Mon Sep 17 00:00:00 2001 From: Christoph Hellmann Santos Date: Wed, 31 Aug 2022 12:09:08 +0200 Subject: [PATCH 3/3] Adding some fixes for errors in downstream packages --- src/python_qt_binding/QtCore.py | 2 ++ src/python_qt_binding/__init__.py | 14 ++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/src/python_qt_binding/QtCore.py b/src/python_qt_binding/QtCore.py index b63fdb3..2ee1f6b 100644 --- a/src/python_qt_binding/QtCore.py +++ b/src/python_qt_binding/QtCore.py @@ -1 +1,3 @@ from qtpy.QtCore import * # noqa: F401, F403 + +pyqtSlot = Slot \ No newline at end of file diff --git a/src/python_qt_binding/__init__.py b/src/python_qt_binding/__init__.py index 3dcc6fd..f7df7e6 100644 --- a/src/python_qt_binding/__init__.py +++ b/src/python_qt_binding/__init__.py @@ -34,6 +34,20 @@ import warnings from qtpy.uic import loadUi # noqa: F401 +from qtpy import API_NAME, PYSIDE_VERSION, PYQT_VERSION + +from python_qt_binding.binding_helper import QT_BINDING_MODULES + +QT_BINDING = "pyside" +QT_BINDING_VERSION = "" +QT_BINDING_MODULES = [] +if(API_NAME == "PySide2"): + QT_BINDING = "pyside" + QT_BINDING_VERSION = PYSIDE_VERSION +if(API_NAME == "PyQt5"): + QT_BINDING = "pyqt" + QT_BINDING_VERSION = PYQT_VERSION + _DEPRECATION_MESSAGE = ("Using python_qt_bindings package in python is deprecated." "The package should be replaced by python3-qtpy system dep."