Browse Source

Fixed typing issues for configuredConnectionTypes

CURA-6159
Jaime van Kessel 6 years ago
parent
commit
87070aefce
1 changed files with 8 additions and 8 deletions
  1. 8 8
      cura/Settings/GlobalStack.py

+ 8 - 8
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]: