Skip to content

Commit

Permalink
qt6 / py312 porting
Browse files Browse the repository at this point in the history
  • Loading branch information
looooo committed Nov 26, 2023
1 parent 809d38f commit 6a9ae54
Show file tree
Hide file tree
Showing 39 changed files with 111 additions and 73 deletions.
13 changes: 7 additions & 6 deletions .github/workflows/test-env-action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,26 @@ jobs:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
python-version: ["3.8", "3.9", "3.10"]
python-version: ["3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v2
name: Checkout

- uses: conda-incubator/setup-miniconda@v2
with:
python-version: ${{ matrix.python-version }}
auto-activate-base: true
activate-environment: test
python-version: "3.11"

- name: install packages
- name: install conda build
run: |
conda install flake8 conda-build
conda install conda-build
- if: matrix.os == 'ubuntu-latest'
name: Lint with flake8
run: |
conda install flake8
sudo apt-get install freeglut3 freeglut3-dev
sudo ln -s /usr/lib/x86_64-linux-gnu/ /usr/lib64
${CONDA}/bin/flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics --exclude=.svn,CVS,.bzr,.hg,.git,__pycache__,.tox,.eggs,*.egg,scons,SoPyScript
- name: create package with conda
Expand Down
7 changes: 6 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ project(pivy)


option(DISABLE_SWIG_WARNINGS "if on no swig warnings are shown" OFF)
option(PIVY_USE_QT6 "Prefer Qt6 over Qt5 if available" OFF)

find_package(SWIG 4.0.0 REQUIRED)
include(${SWIG_USE_FILE})
Expand All @@ -11,7 +12,11 @@ find_package(Coin CONFIG REQUIRED)
find_package(SoQt CONFIG)

if (SoQt_FOUND)
find_package(Qt5 COMPONENTS Core Widgets Gui REQUIRED)
if (PIVY_USE_QT6)
find_package(Qt6 COMPONENTS Core Widgets Gui REQUIRED)
else (PIVY_USE_QT6)
find_package(Qt5 COMPONENTS Core Widgets Gui REQUIRED)
endif (PIVY_USE_QT6)
endif()

find_package(Python REQUIRED COMPONENTS Interpreter Development)
Expand Down
4 changes: 2 additions & 2 deletions examples/Mentor/10.2.setEventCB.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions examples/QtDesigner/python/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__":
Expand Down
10 changes: 5 additions & 5 deletions examples/QtDesigner/python/mainwindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion examples/QtDesigner/python/ui_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
4 changes: 2 additions & 2 deletions examples/Quarter/mdi.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion examples/Quarter/minimal.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions examples/examiner_embed4.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion examples/soqt/renderAreaCallback.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion examples/utils/GlClipPlane.py
Original file line number Diff line number Diff line change
@@ -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 *

Expand Down
4 changes: 2 additions & 2 deletions examples/utils/event_callback.py
Original file line number Diff line number Diff line change
@@ -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


Expand Down
4 changes: 2 additions & 2 deletions examples/utils/interaction.py
Original file line number Diff line number Diff line change
@@ -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):
Expand Down
3 changes: 2 additions & 1 deletion packaging/conda/bld.bat
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ cmake -G "Ninja" ^
-D CMAKE_BUILD_TYPE="Release" ^
-D CMAKE_INSTALL_PREFIX:FILEPATH=%LIBRARY_PREFIX% ^
-D Python_EXECUTABLE:FILEPATH=%PREFIX%/python ^
-D PIVY_USE_QT6:BOOL=%USE_QT6% ^
..


ninja install
ninja install
7 changes: 5 additions & 2 deletions packaging/conda/build.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
mkdir -p build
cd build

if [[ ${HOST} =~ .*linux.* ]]; then
echo "USE_QT6 is set ${USE_QT6}"

