mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-04-16 18:59:39 +08:00
Qt5->Qt6: (Until) attempted fix Python 3.10 'stack overflow' issue.
part of CURA-8591
This commit is contained in:
parent
7021ff0b67
commit
b62e708b87
@ -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):
|
||||||
|
@ -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)
|
@ -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()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user