Skip to content

Commit

Permalink
Search/replace Qt5->Qt6 and import from QtOpenGL where needed.
Browse files Browse the repository at this point in the history
part of upgrading Qt to v6.2: CURA-8591
  • Loading branch information
rburema committed Dec 28, 2021
1 parent 3b3d48f commit 5392494
Show file tree
Hide file tree
Showing 88 changed files with 141 additions and 137 deletions.
2 changes: 1 addition & 1 deletion UM/CentralFileStorage.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import os.path # To re-format files with their proper file extension but with a version number in between.
import shutil # To move files in constant-time.
from typing import List, Tuple, Dict
from PyQt5.QtCore import QCoreApplication
from PyQt6.QtCore import QCoreApplication

from UM.Logger import Logger
from UM.Resources import Resources # To get the central storage location.
Expand Down
2 changes: 1 addition & 1 deletion UM/ConfigurationErrorMessage.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import sys
from typing import Iterable, Union, Optional

from PyQt5.QtWidgets import QMessageBox
from PyQt6.QtWidgets import QMessageBox

from UM.i18n import i18nCatalog
from UM.Message import Message
Expand Down
2 changes: 1 addition & 1 deletion UM/FileHandler/FileHandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from .FileReader import FileReader
from .FileWriter import FileWriter
from PyQt5.QtCore import QFileInfo, QObject, pyqtProperty, pyqtSlot, QUrl
from PyQt6.QtCore import QFileInfo, QObject, pyqtProperty, pyqtSlot, QUrl

from UM.Logger import Logger
from UM.Platform import Platform
Expand Down
2 changes: 1 addition & 1 deletion UM/FileProvider.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright (c) 2021 Ultimaker B.V.
# Uranium is released under the terms of the LGPLv3 or higher.

from PyQt5.QtCore import pyqtSignal, QObject
from PyQt6.QtCore import pyqtSignal, QObject

from UM.PluginObject import PluginObject
from typing import Optional
Expand Down
10 changes: 5 additions & 5 deletions UM/FlameProfiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import functools
from typing import List, Callable, Any

from PyQt5.QtCore import pyqtSlot as pyqt5PyqtSlot
from PyQt6.QtCore import pyqtSlot as PyQt6PyqtSlot
from UM.Logger import Logger
# A simple profiler which produces data suitable for viewing as a flame graph
# when using the Big Flame Graph plugin.
Expand Down Expand Up @@ -215,9 +215,9 @@ def runIt(*args, ** kwargs):


