From 87070aefce9834b88362327cf37084aace22f46f Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Wed, 30 Jan 2019 17:17:46 +0100 Subject: [PATCH] Fixed typing issues for configuredConnectionTypes CURA-6159 --- cura/Settings/GlobalStack.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/cura/Settings/GlobalStack.py b/cura/Settings/GlobalStack.py index 896caffe42..a9acaf2f8a 100755 --- a/cura/Settings/GlobalStack.py +++ b/cura/Settings/GlobalStack.py @@ -77,27 +77,27 @@ class GlobalStack(CuraContainerStack): # If we can't get a network connection, but it is configured to have one, # we can display a different icon to indicate the difference. @pyqtProperty("QVariantList", notify=configuredConnectionTypesChanged) - def configuredConnectionTypes(self): + def configuredConnectionTypes(self) -> List[int]: # Requesting it from the metadata actually gets them as strings (as that's what you get from serializing). # But we do want them returned as a list of ints (so the rest of the code can directly compare) connection_types = self.getMetaDataEntry("connection_type", "").split(",") return [int(connection_type) for connection_type in connection_types if connection_type != ""] ## \sa configuredConnectionTypes - def addConfiguredConnectionType(self, connection_type): - configured_connection_types = self.configuredConnectionTypes + def addConfiguredConnectionType(self, connection_type: int) -> None: + configured_connection_types = self.configuredConnectionTypes if connection_type not in configured_connection_types: # Store the values as a string. - configured_connection_types.append(str(connection_type)) - self.setMetaDataEntry("connection_type", ",".join(configured_connection_types)) + configured_connection_types.append(connection_type) + self.setMetaDataEntry("connection_type", ",".join([str(c_type) for c_type in configured_connection_types])) ## \sa configuredConnectionTypes - def removeConfiguredConnectionType(self, connection_type): + def removeConfiguredConnectionType(self, connection_type: int) -> None: configured_connection_types = self.configuredConnectionTypes if connection_type in self.configured_connection_types: # Store the values as a string. - configured_connection_types.remove(str(connection_type)) - self.setMetaDataEntry("connection_type", ",".join(configured_connection_types)) + configured_connection_types.remove(connection_type) + self.setMetaDataEntry("connection_type", ",".join([str(c_type) for c_type in configured_connection_types])) @classmethod def getConfigurationTypeFromSerialized(cls, serialized: str) -> Optional[str]: