Qt5->Qt6: Fix another stack-overflow error for newer Python/Qt.

part of CURA-8591
This commit is contained in:
Remco Burema 2021-12-29 10:15:14 +01:00
parent 9d7b1e49ee
commit 97da0b9183
No known key found for this signature in database
GPG Key ID: 215C49431D43F98C
2 changed files with 5 additions and 7 deletions

View File

@ -34,12 +34,13 @@ class CuraAPI(QObject):
raise RuntimeError("Tried to create singleton '{class_name}' more than once.".format(class_name = CuraAPI.__name__)) raise RuntimeError("Tried to create singleton '{class_name}' more than once.".format(class_name = CuraAPI.__name__))
if application is None: if application is None:
raise RuntimeError("Upon first time creation, the application must be set.") raise RuntimeError("Upon first time creation, the application must be set.")
cls.__instance = super(CuraAPI, cls).__new__(cls) instance = super(CuraAPI, cls).__new__(cls)
cls._application = application cls._application = application
return cls.__instance return instance
def __init__(self, application: Optional["CuraApplication"] = None) -> None: def __init__(self, application: Optional["CuraApplication"] = None) -> None:
super().__init__(parent = CuraAPI._application) super().__init__(parent = CuraAPI._application)
CuraAPI.__instance = self
self._account = Account(self._application) self._account = Account(self._application)

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 = None self._cura_API = CuraAPI(self)
self._physics = None self._physics = None
self._volume = None self._volume = None
@ -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 = self.getCuraAPI() self._cura_API.initialize()
self.processEvents() self.processEvents()
self._output_device_manager.start() self._output_device_manager.start()
self._welcome_pages_model.initialize() self._welcome_pages_model.initialize()
@ -1114,9 +1114,6 @@ 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):