Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add pyqt imports to mimic python_qt_bindings #115

Draft
wants to merge 3 commits into
base: rolling
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@
<buildtool_depend>ament_cmake</buildtool_depend>

<build_depend>qtbase5-dev</build_depend>
<build_depend>python3-qt5-bindings</build_depend>
<build_depend>python3_qtpy</build_depend>
<build_depend>python3-pyqt5</build_depend>

<exec_depend>python3-qt5-bindings</exec_depend>
<exec_depend>python3-qtpy</exec_depend>
<exec_depend>python3-pyqt5</exec_depend>

<test_depend>ament_cmake_pytest</test_depend>
<test_depend>ament_lint_auto</test_depend>
Expand Down
1 change: 1 addition & 0 deletions src/python_qt_binding/Qt3DAnimation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from qtpy.Qt3DAnimation import * # noqa: F401, F403
1 change: 1 addition & 0 deletions src/python_qt_binding/Qt3DCore.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from qtpy.Qt3DCore import * # noqa: F401, F403
1 change: 1 addition & 0 deletions src/python_qt_binding/Qt3DExtras.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from qtpy.Qt3DExtras import * # noqa: F401, F403
1 change: 1 addition & 0 deletions src/python_qt_binding/Qt3DInput.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from qtpy.Qt3DInput import * # noqa: F401, F403
1 change: 1 addition & 0 deletions src/python_qt_binding/Qt3DLogic.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from qtpy.Qt3DLogic import * # noqa: F401, F403
1 change: 1 addition & 0 deletions src/python_qt_binding/Qt3DRender.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from qtpy.Qt3DRender import * # noqa: F401, F403
1 change: 1 addition & 0 deletions src/python_qt_binding/QtCharts.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from qtpy.QtCharts import * # noqa: F401, F403
3 changes: 3 additions & 0 deletions src/python_qt_binding/QtCore.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from qtpy.QtCore import * # noqa: F401, F403

pyqtSlot = Slot
1 change: 1 addition & 0 deletions src/python_qt_binding/QtDBus.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from qtpy.QtDBus import * # noqa: F401, F403
1 change: 1 addition & 0 deletions src/python_qt_binding/QtDataVisualization.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from qtpy.QtDataVisualization import * # noqa: F401, F403
1 change: 1 addition & 0 deletions src/python_qt_binding/QtDesigner.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from qtpy.QtDesigner import * # noqa: F401, F403
1 change: 1 addition & 0 deletions src/python_qt_binding/QtGui.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from qtpy.QtGui import * # noqa: F401, F403
1 change: 1 addition & 0 deletions src/python_qt_binding/QtHelp.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from qtpy.QtHelp import * # noqa: F401, F403
1 change: 1 addition & 0 deletions src/python_qt_binding/QtLocation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from qtpy.QtLocation import * # noqa: F401, F403
1 change: 1 addition & 0 deletions src/python_qt_binding/QtMultimedia.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from qtpy.QtMultimedia import * # noqa: F401, F403
1 change: 1 addition & 0 deletions src/python_qt_binding/QtMultimediaWidgets.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from qtpy.QtMultimediaWidgets import * # noqa: F401, F403
1 change: 1 addition & 0 deletions src/python_qt_binding/QtNetwork.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from qtpy.QtNetwork import * # noqa: F401, F403
1 change: 1 addition & 0 deletions src/python_qt_binding/QtNetworkAuth.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from qtpy.QtNetworkAuth import * # noqa: F401, F403
1 change: 1 addition & 0 deletions src/python_qt_binding/QtOpenGL.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from qtpy.QtOpenGL import * # noqa: F401, F403
1 change: 1 addition & 0 deletions src/python_qt_binding/QtOpenGLWidgets.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from qtpy.QtOpenGLWidgets import * # noqa: F401, F403
1 change: 1 addition & 0 deletions src/python_qt_binding/QtPositioning.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from qtpy.QtPositioning import * # noqa: F401, F403
1 change: 1 addition & 0 deletions src/python_qt_binding/QtPrintSupport.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from qtpy.QtPrintSupport import * # noqa: F401, F403
1 change: 1 addition & 0 deletions src/python_qt_binding/QtQml.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from qtpy.QtQml import * # noqa: F401, F403
1 change: 1 addition & 0 deletions src/python_qt_binding/QtQuick.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from qtpy.QtQuick import * # noqa: F401, F403
1 change: 1 addition & 0 deletions src/python_qt_binding/QtQuickWidgets.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from qtpy.QtQuickWidgets import * # noqa: F401, F403
1 change: 1 addition & 0 deletions src/python_qt_binding/QtRemoteObjects.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from qtpy.QtRemoteObjects import * # noqa: F401, F403
1 change: 1 addition & 0 deletions src/python_qt_binding/QtSensors.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from qtpy.QtSensors import * # noqa: F401, F403
1 change: 1 addition & 0 deletions src/python_qt_binding/QtSerialPort.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from qtpy.QtSerialPort import * # noqa: F401, F403
1 change: 1 addition & 0 deletions src/python_qt_binding/QtSql.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from qtpy.QtSql import * # noqa: F401, F403
1 change: 1 addition & 0 deletions src/python_qt_binding/QtSvg.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from qtpy.QtSvg import * # noqa: F401, F403
1 change: 1 addition & 0 deletions src/python_qt_binding/QtTest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from qtpy.QtTest import * # noqa: F401, F403
1 change: 1 addition & 0 deletions src/python_qt_binding/QtTextToSpeech.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from qtpy.QtTextToSpeech import * # noqa: F401, F403
1 change: 1 addition & 0 deletions src/python_qt_binding/QtWebChannel.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from qtpy.QtWebChannel import * # noqa: F401, F403
1 change: 1 addition & 0 deletions src/python_qt_binding/QtWebEngine.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from qtpy.QtWebEngine import * # noqa: F401, F403
1 change: 1 addition & 0 deletions src/python_qt_binding/QtWebEngineCore.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from qtpy.QtWebEngineCore import * # noqa: F401, F403
1 change: 1 addition & 0 deletions src/python_qt_binding/QtWebEngineQuick.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from qtpy.QtWebEngineQuick import * # noqa: F401, F403
1 change: 1 addition & 0 deletions src/python_qt_binding/QtWebEngineWidgets.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from qtpy.QtWebEngineWidgets import * # noqa: F401, F403
1 change: 1 addition & 0 deletions src/python_qt_binding/QtWebSockets.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from qtpy.QtWebSockets import * # noqa: F401, F403
1 change: 1 addition & 0 deletions src/python_qt_binding/QtWidgets.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from qtpy.QtWidgets import * # noqa: F401, F403
1 change: 1 addition & 0 deletions src/python_qt_binding/QtWinExtras.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from qtpy.QtWinExtras import * # noqa: F401, F403
1 change: 1 addition & 0 deletions src/python_qt_binding/QtXml.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from qtpy.QtXml import * # noqa: F401, F403
1 change: 1 addition & 0 deletions src/python_qt_binding/QtXmlPatterns.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from qtpy.QtXmlPatterns import * # noqa: F401, F403
52 changes: 20 additions & 32 deletions src/python_qt_binding/__init__.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -30,39 +31,26 @@
# 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 qtpy import API_NAME, PYSIDE_VERSION, PYQT_VERSION

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
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."
"python_qt_bindings will only cater generation scrips in the future.")
warnings.warn(_DEPRECATION_MESSAGE,
DeprecationWarning, 2)