Qt5->Qt6: (Until) attempted fix Python 3.10 'stack overflow' issue.

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

View File

@ -217,7 +217,7 @@ class CuraApplication(QtApplication):
self._quality_profile_drop_down_menu_model = None self._quality_profile_drop_down_menu_model = None
self._custom_quality_profile_drop_down_menu_model = None self._custom_quality_profile_drop_down_menu_model = None
self._cura_API = CuraAPI(self) self._cura_API = None
self._physics = None self._physics = None
self._volume = None self._volume = None
@ -682,8 +682,8 @@ class CuraApplication(QtApplication):
def messageBox(self, title, text, def messageBox(self, title, text,
informativeText = "", informativeText = "",
detailedText = "", detailedText = "",
buttons = QMessageBox.Ok, buttons = QMessageBox.StandardButton.Ok,
icon = QMessageBox.NoIcon, icon = QMessageBox.Icon.NoIcon,
callback = None, callback = None,
callback_arguments = [] callback_arguments = []
): ):
@ -837,7 +837,7 @@ class CuraApplication(QtApplication):
self._setting_visibility_presets_model = SettingVisibilityPresetsModel(self.getPreferences(), parent = self) self._setting_visibility_presets_model = SettingVisibilityPresetsModel(self.getPreferences(), parent = self)
# Initialize Cura API # Initialize Cura API
self._cura_API.initialize() self._cura_API = self.getCuraAPI()
self.processEvents() self.processEvents()
self._output_device_manager.start() self._output_device_manager.start()
self._welcome_pages_model.initialize() self._welcome_pages_model.initialize()
@ -1087,7 +1087,7 @@ class CuraApplication(QtApplication):
def event(self, event): def event(self, event):
"""Handle Qt events""" """Handle Qt events"""
if event.type() == QEvent.FileOpen: if event.type() == QEvent.Type.FileOpen:
if self._plugins_loaded: if self._plugins_loaded:
self._openFile(event.file()) self._openFile(event.file())
else: else:
@ -1114,6 +1114,9 @@ class CuraApplication(QtApplication):
return self._custom_quality_profile_drop_down_menu_model return self._custom_quality_profile_drop_down_menu_model
def getCuraAPI(self, *args, **kwargs) -> "CuraAPI": def getCuraAPI(self, *args, **kwargs) -> "CuraAPI":
if not self._cura_API:
self._cura_API = CuraAPI(self)
self._cura_API.initialize()
return self._cura_API return self._cura_API
def registerObjects(self, engine): def registerObjects(self, engine):

View File

@ -1,7 +1,7 @@
# 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.
from PyQt6.QtCore import pyqtSlot, pyqtProperty, QObject, pyqtSignal, QRegExp from PyQt6.QtCore import pyqtSlot, pyqtProperty, QObject, pyqtSignal
from PyQt6.QtGui import QValidator from PyQt6.QtGui import QValidator
import os #For statvfs. import os #For statvfs.
import urllib #To escape machine names for how they're saved to file. import urllib #To escape machine names for how they're saved to file.
@ -65,6 +65,6 @@ class MachineNameValidator(QObject):
self.validation_regex = "a^" #Never matches (unless you manage to get "a" before the start of the string... good luck). self.validation_regex = "a^" #Never matches (unless you manage to get "a" before the start of the string... good luck).
self.validationChanged.emit() self.validationChanged.emit()
@pyqtProperty("QRegExp", notify=validationChanged) @pyqtProperty(str, notify=validationChanged)
def machineNameRegex(self): def machineNameRegex(self):
return QRegExp(self.machine_name_regex) return str(self.machine_name_regex)

View File

@ -156,7 +156,7 @@ def exceptHook(hook_type, value, traceback):
# If the application has finished its initialization and was running fine, and then something causes a crash, # If the application has finished its initialization and was running fine, and then something causes a crash,
# we run the old routine to show the Crash Dialog. # we run the old routine to show the Crash Dialog.
# #
from PyQt6.Qt import QApplication from PyQt6.QtWidgets import QApplication
if CuraApplication.Created: if CuraApplication.Created:
_crash_handler = CrashHandler(hook_type, value, traceback, has_started) _crash_handler = CrashHandler(hook_type, value, traceback, has_started)
if CuraApplication.splash is not None: if CuraApplication.splash is not None:
@ -228,7 +228,7 @@ if Platform.isLinux():
if ApplicationMetadata.CuraDebugMode: if ApplicationMetadata.CuraDebugMode:
ssl_conf = QSslConfiguration.defaultConfiguration() ssl_conf = QSslConfiguration.defaultConfiguration()
ssl_conf.setPeerVerifyMode(QSslSocket.VerifyNone) ssl_conf.setPeerVerifyMode(QSslSocket.PeerVerifyMode.VerifyNone)
QSslConfiguration.setDefaultConfiguration(ssl_conf) QSslConfiguration.setDefaultConfiguration(ssl_conf)
app = CuraApplication() app = CuraApplication()