diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 474d47fbaa..d24ce28da5 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -217,7 +217,7 @@ class CuraApplication(QtApplication): self._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._volume = None @@ -682,8 +682,8 @@ class CuraApplication(QtApplication): def messageBox(self, title, text, informativeText = "", detailedText = "", - buttons = QMessageBox.Ok, - icon = QMessageBox.NoIcon, + buttons = QMessageBox.StandardButton.Ok, + icon = QMessageBox.Icon.NoIcon, callback = None, callback_arguments = [] ): @@ -837,7 +837,7 @@ class CuraApplication(QtApplication): self._setting_visibility_presets_model = SettingVisibilityPresetsModel(self.getPreferences(), parent = self) # Initialize Cura API - self._cura_API.initialize() + self._cura_API = self.getCuraAPI() self.processEvents() self._output_device_manager.start() self._welcome_pages_model.initialize() @@ -1087,7 +1087,7 @@ class CuraApplication(QtApplication): def event(self, event): """Handle Qt events""" - if event.type() == QEvent.FileOpen: + if event.type() == QEvent.Type.FileOpen: if self._plugins_loaded: self._openFile(event.file()) else: @@ -1114,6 +1114,9 @@ class CuraApplication(QtApplication): return self._custom_quality_profile_drop_down_menu_model def getCuraAPI(self, *args, **kwargs) -> "CuraAPI": + if not self._cura_API: + self._cura_API = CuraAPI(self) + self._cura_API.initialize() return self._cura_API def registerObjects(self, engine): diff --git a/cura/Settings/MachineNameValidator.py b/cura/Settings/MachineNameValidator.py index 7fc1789f13..409365ef97 100644 --- a/cura/Settings/MachineNameValidator.py +++ b/cura/Settings/MachineNameValidator.py @@ -1,7 +1,7 @@ # Copyright (c) 2021 Ultimaker B.V. # 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 import os #For statvfs. 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.validationChanged.emit() - @pyqtProperty("QRegExp", notify=validationChanged) + @pyqtProperty(str, notify=validationChanged) def machineNameRegex(self): - return QRegExp(self.machine_name_regex) \ No newline at end of file + return str(self.machine_name_regex) \ No newline at end of file diff --git a/cura_app.py b/cura_app.py index 001e71775e..4b689fdadb 100755 --- a/cura_app.py +++ b/cura_app.py @@ -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, # we run the old routine to show the Crash Dialog. # - from PyQt6.Qt import QApplication + from PyQt6.QtWidgets import QApplication if CuraApplication.Created: _crash_handler = CrashHandler(hook_type, value, traceback, has_started) if CuraApplication.splash is not None: @@ -228,7 +228,7 @@ if Platform.isLinux(): if ApplicationMetadata.CuraDebugMode: ssl_conf = QSslConfiguration.defaultConfiguration() - ssl_conf.setPeerVerifyMode(QSslSocket.VerifyNone) + ssl_conf.setPeerVerifyMode(QSslSocket.PeerVerifyMode.VerifyNone) QSslConfiguration.setDefaultConfiguration(ssl_conf) app = CuraApplication()