From 12d3af8d936b100ec220a684074e9486be8b4223 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 28 Jan 2019 13:46:34 +0100 Subject: [PATCH] Fix type error The typing was added by Nallath just now but it is giving an error for me. The private access is allowed here because we're implementing it in the same class, even though it is a different instance. This fixes the type error a bit more strictly than what lfei just did at the same time as me. --- cura/LayerDataDecorator.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/cura/LayerDataDecorator.py b/cura/LayerDataDecorator.py index 09ef54ce5e..ef82d8f5cc 100644 --- a/cura/LayerDataDecorator.py +++ b/cura/LayerDataDecorator.py @@ -1,9 +1,10 @@ -from typing import TYPE_CHECKING, Optional +# Copyright (c) 2019 Ultimaker B.V. +# Cura is released under the terms of the LGPLv3 or higher. +from typing import Optional from UM.Scene.SceneNodeDecorator import SceneNodeDecorator -if TYPE_CHECKING: - from cura.LayerData import LayerData +from cura.LayerData import LayerData ## Simple decorator to indicate a scene node holds layer data. @@ -15,10 +16,10 @@ class LayerDataDecorator(SceneNodeDecorator): def getLayerData(self) -> Optional["LayerData"]: return self._layer_data - def setLayerData(self, layer_data: Optional["LayerData"]) -> None: + def setLayerData(self, layer_data: LayerData) -> None: self._layer_data = layer_data def __deepcopy__(self, memo) -> "LayerDataDecorator": copied_decorator = LayerDataDecorator() - copied_decorator.setLayerData(self.getLayerData()) + copied_decorator._layer_data = self._layer_data return copied_decorator