From ab32d64c01245f0b1d644746315691f5520d3cf1 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 15 Jun 2018 11:34:35 +0200 Subject: [PATCH] Add types for ShaderPrograms Otherwise it'll think that this variable can only have None in it. Contributes to issue CURA-5330. --- cura/PreviewPass.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/cura/PreviewPass.py b/cura/PreviewPass.py index e9f6a3a548..befb52ee5e 100644 --- a/cura/PreviewPass.py +++ b/cura/PreviewPass.py @@ -1,6 +1,8 @@ # Copyright (c) 2018 Ultimaker B.V. # Cura is released under the terms of the LGPLv3 or higher. +from typing import Optional, TYPE_CHECKING + from UM.Application import Application from UM.Resources import Resources @@ -11,7 +13,8 @@ from UM.View.RenderBatch import RenderBatch from UM.Scene.Iterator.DepthFirstIterator import DepthFirstIterator -from typing import Optional +if TYPE_CHECKING: + from UM.View.GL.ShaderProgram import ShaderProgram MYPY = False if MYPY: @@ -41,9 +44,9 @@ class PreviewPass(RenderPass): self._renderer = Application.getInstance().getRenderer() - self._shader = None - self._non_printing_shader = None - self._support_mesh_shader = None + self._shader = None #type: Optional[ShaderProgram] + self._non_printing_shader = None #type: Optional[ShaderProgram] + self._support_mesh_shader = None #type: Optional[ShaderProgram] self._scene = Application.getInstance().getController().getScene() # Set the camera to be used by this render pass