def pyqtSlot(*args, **kwargs) -> Callable[..., Any]:
"""Drop in replacement for PyQt5's pyqtSlot decorator which records profiling information.
"""Drop in replacement for PyQt6's pyqtSlot decorator which records profiling information.
See the PyQt5 documentation for information about pyqtSlot.
See the PyQt6 documentation for information about pyqtSlot.
"""

if enabled():
Expand All @@ -230,9 +230,9 @@ def wrapped(*args2, **kwargs2):
else:
return function(*args2, **kwargs2)

return pyqt5PyqtSlot(*args, **kwargs)(wrapped)
return PyQt6PyqtSlot(*args, **kwargs)(wrapped)
return wrapIt
else:
def dontWrapIt(function):
return pyqt5PyqtSlot(*args, **kwargs)(function)
return PyQt6PyqtSlot(*args, **kwargs)(function)
return dontWrapIt
2 changes: 1 addition & 1 deletion UM/Mesh/MeshFileHandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Uranium is released under the terms of the LGPLv3 or higher.

import os
from PyQt5.QtCore import QObject, QUrl # For typing.
from PyQt6.QtCore import QObject, QUrl # For typing.

from UM.Logger import Logger
from UM.Math.Matrix import Matrix
Expand Down
2 changes: 1 addition & 1 deletion UM/Message.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from enum import IntEnum
from typing import Optional, Union, Dict, List

from PyQt5.QtCore import QTimer, pyqtSignal, QObject
from PyQt6.QtCore import QTimer, pyqtSignal, QObject

from UM.Logger import Logger
from UM.Signal import Signal, signalemitter
Expand Down
2 changes: 1 addition & 1 deletion UM/MimeTypeDatabase.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Uranium is released under the terms of the LGPLv3 or higher.

import os.path
from PyQt5.QtCore import QMimeDatabase, QMimeType
from PyQt6.QtCore import QMimeDatabase, QMimeType
from typing import cast, List, Optional


Expand Down
2 changes: 1 addition & 1 deletion UM/OutputDevice/ProjectOutputDevice.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from typing import Optional

from PyQt5.QtCore import pyqtSignal, QObject
from PyQt6.QtCore import pyqtSignal, QObject

from UM.Application import Application
from UM.OutputDevice.OutputDevice import OutputDevice
Expand Down
2 changes: 1 addition & 1 deletion UM/PackageManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from json import JSONDecodeError
from typing import Any, Dict, List, Optional, Set, Tuple, cast, TYPE_CHECKING

from PyQt5.QtCore import pyqtSlot, QObject, pyqtSignal, QUrl, pyqtProperty, QCoreApplication
from PyQt6.QtCore import pyqtSlot, QObject, pyqtSignal, QUrl, pyqtProperty, QCoreApplication

from UM import i18nCatalog
from UM.Logger import Logger
Expand Down
4 changes: 2 additions & 2 deletions UM/PluginRegistry.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
import zipfile
from typing import Any, Callable, Dict, List, Optional, Tuple, TYPE_CHECKING

from PyQt5.QtCore import QCoreApplication
from PyQt5.QtCore import QObject, pyqtSlot, QUrl, pyqtProperty, pyqtSignal
from PyQt6.QtCore import QCoreApplication
from PyQt6.QtCore import QObject, pyqtSlot, QUrl, pyqtProperty, pyqtSignal

from UM.CentralFileStorage import CentralFileStorage
from UM.Logger import Logger
Expand Down
2 changes: 1 addition & 1 deletion UM/Qt/Bindings/ActiveToolProxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Uranium is released under the terms of the LGPLv3 or higher.

from typing import Any
from PyQt5.QtCore import pyqtSlot, pyqtProperty, pyqtSignal, QObject, QUrl, QVariant
from PyQt6.QtCore import pyqtSlot, pyqtProperty, pyqtSignal, QObject, QUrl, QVariant

from UM.Application import Application
from UM.Logger import Logger
Expand Down
2 changes: 1 addition & 1 deletion UM/Qt/Bindings/ApplicationProxy.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright (c) 2015 Ultimaker B.V.
# Uranium is released under the terms of the LGPLv3 or higher.

from PyQt5.QtCore import QObject, pyqtSlot, pyqtProperty, pyqtSignal
from PyQt6.QtCore import QObject, pyqtSlot, pyqtProperty, pyqtSignal

from UM.Application import Application
from UM.Logger import Logger
Expand Down
2 changes: 1 addition & 1 deletion UM/Qt/Bindings/BackendProxy.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright (c) 2015 Ultimaker B.V.
# Uranium is released under the terms of the LGPLv3 or higher.

from PyQt5.QtCore import QObject, pyqtSignal, pyqtProperty, Q_ENUMS
from PyQt6.QtCore import QObject, pyqtSignal, pyqtProperty, Q_ENUMS

from UM.i18n import i18nCatalog
from UM.Application import Application
Expand Down
2 changes: 1 addition & 1 deletion UM/Qt/Bindings/Bindings.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright (c) 2015 Ultimaker B.V.
# Uranium is released under the terms of the LGPLv3 or higher.

from PyQt5.QtQml import qmlRegisterType, qmlRegisterSingletonType, qmlRegisterUncreatableType
from PyQt6.QtQml import qmlRegisterType, qmlRegisterSingletonType, qmlRegisterUncreatableType

from UM.Qt.Bindings import StageModel, FileProviderModel, ProjectOutputDevicesModel
from UM.Qt.Duration import Duration, DurationFormat
Expand Down
2 changes: 1 addition & 1 deletion UM/Qt/Bindings/ContainerProxy.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from PyQt5.QtCore import QObject
from PyQt6.QtCore import QObject
from UM.FlameProfiler import pyqtSlot
from typing import Dict, Any, Optional

Expand Down
2 changes: 1 addition & 1 deletion UM/Qt/Bindings/ControllerProxy.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright (c) 2015 Ultimaker B.V.
# Uranium is released under the terms of the LGPLv3 or higher.

from PyQt5.QtCore import QObject, pyqtSlot, pyqtSignal, pyqtProperty
from PyQt6.QtCore import QObject, pyqtSlot, pyqtSignal, pyqtProperty

from UM.Application import Application
from UM.Decorators import deprecated
Expand Down
2 changes: 1 addition & 1 deletion UM/Qt/Bindings/ExtensionModel.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright (c) 2020 Ultimaker B.V.
# Uranium is released under the terms of the LGPLv3 or higher.

from PyQt5.QtCore import Qt
from PyQt6.QtCore import Qt
from UM.FlameProfiler import pyqtSlot
from UM.Application import Application
from UM.Qt.ListModel import ListModel
Expand Down
2 changes: 1 addition & 1 deletion UM/Qt/Bindings/FileProviderModel.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from typing import Callable, Optional

from PyQt5.QtCore import Qt
from PyQt6.QtCore import Qt
from UM.FlameProfiler import pyqtSlot
from UM.i18n import i18nCatalog
from UM.Qt.ListModel import ListModel
Expand Down
6 changes: 3 additions & 3 deletions UM/Qt/Bindings/MainWindow.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Copyright (c) 2020 Ultimaker B.V.
# Uranium is released under the terms of the LGPLv3 or higher.

from PyQt5.QtCore import pyqtProperty, Qt, QCoreApplication, pyqtSignal, pyqtSlot, QMetaObject, QRectF, QRect
from PyQt5.QtGui import QColor
from PyQt5.QtQuick import QQuickWindow
from PyQt6.QtCore import pyqtProperty, Qt, QCoreApplication, pyqtSignal, pyqtSlot, QMetaObject, QRectF, QRect
from PyQt6.QtGui import QColor
from PyQt6.QtQuick import QQuickWindow

from UM.Logger import Logger
from UM.Math.Matrix import Matrix
Expand Down
2 changes: 1 addition & 1 deletion UM/Qt/Bindings/OpenGLContextProxy.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright (c) 2017 Ultimaker B.V.
# Uranium is released under the terms of the LGPLv3 or higher.

from PyQt5.QtCore import QObject, pyqtProperty, pyqtSignal
from PyQt6.QtCore import QObject, pyqtProperty, pyqtSignal
from UM.View.GL.OpenGLContext import OpenGLContext


Expand Down
2 changes: 1 addition & 1 deletion UM/Qt/Bindings/OperationStackProxy.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright (c) 2015 Ultimaker B.V.
# Uranium is released under the terms of the LGPLv3 or higher.

from PyQt5.QtCore import QObject, pyqtSlot, pyqtProperty, pyqtSignal
from PyQt6.QtCore import QObject, pyqtSlot, pyqtProperty, pyqtSignal

from UM.Application import Application

Expand Down
4 changes: 2 additions & 2 deletions UM/Qt/Bindings/OutputDeviceManagerProxy.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright (c) 2018 Ultimaker B.V.
# Uranium is released under the terms of the LGPLv3 or higher.

from PyQt5.QtCore import QObject, pyqtProperty, pyqtSignal, pyqtSlot
from PyQt6.QtCore import QObject, pyqtProperty, pyqtSignal, pyqtSlot
from typing import List, Mapping, Optional, TYPE_CHECKING

from UM.Application import Application
Expand All @@ -14,7 +14,7 @@
from UM.Scene.Selection import Selection

if TYPE_CHECKING:
from PyQt5.QtQml import QQmlEngine, QJSEngine
from PyQt6.QtQml import QQmlEngine, QJSEngine
from UM.FileHandler.FileHandler import FileHandler
from UM.OutputDevice.OutputDeviceManager import OutputDeviceManager

Expand Down
4 changes: 2 additions & 2 deletions UM/Qt/Bindings/OutputDevicesModel.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Copyright (c) 2020 Ultimaker B.V.
# Uranium is released under the terms of the LGPLv3 or higher.

from PyQt5.QtCore import Qt, pyqtSlot, pyqtProperty, pyqtSignal
from PyQt6.QtCore import Qt, pyqtSlot, pyqtProperty, pyqtSignal

from UM.Application import Application
from UM.Qt.ListModel import ListModel

from PyQt5.QtQml import QQmlEngine
from PyQt6.QtQml import QQmlEngine


class OutputDevicesModel(ListModel):
Expand Down
8 changes: 4 additions & 4 deletions UM/Qt/Bindings/PointingRectangle.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Copyright (c) 2015 Ultimaker B.V.
# Uranium is released under the terms of the LGPLv3 or higher.

from PyQt5.QtCore import pyqtProperty, pyqtSignal
from PyQt5.QtCore import QPoint
from PyQt5.QtGui import QColor
from PyQt5.QtQuick import QQuickItem, QSGGeometryNode, QSGGeometry, QSGFlatColorMaterial
from PyQt6.QtCore import pyqtProperty, pyqtSignal
from PyQt6.QtCore import QPoint
from PyQt6.QtGui import QColor
from PyQt6.QtQuick import QQuickItem, QSGGeometryNode, QSGGeometry, QSGFlatColorMaterial


class PointingRectangle(QQuickItem):
Expand Down
2 changes: 1 addition & 1 deletion UM/Qt/Bindings/PreferencesProxy.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright (c) 2018 Ultimaker B.V.
# Uranium is released under the terms of the LGPLv3 or higher.

from PyQt5.QtCore import QObject, pyqtSlot, pyqtSignal
from PyQt6.QtCore import QObject, pyqtSlot, pyqtSignal

from UM.Application import Application

Expand Down
4 changes: 2 additions & 2 deletions UM/Qt/Bindings/ProjectOutputDevicesModel.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
# Uranium is released under the terms of the LGPLv3 or higher.
from typing import List

from PyQt5.QtCore import Qt, pyqtSignal
from PyQt5.QtQml import QQmlEngine
from PyQt6.QtCore import Qt, pyqtSignal
from PyQt6.QtQml import QQmlEngine

from UM.Application import Application
from UM.OutputDevice.OutputDeviceManager import OutputDeviceManager
Expand Down
2 changes: 1 addition & 1 deletion UM/Qt/Bindings/ResourcesProxy.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright (c) 2015 Ultimaker B.V.
# Uranium is released under the terms of the LGPLv3 or higher.

from PyQt5.QtCore import QObject, QUrl, Q_ENUMS
from PyQt6.QtCore import QObject, QUrl, Q_ENUMS
from UM.FlameProfiler import pyqtSlot

import UM.Resources
Expand Down
2 changes: 1 addition & 1 deletion UM/Qt/Bindings/SelectionProxy.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright (c) 2017 Ultimaker B.V.
# Uranium is released under the terms of the LGPLv3 or higher.

from PyQt5.QtCore import QObject, pyqtSignal, pyqtProperty, pyqtSlot
from PyQt6.QtCore import QObject, pyqtSignal, pyqtProperty, pyqtSlot

from UM.Application import Application
from UM.Scene.Selection import Selection
Expand Down
2 changes: 1 addition & 1 deletion UM/Qt/Bindings/StageModel.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Copyright (c) 2017 Ultimaker B.V.
# Uranium is released under the terms of the LGPLv3 or higher.
from PyQt5.QtCore import Qt
from PyQt6.QtCore import Qt

from UM.Application import Application
from UM.PluginRegistry import PluginRegistry
Expand Down
6 changes: 3 additions & 3 deletions UM/Qt/Bindings/Theme.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
import warnings
from typing import Dict, Optional, List

from PyQt5.QtCore import QObject, pyqtProperty, pyqtSignal, QCoreApplication, QUrl, QSizeF
from PyQt5.QtGui import QColor, QFont, QFontMetrics, QFontDatabase
from PyQt5.QtQml import QQmlComponent, QQmlContext
from PyQt6.QtCore import QObject, pyqtProperty, pyqtSignal, QCoreApplication, QUrl, QSizeF
from PyQt6.QtGui import QColor, QFont, QFontMetrics, QFontDatabase
from PyQt6.QtQml import QQmlComponent, QQmlContext

import UM.Application
from UM.FlameProfiler import pyqtSlot
Expand Down
4 changes: 2 additions & 2 deletions UM/Qt/Bindings/ToolModel.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Copyright (c) 2018 Ultimaker B.V.
# Uranium is released under the terms of the LGPLv3 or higher.

from PyQt5.QtCore import Qt
from PyQt5.QtGui import QKeySequence
from PyQt6.QtCore import Qt
from PyQt6.QtGui import QKeySequence

from UM.Application import Application

Expand Down
6 changes: 3 additions & 3 deletions UM/Qt/Bindings/Utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
from typing import List, TYPE_CHECKING
from urllib.parse import urlparse

from PyQt5.QtCore import pyqtSlot, QUrl, QObject
from PyQt5.QtGui import QDesktopServices
from PyQt6.QtCore import pyqtSlot, QUrl, QObject
from PyQt6.QtGui import QDesktopServices

from UM.Logger import Logger

if TYPE_CHECKING:
from PyQt5.QtQml import QQmlEngine, QJSEngine
from PyQt6.QtQml import QQmlEngine, QJSEngine


class UrlUtil(QObject):
Expand Down
2 changes: 1 addition & 1 deletion UM/Qt/Bindings/ViewModel.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright (c) 2018 Ultimaker B.V.
# Uranium is released under the terms of the LGPLv3 or higher.

from PyQt5.QtCore import Qt
from PyQt6.QtCore import Qt

from UM.Qt.ListModel import ListModel
from UM.Application import Application
Expand Down
2 changes: 1 addition & 1 deletion UM/Qt/Bindings/VisibleMessagesModel.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Uranium is released under the terms of the LGPLv3 or higher.
from typing import Union

from PyQt5.QtCore import Qt, QUrl
from PyQt6.QtCore import Qt, QUrl

from UM.Application import Application
from UM.FlameProfiler import pyqtSlot
Expand Down
4 changes: 2 additions & 2 deletions UM/Qt/Bindings/i18nCatalogProxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

import inspect

from PyQt5.QtCore import pyqtProperty, pyqtSignal, QObject, QCoreApplication, pyqtSlot
from PyQt5.QtQml import QJSValue
from PyQt6.QtCore import pyqtProperty, pyqtSignal, QObject, QCoreApplication, pyqtSlot
from PyQt6.QtQml import QJSValue

from UM.i18n import i18nCatalog

Expand Down
2 changes: 1 addition & 1 deletion UM/Qt/Duration.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Uranium is released under the terms of the LGPLv3 or higher.
from typing import Optional

from PyQt5.QtCore import QObject, pyqtProperty, Q_ENUMS, pyqtSignal
from PyQt6.QtCore import QObject, pyqtProperty, Q_ENUMS, pyqtSignal
from UM.FlameProfiler import pyqtSlot

from datetime import timedelta
Expand Down
Loading

0 comments on commit 5392494

Please sign in to comment.