From 49c684a741d9b06193020f74c79d0ebe9fa667b2 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 4 Jun 2018 09:51:34 +0200 Subject: [PATCH] Add function typing Contributes to issue CURA-5330. --- cura/Settings/ExtruderStack.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/cura/Settings/ExtruderStack.py b/cura/Settings/ExtruderStack.py index b3f7d529a2..9794cd1b3d 100644 --- a/cura/Settings/ExtruderStack.py +++ b/cura/Settings/ExtruderStack.py @@ -1,7 +1,7 @@ -# Copyright (c) 2017 Ultimaker B.V. +# Copyright (c) 2018 Ultimaker B.V. # Cura is released under the terms of the LGPLv3 or higher. -from typing import Any, TYPE_CHECKING, Optional +from typing import Any, Dict, TYPE_CHECKING, Optional from PyQt5.QtCore import pyqtProperty, pyqtSignal @@ -25,7 +25,7 @@ if TYPE_CHECKING: # # class ExtruderStack(CuraContainerStack): - def __init__(self, container_id: str): + def __init__(self, container_id: str) -> None: super().__init__(container_id) self.addMetaDataEntry("type", "extruder_train") # For backward compatibility @@ -50,14 +50,14 @@ class ExtruderStack(CuraContainerStack): def getNextStack(self) -> Optional["GlobalStack"]: return super().getNextStack() - def setEnabled(self, enabled): + def setEnabled(self, enabled: bool) -> None: if "enabled" not in self._metadata: self.addMetaDataEntry("enabled", "True") self.setMetaDataEntry("enabled", str(enabled)) self.enabledChanged.emit() @pyqtProperty(bool, notify = enabledChanged) - def isEnabled(self): + def isEnabled(self) -> bool: return parseBool(self.getMetaDataEntry("enabled", "True")) @classmethod @@ -142,7 +142,7 @@ class ExtruderStack(CuraContainerStack): if stacks: self.setNextStack(stacks[0]) - def _onPropertiesChanged(self, key, properties): + def _onPropertiesChanged(self, key: str, properties: Dict[str, Any]) -> None: # When there is a setting that is not settable per extruder that depends on a value from a setting that is, # we do not always get properly informed that we should re-evaluate the setting. So make sure to indicate # something changed for those settings.