From 45da5b91301bb7d499727e4f7947de4a4e729986 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Wed, 17 Oct 2018 14:07:12 +0200 Subject: [PATCH] Added more specific overrides for get/set globalContainerStack This helps a lot with the type hinting in other bits of the code, since for CuraApplicaiton we know it's always going to be a GlobalStack CURA-5814 --- cura/CuraApplication.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 0b2940044f..b12bc975d4 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -13,6 +13,7 @@ from PyQt5.QtGui import QColor, QIcon from PyQt5.QtWidgets import QMessageBox from PyQt5.QtQml import qmlRegisterUncreatableType, qmlRegisterSingletonType, qmlRegisterType +from UM.Application import Application from UM.PluginError import PluginNotFoundError from UM.Scene.SceneNode import SceneNode from UM.Scene.Camera import Camera @@ -114,12 +115,13 @@ from cura.Settings.CuraFormulaFunctions import CuraFormulaFunctions from cura.ObjectsModel import ObjectsModel from UM.FlameProfiler import pyqtSlot - +from UM.Decorators import override if TYPE_CHECKING: from cura.Machines.MaterialManager import MaterialManager from cura.Machines.QualityManager import QualityManager from UM.Settings.EmptyInstanceContainer import EmptyInstanceContainer + from cura.Settings.GlobalStack import GlobalStack numpy.seterr(all = "ignore") @@ -575,6 +577,14 @@ class CuraApplication(QtApplication): def showPreferences(self): self.showPreferencesWindow.emit() + @override(Application) + def getGlobalContainerStack(self) -> Optional["GlobalStack"]: + return self._global_container_stack + + @override(Application) + def setGlobalContainerStack(self, stack: "GlobalStack") -> None: + super().setGlobalContainerStack(stack) + ## A reusable dialogbox # showMessageBox = pyqtSignal(str, str, str, str, int, int, arguments = ["title", "text", "informativeText", "detailedText", "buttons", "icon"])