[qt6] Replace all PySide2/shiboken2 imports by PySide6/shiboken6

This commit is contained in:
Candice Bentéjac 2024-10-01 12:18:17 +02:00
parent f07c92472b
commit 579371fd7c
17 changed files with 40 additions and 40 deletions

View file

@ -15,7 +15,7 @@ Meshroom is licensed under the [MPL2 license](LICENSE-MPL2.md).
Copyright (c) 2001-2018 Python Software Foundation.
Distributed under the [PSFL V2 license](https://www.python.org/download/releases/2.7/license/).
* __Qt/PySide2__
* __Qt/PySide6__
[https://www.qt.io](https://www.qt.io)
Copyright (C) 2018 The Qt Company Ltd and other contributors.
Distributed under the [LGPL V3 license](https://opensource.org/licenses/LGPL-3.0).

View file

@ -1,5 +1,5 @@
from PySide2 import QtCore, QtQml
import shiboken2
from PySide6 import QtCore, QtQml
import shiboken6
class QObjectListModel(QtCore.QAbstractListModel):
@ -285,7 +285,7 @@ class QObjectListModel(QtCore.QAbstractListModel):
def _dereferenceItem(self, item):
# Ask for object deletion if parented to the model
if shiboken2.isValid(item) and item.parent() == self:
if shiboken6.isValid(item) and item.parent() == self:
# delay deletion until the next event loop
# This avoids warnings when the QML engine tries to evaluate (but should not)
# an object that has already been deleted

View file

@ -4,10 +4,10 @@ import re
import argparse
import json
from PySide2 import QtCore
from PySide2.QtCore import Qt, QUrl, QJsonValue, qInstallMessageHandler, QtMsgType, QSettings
from PySide2.QtGui import QIcon
from PySide2.QtWidgets import QApplication
from PySide6 import QtCore
from PySide6.QtCore import Qt, QUrl, QJsonValue, qInstallMessageHandler, QtMsgType, QSettings
from PySide6.QtGui import QIcon
from PySide6.QtWidgets import QApplication
import meshroom
from meshroom.core import nodesDesc
@ -188,7 +188,7 @@ class MeshroomApp(QApplication):
def __init__(self, args):
meshroom.core.initPipelines()
QtArgs = [args[0], '-style', 'fusion'] + args[1:] # force Fusion style by default
QtArgs = [args[0], '-style', 'Fusion'] + args[1:] # force Fusion style by default
args = createMeshroomParser(args)

View file

@ -2,8 +2,8 @@ import logging
import traceback
from contextlib import contextmanager
from PySide2.QtWidgets import QUndoCommand, QUndoStack
from PySide2.QtCore import Property, Signal
from PySide6.QtGui import QUndoCommand, QUndoStack
from PySide6.QtCore import Property, Signal
from meshroom.core.attribute import ListAttribute, Attribute
from meshroom.core.graph import GraphModification

View file

@ -1,6 +1,6 @@
def registerTypes():
from PySide2.QtQml import qmlRegisterType
from PySide6.QtQml import qmlRegisterType
from meshroom.ui.components.clipboard import ClipboardHelper
from meshroom.ui.components.edge import EdgeMouseArea
from meshroom.ui.components.filepath import FilepathHelper

View file

@ -1,5 +1,5 @@
from PySide2.QtCore import Slot, QObject
from PySide2.QtGui import QClipboard
from PySide6.QtCore import Slot, QObject
from PySide6.QtGui import QClipboard
class ClipboardHelper(QObject):

View file

@ -1,7 +1,7 @@
from meshroom.common.qt import QObjectListModel
from PySide2.QtCore import QObject, Slot, Signal, Property
from PySide2.QtCharts import QtCharts
from PySide6.QtCore import QObject, Slot, Signal, Property
from PySide6 import QtCharts
import csv
import os

View file

@ -1,6 +1,6 @@
from PySide2.QtCore import Signal, Property, QPointF, Qt, QObject
from PySide2.QtGui import QPainterPath, QVector2D
from PySide2.QtQuick import QQuickItem
from PySide6.QtCore import Signal, Property, QPointF, Qt, QObject
from PySide6.QtGui import QPainterPath, QVector2D
from PySide6.QtQuick import QQuickItem
class MouseEvent(QObject):

View file

@ -1,7 +1,7 @@
#!/usr/bin/env python
# coding:utf-8
from PySide2.QtCore import QUrl, QFileInfo
from PySide2.QtCore import QObject, Slot
from PySide6.QtCore import QUrl, QFileInfo
from PySide6.QtCore import QObject, Slot
import os
import glob

View file

@ -1,9 +1,9 @@
from math import acos, pi, sqrt, atan2, cos, sin, asin
from PySide2.QtCore import QObject, Slot, QSize, Signal, QPointF
from PySide2.Qt3DCore import Qt3DCore
from PySide2.Qt3DRender import Qt3DRender
from PySide2.QtGui import QVector3D, QQuaternion, QVector2D, QVector4D, QMatrix4x4
from PySide6.QtCore import QObject, Slot, QSize, Signal, QPointF
from PySide6.Qt3DCore import Qt3DCore
from PySide6.Qt3DRender import Qt3DRender
from PySide6.QtGui import QVector3D, QQuaternion, QVector2D, QVector4D, QMatrix4x4
from meshroom.ui.utils import makeProperty

View file

@ -1,4 +1,4 @@
from PySide2.QtCore import QObject, Slot
from PySide6.QtCore import QObject, Slot
from io import StringIO
from contextlib import redirect_stdout

View file

@ -1,7 +1,7 @@
from meshroom.common import Signal
from PySide2.QtCore import QObject, Slot, QSize, QUrl, Qt, QStandardPaths
from PySide2.QtGui import QImageReader, QImageWriter
from PySide6.QtCore import QObject, Slot, QSize, QUrl, Qt, QStandardPaths
from PySide6.QtGui import QImageReader, QImageWriter
import os
from pathlib import Path

View file

@ -8,7 +8,7 @@ from enum import Enum
from threading import Thread, Event, Lock
from multiprocessing.pool import ThreadPool
from PySide2.QtCore import Slot, QJsonValue, QObject, QUrl, Property, Signal, QPoint
from PySide6.QtCore import Slot, QJsonValue, QObject, QUrl, Property, Signal, QPoint
from meshroom.core import sessionUid
from meshroom.common.qt import QObjectListModel

View file

@ -1,6 +1,6 @@
from PySide2.QtCore import QObject, Qt, Slot, Property, Signal
from PySide2.QtGui import QPalette, QColor
from PySide2.QtWidgets import QApplication
from PySide6.QtCore import QObject, Qt, Slot, Property, Signal
from PySide6.QtGui import QPalette, QColor
from PySide6.QtWidgets import QApplication
class PaletteManager(QObject):

View file

@ -6,8 +6,8 @@ from collections.abc import Iterable
from multiprocessing.pool import ThreadPool
from threading import Thread
from PySide2.QtCore import QObject, Slot, Property, Signal, QUrl, QSizeF, QPoint
from PySide2.QtGui import QMatrix4x4, QMatrix3x3, QQuaternion, QVector3D, QVector2D
from PySide6.QtCore import QObject, Slot, Property, Signal, QUrl, QSizeF, QPoint
from PySide6.QtGui import QMatrix4x4, QMatrix3x3, QQuaternion, QVector3D, QVector2D
import meshroom.core
import meshroom.common

View file

@ -1,12 +1,12 @@
import os
import time
from PySide2.QtCore import QFileSystemWatcher, QUrl, Slot, QTimer, Property, QObject
from PySide2.QtQml import QQmlApplicationEngine
from PySide6.QtCore import QFileSystemWatcher, QUrl, Slot, QTimer, Property, QObject
from PySide6.QtQml import QQmlApplicationEngine
try:
from PySide2 import shiboken2
from PySide6 import shiboken6
except Exception:
import shiboken2
import shiboken6
class QmlInstantEngine(QQmlApplicationEngine):
@ -237,7 +237,7 @@ def makeProperty(T, attributeName, notify=None, resetOnDestroy=False):
setattr(instance, resetCallbackName, lambda self=instance, *args: setter(self, None))
resetCallback = getattr(instance, resetCallbackName, None)
if resetCallback and currentValue and shiboken2.isValid(currentValue):
if resetCallback and currentValue and shiboken6.isValid(currentValue):
currentValue.destroyed.disconnect(resetCallback)
setattr(instance, attributeName, value)
if resetCallback and value:

View file

@ -1,6 +1,6 @@
import pytest
from PySide2.QtCore import QObject, Property
from PySide6.QtCore import QObject, Property
from meshroom.common.core import CoreDictModel
from meshroom.common.qt import QObjectListModel, QTypedObjectListModel