Qt5->Qt6: Replace QT_ENUMS with pyqtEnum.

part of CURA-8591
This commit is contained in:
Remco Burema 2021-12-28 14:59:25 +01:00
parent 32b52c6166
commit 7021ff0b67
No known key found for this signature in database
GPG key ID: 215C49431D43F98C
3 changed files with 10 additions and 10 deletions

View file

@ -1,8 +1,8 @@
# Copyright (c) 2021 Ultimaker B.V. # Copyright (c) 2021 Ultimaker B.V.
# Cura is released under the terms of the LGPLv3 or higher. # Cura is released under the terms of the LGPLv3 or higher.
import enum
from datetime import datetime from datetime import datetime
from PyQt6.QtCore import QObject, pyqtSignal, pyqtSlot, pyqtProperty, QTimer, Q_ENUMS from PyQt6.QtCore import QObject, pyqtSignal, pyqtSlot, pyqtProperty, QTimer, pyqtEnum
from typing import Any, Optional, Dict, TYPE_CHECKING, Callable from typing import Any, Optional, Dict, TYPE_CHECKING, Callable
from UM.Logger import Logger from UM.Logger import Logger
@ -18,7 +18,7 @@ if TYPE_CHECKING:
i18n_catalog = i18nCatalog("cura") i18n_catalog = i18nCatalog("cura")
class SyncState: class SyncState(enum.IntEnum):
"""QML: Cura.AccountSyncState""" """QML: Cura.AccountSyncState"""
SYNCING = 0 SYNCING = 0
SUCCESS = 1 SUCCESS = 1
@ -41,7 +41,7 @@ class Account(QObject):
# The interval in which sync services are automatically triggered # The interval in which sync services are automatically triggered
SYNC_INTERVAL = 60.0 # seconds SYNC_INTERVAL = 60.0 # seconds
Q_ENUMS(SyncState) pyqtEnum(SyncState)
loginStateChanged = pyqtSignal(bool) loginStateChanged = pyqtSignal(bool)
"""Signal emitted when user logged in or out""" """Signal emitted when user logged in or out"""

View file

@ -1,6 +1,6 @@
# Copyright (c) 2021 Ultimaker B.V. # Copyright (c) 2021 Ultimaker B.V.
# Cura is released under the terms of the LGPLv3 or higher. # Cura is released under the terms of the LGPLv3 or higher.
import enum
import os import os
import sys import sys
import tempfile import tempfile
@ -8,7 +8,7 @@ import time
from typing import cast, TYPE_CHECKING, Optional, Callable, List, Any, Dict from typing import cast, TYPE_CHECKING, Optional, Callable, List, Any, Dict
import numpy import numpy
from PyQt6.QtCore import QObject, QTimer, QUrl, pyqtSignal, pyqtProperty, QEvent, Q_ENUMS from PyQt6.QtCore import QObject, QTimer, QUrl, pyqtSignal, pyqtProperty, QEvent, pyqtEnum
from PyQt6.QtGui import QColor, QIcon from PyQt6.QtGui import QColor, QIcon
from PyQt6.QtQml import qmlRegisterUncreatableType, qmlRegisterSingletonType, qmlRegisterType from PyQt6.QtQml import qmlRegisterUncreatableType, qmlRegisterSingletonType, qmlRegisterType
from PyQt6.QtWidgets import QMessageBox from PyQt6.QtWidgets import QMessageBox
@ -133,7 +133,7 @@ class CuraApplication(QtApplication):
Created = False Created = False
class ResourceTypes: class ResourceTypes(enum.IntEnum):
QmlFiles = Resources.UserType + 1 QmlFiles = Resources.UserType + 1
Firmware = Resources.UserType + 2 Firmware = Resources.UserType + 2
QualityInstanceContainer = Resources.UserType + 3 QualityInstanceContainer = Resources.UserType + 3
@ -147,7 +147,7 @@ class CuraApplication(QtApplication):
SettingVisibilityPreset = Resources.UserType + 11 SettingVisibilityPreset = Resources.UserType + 11
IntentInstanceContainer = Resources.UserType + 12 IntentInstanceContainer = Resources.UserType + 12
Q_ENUMS(ResourceTypes) pyqtEnum(ResourceTypes)
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super().__init__(name = ApplicationMetadata.CuraAppName, super().__init__(name = ApplicationMetadata.CuraAppName,

View file

@ -10,7 +10,7 @@ from enum import IntEnum
from pathlib import Path from pathlib import Path
from typing import Optional, List, Dict, Any, cast from typing import Optional, List, Dict, Any, cast
from PyQt6.QtCore import pyqtSignal, QObject, pyqtSlot, pyqtProperty, Q_ENUMS, QTimer, QUrl from PyQt6.QtCore import pyqtSignal, QObject, pyqtSlot, pyqtProperty, pyqtEnum, QTimer, QUrl
from PyQt6.QtNetwork import QNetworkReply from PyQt6.QtNetwork import QNetworkReply
from PyQt6.QtQml import qmlRegisterType, qmlRegisterUncreatableType from PyQt6.QtQml import qmlRegisterType, qmlRegisterUncreatableType
@ -50,7 +50,7 @@ class DFRetrievalStatus(QObject):
be used within QML objects as DigitalFactory.RetrievalStatus.<status> be used within QML objects as DigitalFactory.RetrievalStatus.<status>
""" """
Q_ENUMS(RetrievalStatus) pyqtEnum(RetrievalStatus)
class DigitalFactoryController(QObject): class DigitalFactoryController(QObject):