From dc0c666a54336873ccb7dee9c976b9504773b5a0 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Thu, 23 Mar 2017 17:52:53 +0100 Subject: [PATCH] Disable add/insert/remove container Since we want to have a fixed list of containers in the stack. Contributes to CURA-3497 --- cura/Settings/GlobalStack.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/cura/Settings/GlobalStack.py b/cura/Settings/GlobalStack.py index b605b8dc76..6118843095 100644 --- a/cura/Settings/GlobalStack.py +++ b/cura/Settings/GlobalStack.py @@ -105,6 +105,22 @@ class GlobalStack(ContainerStack): raise Exceptions.InvalidOperationError("Global stack cannot have a next stack!") ## Overridden from ContainerStack + # + # Since we have a fixed order of containers in the stack, we want to enforce this. + @override(ContainerStack) + def addContainer(self, container: ContainerInterface) -> None: + raise Exceptions.InvalidOperationError("Cannot add a container to Global stack") + + ## Overridden from ContainerStack + @override(ContainerStack) + def insertContainer(self, index: int, container: ContainerInterface) -> None: + raise Exceptions.InvalidOperationError("Cannot insert a container into Global stack") + + ## Overridden from ContainerStack + @override(ContainerStack) + def removeContainer(self, index: int) -> None: + raise Exceptions.InvalidOperationError("Cannot remove a container from Global stack") + @override(ContainerStack) def deserialize(self, contents: str) -> None: super().deserialize(contents)