if [[ ${HOST} =~ .*linux.* && ${USE_QT6} = "0" ]]; then
sed -i 's|_qt5gui_find_extra_libs(EGL.*)|_qt5gui_find_extra_libs(EGL "EGL" "" "")|g' $PREFIX/lib/cmake/Qt5Gui/Qt5GuiConfigExtras.cmake
sed -i 's|_qt5gui_find_extra_libs(OPENGL.*)|_qt5gui_find_extra_libs(OPENGL "GL" "" "")|g' $PREFIX/lib/cmake/Qt5Gui/Qt5GuiConfigExtras.cmake
fi
Expand All @@ -12,6 +14,7 @@ cmake -G "Ninja" \
-D CMAKE_BUILD_TYPE="Release" \
-D CMAKE_INSTALL_PREFIX:FILEPATH=$PREFIX \
-D Python_EXECUTABLE:FILEPATH=$PREFIX/bin/python \
-D PIVY_USE_QT6:BOOL=$USE_QT6 \
..

ninja install
ninja install
24 changes: 16 additions & 8 deletions packaging/conda/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
package:
name: pivy
version: "master"
name: pivy
version: "master"

build:
number: 0
number: 0
script_env:
- USE_QT6=1 # [py >= 312]
- USE_QT6=0 # [py < 312]

source:
path: ../../
Expand All @@ -19,14 +22,19 @@ requirements:
host:
- python
- coin3d
- soqt
- qt
- soqt # [py < 312]
- qt-main # [py < 312]
- soqt6 # [py >= 312]
- qt6-main # [py >= 312]
run:
- python
- coin3d
- qt
- pyside2
- soqt
- qt-main # [py < 312]
- soqt # [py < 312]
- pyside2 # [py < 312]
- qt6-main # [py >= 312]
- soqt6 # [py >= 312]
- pyside6 # [py >= 312]

test:
source-files:
Expand Down
2 changes: 1 addition & 1 deletion pivy/graphics/viewer.py
Original file line number Diff line number Diff line change
@@ -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):
Expand Down
6 changes: 3 additions & 3 deletions pivy/gui/qt.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from PySide2.QtCore import *
from PySide2.QtGui import *
from PySide2.QtWidgets import *
from pivy.qt.QtCore import *
from pivy.qt.QtGui import *
from pivy.qt.QtWidgets import *
2 changes: 1 addition & 1 deletion pivy/pivy_meta.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.6.8"
__version__ = "0.6.9"
4 changes: 4 additions & 0 deletions pivy/qt/QtCore/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
try:
from PySide6.QtCore import *
except ImportError:
from PySide2.QtCore import *
4 changes: 4 additions & 0 deletions pivy/qt/QtGui/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
try:
from PySide6.QtGui import *
except ImportError:
from PySide2.QtGui import *
4 changes: 4 additions & 0 deletions pivy/qt/QtOpenGL/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
try:
from PySide6.QtOpenGL import *
except ImportError:
from PySide2.QtOpenGL import *
4 changes: 4 additions & 0 deletions pivy/qt/QtWidgets/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
try:
from PySide6.QtWidgets import *
except ImportError:
from PySide2.QtWidgets import *
4 changes: 4 additions & 0 deletions pivy/qt/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
try:
import PySide6
except ImportError:
import PySide2
8 changes: 4 additions & 4 deletions pivy/quarter/ContextMenu.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pivy/quarter/ImageReader.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
2 changes: 1 addition & 1 deletion pivy/quarter/QuarterWidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
\subpage examiner
"""

from PySide2 import QtCore, QtGui, QtOpenGL
from pivy.qt import QtCore, QtGui, QtOpenGL

from pivy import coin

Expand Down
8 changes: 4 additions & 4 deletions pivy/quarter/SensorManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions pivy/quarter/SignalThread.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion pivy/quarter/devices/DeviceHandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions pivy/quarter/devices/DeviceManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion pivy/quarter/devices/KeyboardHandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion pivy/quarter/devices/MouseHandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Loading

0 comments on commit 6a9ae54

Please sign in to comment.