diff --git a/examples/Mentor/10.2.setEventCB.py b/examples/Mentor/10.2.setEventCB.py index 24de6db9..c2fd3333 100755 --- a/examples/Mentor/10.2.setEventCB.py +++ b/examples/Mentor/10.2.setEventCB.py @@ -39,8 +39,8 @@ from pivy.gui.soqt import * # PySide module has to be imported as last one if used in the same namespace -from PySide2.QtCore import * -from PySide2.QtGui import * +from pivy.qt.QtCore import * +from pivy.qt.QtGui import * # Timer sensor # Rotate 90 degrees every second, update 30 times a second diff --git a/examples/QtDesigner/python/main.py b/examples/QtDesigner/python/main.py index 882b7b86..06a010f4 100644 --- a/examples/QtDesigner/python/main.py +++ b/examples/QtDesigner/python/main.py @@ -2,10 +2,10 @@ import sys from pivy.gui.soqt import SoQt -from PySide2.QtGui import QApplication -from PySide2.QtCore import QObject -from PySide2.QtCore import SIGNAL -from PySide2.QtCore import SLOT +from pivy.qt.QtGui import QApplication +from pivy.qt.QtCore import QObject +from pivy.qt.QtCore import SIGNAL +from pivy.qt.QtCore import SLOT from mainwindow import MainWindow if __name__ == "__main__": diff --git a/examples/QtDesigner/python/mainwindow.py b/examples/QtDesigner/python/mainwindow.py index a0efe113..c194df0e 100644 --- a/examples/QtDesigner/python/mainwindow.py +++ b/examples/QtDesigner/python/mainwindow.py @@ -4,11 +4,11 @@ from pivy.coin import * from pivy.gui.soqt import SoQtExaminerViewer from ui_test import Ui_MainWindow -from PySide2.QtGui import QWidget -from PySide2.QtGui import QMainWindow -from PySide2.QtGui import QButtonGroup -from PySide2.QtCore import QObject -from PySide2.QtCore import SIGNAL +from pivy.qt.QtGui import QWidget +from pivy.qt.QtGui import QMainWindow +from pivy.qt.QtGui import QButtonGroup +from pivy.qt.QtCore import QObject +from pivy.qt.QtCore import SIGNAL class MainWindow(QMainWindow, Ui_MainWindow): def __init__(self, parent = None): diff --git a/examples/QtDesigner/python/ui_test.py b/examples/QtDesigner/python/ui_test.py index fe5c9417..0a27cc55 100644 --- a/examples/QtDesigner/python/ui_test.py +++ b/examples/QtDesigner/python/ui_test.py @@ -7,7 +7,7 @@ # # WARNING! All changes made in this file will be lost! -from PySide2 import QtCore, QtGui +from pivy.qt import QtCore, QtGui class Ui_MainWindow(object): def setupUi(self, MainWindow): diff --git a/examples/Quarter/mdi.py b/examples/Quarter/mdi.py index 9a48d0d1..068547f9 100755 --- a/examples/Quarter/mdi.py +++ b/examples/Quarter/mdi.py @@ -19,8 +19,8 @@ import os import sys -from PySide2 import QtCore, QtGui -from PySide2.QtGui import QMainWindow, QWorkspace, QAction, QFileDialog, QApplication +from pivy.qt import QtCore, QtGui +from pivy.qt.QtGui import QMainWindow, QWorkspace, QAction, QFileDialog, QApplication from pivy.coin import SoInput, SoDB from pivy.quarter import QuarterWidget diff --git a/examples/Quarter/minimal.py b/examples/Quarter/minimal.py index 1ea95b6c..367600f0 100755 --- a/examples/Quarter/minimal.py +++ b/examples/Quarter/minimal.py @@ -18,7 +18,7 @@ import sys -from PySide2.QtWidgets import QApplication +from pivy.qt.QtWidgets import QApplication from pivy.coin import SoSeparator from pivy.coin import SoBaseColor diff --git a/examples/examiner_embed4.py b/examples/examiner_embed4.py index 50711b13..39c3948d 100755 --- a/examples/examiner_embed4.py +++ b/examples/examiner_embed4.py @@ -27,10 +27,10 @@ from pivy.gui.soqt import * try: - from PySide2.QtWidgets import * + from pivy.qt.QtWidgets import * except ImportError: - from PySide2.QtGui import * -from PySide2.QtCore import * + from pivy.qt.QtGui import * +from pivy.qt.QtCore import * class EmbeddedWindow(QMainWindow): def __init__(self, *args): diff --git a/examples/soqt/renderAreaCallback.py b/examples/soqt/renderAreaCallback.py index bd196391..527d6592 100644 --- a/examples/soqt/renderAreaCallback.py +++ b/examples/soqt/renderAreaCallback.py @@ -2,7 +2,7 @@ import sys from pivy import coin from pivy.gui import soqt -from PySide2.QtCore import QEvent +from pivy.qt.QtCore import QEvent def foo(a, event): diff --git a/examples/utils/GlClipPlane.py b/examples/utils/GlClipPlane.py index 843d4c60..242baeda 100644 --- a/examples/utils/GlClipPlane.py +++ b/examples/utils/GlClipPlane.py @@ -1,5 +1,5 @@ import sys -from PySide2 import QtGui, QtWidgets +from pivy.qt import QtGui, QtWidgets from pivy import quarter, coin from OpenGL.GL import * diff --git a/examples/utils/event_callback.py b/examples/utils/event_callback.py index 4a02c232..09c60372 100644 --- a/examples/utils/event_callback.py +++ b/examples/utils/event_callback.py @@ -1,6 +1,6 @@ import sys -from PySide2.QtGui import QColor -from PySide2.QtWidgets import QApplication +from pivy.qt.QtGui import QColor +from pivy.qt.QtWidgets import QApplication from pivy import quarter, coin diff --git a/examples/utils/interaction.py b/examples/utils/interaction.py index e168edf2..acbc9e23 100644 --- a/examples/utils/interaction.py +++ b/examples/utils/interaction.py @@ -1,6 +1,6 @@ import sys -from PySide2.QtWidgets import QApplication -from PySide2.QtGui import QColor +from pivy.qt.QtWidgets import QApplication +from pivy.qt.QtGui import QColor from pivy import quarter, coin, graphics, utils class ConnectionMarker(graphics.Marker): diff --git a/pivy/graphics/viewer.py b/pivy/graphics/viewer.py index b6415f43..3cccec01 100644 --- a/pivy/graphics/viewer.py +++ b/pivy/graphics/viewer.py @@ -1,6 +1,6 @@ from __future__ import print_function from pivy import quarter, coin -from PySide2 import QtGui, QtCore +from pivy.qt import QtGui, QtCore import tempfile class Viewer(quarter.QuarterWidget): diff --git a/pivy/gui/qt.py b/pivy/gui/qt.py index fce5a792..89b860bd 100644 --- a/pivy/gui/qt.py +++ b/pivy/gui/qt.py @@ -1,3 +1,3 @@ -from PySide2.QtCore import * -from PySide2.QtGui import * -from PySide2.QtWidgets import * \ No newline at end of file +from pivy.qt.QtCore import * +from pivy.qt.QtGui import * +from pivy.qt.QtWidgets import * \ No newline at end of file diff --git a/pivy/qt.py b/pivy/qt.py deleted file mode 100644 index 9f78a283..00000000 --- a/pivy/qt.py +++ /dev/null @@ -1,4 +0,0 @@ -try: - from PySide2 import QtCore, QtGui, QtWidgets, QtOpenGL -except ImportError: - from PySide6 import QtCore, QtGui, QtWidgets, QtOpenGL \ No newline at end of file diff --git a/pivy/qt/QtCore/__init__.py b/pivy/qt/QtCore/__init__.py index f9126d23..1d715720 100644 --- a/pivy/qt/QtCore/__init__.py +++ b/pivy/qt/QtCore/__init__.py @@ -1,4 +1,4 @@ try: - from PySide2.QtCore import * + from PySide6.QtCore import * except ImportError: - from PySide6.QtCore import * \ No newline at end of file + from PySide2.QtCore import * \ No newline at end of file diff --git a/pivy/qt/QtGui/__init__.py b/pivy/qt/QtGui/__init__.py index 1b5d159a..542117ad 100644 --- a/pivy/qt/QtGui/__init__.py +++ b/pivy/qt/QtGui/__init__.py @@ -1,4 +1,4 @@ try: - from PySide2.QtGui import * + from PySide6.QtGui import * except ImportError: - from PySide6.QtGui import * \ No newline at end of file + from PySide2.QtGui import * \ No newline at end of file diff --git a/pivy/qt/QtOpenGL/__init__.py b/pivy/qt/QtOpenGL/__init__.py index 474aa2fb..2edc0174 100644 --- a/pivy/qt/QtOpenGL/__init__.py +++ b/pivy/qt/QtOpenGL/__init__.py @@ -1,4 +1,4 @@ try: - from PySide2.QtOpenGL import * + from PySide6.QtOpenGL import * except ImportError: - from PySide6.QtOpenGL import * \ No newline at end of file + from PySide2.QtOpenGL import * \ No newline at end of file diff --git a/pivy/qt/QtWidgets/__init__.py b/pivy/qt/QtWidgets/__init__.py index e8b5eca3..0eb0db76 100644 --- a/pivy/qt/QtWidgets/__init__.py +++ b/pivy/qt/QtWidgets/__init__.py @@ -1,4 +1,4 @@ try: - from PySide2.QtWidgets import * + from PySide6.QtWidgets import * except ImportError: - from PySide6.QtWidgets import * \ No newline at end of file + from PySide2.QtWidgets import * \ No newline at end of file diff --git a/pivy/qt/__init__.py b/pivy/qt/__init__.py index e69de29b..35dbbf88 100644 --- a/pivy/qt/__init__.py +++ b/pivy/qt/__init__.py @@ -0,0 +1,4 @@ +try: + import PySide6 +except ImportError: + import PySide2 \ No newline at end of file diff --git a/pivy/quarter/ContextMenu.py b/pivy/quarter/ContextMenu.py index f45180b3..9eb4335c 100644 --- a/pivy/quarter/ContextMenu.py +++ b/pivy/quarter/ContextMenu.py @@ -14,10 +14,10 @@ # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # -from PySide2 import QtCore -from PySide2.QtCore import QObject -from PySide2.QtGui import QMouseEvent -from PySide2.QtWidgets import QMenu, QActionGroup, QAction +from pivy.qt import QtCore +from pivy.qt.QtCore import QObject +from pivy.qt.QtGui import QMouseEvent +from pivy.qt.QtWidgets import QMenu, QActionGroup, QAction from pivy import coin from pivy.coin import SoEventManager, SoScXMLStateMachine, SoRenderManager, SoGLRenderAction diff --git a/pivy/quarter/ImageReader.py b/pivy/quarter/ImageReader.py index 3b843f49..87369686 100644 --- a/pivy/quarter/ImageReader.py +++ b/pivy/quarter/ImageReader.py @@ -14,7 +14,7 @@ # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # -from PySide2.QtGui import QImage +from pivy.qt.QtGui import QImage from pivy.coin import SbImage diff --git a/pivy/quarter/QuarterWidget.py b/pivy/quarter/QuarterWidget.py index cdc58209..42131beb 100644 --- a/pivy/quarter/QuarterWidget.py +++ b/pivy/quarter/QuarterWidget.py @@ -110,7 +110,7 @@ \subpage examiner """ -from PySide2 import QtCore, QtGui, QtOpenGL +from pivy.qt import QtCore, QtGui, QtOpenGL from pivy import coin diff --git a/pivy/quarter/SensorManager.py b/pivy/quarter/SensorManager.py index cd873128..5098cb69 100644 --- a/pivy/quarter/SensorManager.py +++ b/pivy/quarter/SensorManager.py @@ -14,10 +14,10 @@ # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # -from PySide2.QtCore import QTimer -from PySide2.QtCore import QObject -from PySide2.QtCore import QThread -from PySide2.QtCore import SIGNAL +from pivy.qt.QtCore import QTimer +from pivy.qt.QtCore import QObject +from pivy.qt.QtCore import QThread +from pivy.qt.QtCore import SIGNAL from pivy.coin import SoDB from pivy.coin import SbTime diff --git a/pivy/quarter/SignalThread.py b/pivy/quarter/SignalThread.py index 1044a851..4a8a5b34 100644 --- a/pivy/quarter/SignalThread.py +++ b/pivy/quarter/SignalThread.py @@ -14,10 +14,10 @@ # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # -from PySide2.QtCore import QThread -from PySide2.QtCore import QWaitCondition -from PySide2.QtCore import QMutex -from PySide2.QtCore import SIGNAL +from pivy.qt.QtCore import QThread +from pivy.qt.QtCore import QWaitCondition +from pivy.qt.QtCore import QMutex +from pivy.qt.QtCore import SIGNAL class SignalThread(QThread): diff --git a/pivy/quarter/devices/DeviceHandler.py b/pivy/quarter/devices/DeviceHandler.py index 4b35200a..b6a1a391 100644 --- a/pivy/quarter/devices/DeviceHandler.py +++ b/pivy/quarter/devices/DeviceHandler.py @@ -14,7 +14,7 @@ # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # -from PySide2 import QtCore +from pivy.qt import QtCore from pivy import coin diff --git a/pivy/quarter/devices/DeviceManager.py b/pivy/quarter/devices/DeviceManager.py index eb4624fc..ed2708c1 100644 --- a/pivy/quarter/devices/DeviceManager.py +++ b/pivy/quarter/devices/DeviceManager.py @@ -24,8 +24,8 @@ """ from __future__ import print_function -from PySide2.QtCore import QEvent -from PySide2.QtGui import QMouseEvent +from pivy.qt.QtCore import QEvent +from pivy.qt.QtGui import QMouseEvent from pivy.coin import SoLocation2Event from pivy.coin import SbVec2s diff --git a/pivy/quarter/devices/KeyboardHandler.py b/pivy/quarter/devices/KeyboardHandler.py index a669f300..4567dd67 100644 --- a/pivy/quarter/devices/KeyboardHandler.py +++ b/pivy/quarter/devices/KeyboardHandler.py @@ -14,7 +14,7 @@ # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # -from PySide2 import QtCore +from pivy.qt import QtCore from pivy import coin diff --git a/pivy/quarter/devices/MouseHandler.py b/pivy/quarter/devices/MouseHandler.py index 3cd06776..776e6344 100644 --- a/pivy/quarter/devices/MouseHandler.py +++ b/pivy/quarter/devices/MouseHandler.py @@ -14,7 +14,7 @@ # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # -from PySide2 import QtCore, QtGui +from pivy.qt import QtCore, QtGui from pivy import coin diff --git a/pivy/quarter/eventhandlers/DragDropHandler.py b/pivy/quarter/eventhandlers/DragDropHandler.py index 34f1d0e0..ec6bc7f5 100644 --- a/pivy/quarter/eventhandlers/DragDropHandler.py +++ b/pivy/quarter/eventhandlers/DragDropHandler.py @@ -22,7 +22,7 @@ DeviceManager by default. """ -from PySide2 import QtCore +from pivy.qt import QtCore from pivy import coin from .EventHandler import EventHandler diff --git a/pivy/quarter/plugins/designer/python/PyQuarterWidgetPlugin.py b/pivy/quarter/plugins/designer/python/PyQuarterWidgetPlugin.py index fe58757b..074e53a0 100644 --- a/pivy/quarter/plugins/designer/python/PyQuarterWidgetPlugin.py +++ b/pivy/quarter/plugins/designer/python/PyQuarterWidgetPlugin.py @@ -22,7 +22,7 @@ QT_PLUGIN_PATH environment variable. """ -from PySide2 import QtGui, QtCore, QtDesigner +from pivy.qt import QtGui, QtCore, QtDesigner from pivy import coin, quarter class PyQuarterWidgetPlugin(QtDesigner.QPyDesignerCustomWidgetPlugin): diff --git a/pivy/sogui.py b/pivy/sogui.py index e03a7e12..46aee6e5 100644 --- a/pivy/sogui.py +++ b/pivy/sogui.py @@ -109,12 +109,12 @@ def __hash__(self): # if no GUI has been specified try using Quarter if not gui: try: - __import__('PySide2') + __import__('pivy.qt') quarter = __import__('pivy.quarter').quarter gui = 'Quarter' import pivy - from PySide2 import QtGui, QtCore, QtWidgets + from pivy.qt import QtGui, QtCore, QtWidgets class SoGui(object): @staticmethod diff --git a/pivy/utils.py b/pivy/utils.py index 531d7a81..88f479dc 100644 --- a/pivy/utils.py +++ b/pivy/utils.py @@ -6,7 +6,7 @@ def add_marker_from_svg(file_path, marker_name, pixel_x=10, pixel_y=None, """adds a new marker bitmap from a vector graphic (svg)""" # get an icon from the svg rendered with the given pixel - from PySide2 import QtCore, QtGui + from pivy.qt import QtCore, QtGui pixel_y = pixel_y or pixel_x icon = QtGui.QIcon(file_path) icon = QtGui.QBitmap(icon.pixmap(pixel_x, pixel_y)) diff --git a/tests/pyside_test.py b/tests/pyside_test.py index 085dd14b..4f17346b 100644 --- a/tests/pyside_test.py +++ b/tests/pyside_test.py @@ -1,6 +1,6 @@ from __future__ import print_function import unittest -from PySide2 import QtCore +from pivy.qt import QtCore import shiboken2 as wrapper diff --git a/tests/visual_test.py b/tests/visual_test.py index 58cd7197..bdf86f04 100644 --- a/tests/visual_test.py +++ b/tests/visual_test.py @@ -1,6 +1,6 @@ import sys -from PySide2 import QtWidgets +from pivy.qt import QtWidgets from pivy import coin, quarter