Browse Source

Removed redundant string comparison

CURA-7038
Dimitriovski 5 years ago
parent
commit
fc504a7cb6

+ 2 - 2
plugins/Toolbox/resources/qml/dialogs/CompatibilityDialog.qml

@@ -61,7 +61,7 @@ UM.Dialog{
                         {
                             width: parent.width
                             property int lineHeight: 60
-                            visible: model.is_compatible === "True" ? true : false
+                            visible: model.is_compatible
                             height: visible ? (lineHeight + UM.Theme.getSize("default_margin").height) : 0 // We only show the compatible packages here
                             Image
                             {
@@ -104,7 +104,7 @@ UM.Dialog{
                         {
                             width: parent.width
                             property int lineHeight: 60
-                            visible: model.is_compatible === "True" ? false : true
+                            visible: !model.is_compatible
                             height: visible ? (lineHeight + UM.Theme.getSize("default_margin").height) : 0 // We only show the incompatible packages here
                             Image
                             {

+ 4 - 4
plugins/Toolbox/src/SubscribedPackagesModel.py

@@ -35,9 +35,9 @@ class SubscribedPackagesModel(ListModel):
                 continue
             package = {"name": item["display_name"], "sdk_versions": item["sdk_versions"]}
             if self._sdk_version not in item["sdk_versions"]:
-                package.update({"is_compatible": "False"})
+                package.update({"is_compatible": False})
             else:
-                package.update({"is_compatible": "True"})
+                package.update({"is_compatible": True})
             try:
                 package.update({"icon_url": item["icon_url"]})
             except KeyError:  # There is no 'icon_url" in the response payload for this package
@@ -50,13 +50,13 @@ class SubscribedPackagesModel(ListModel):
     def has_compatible_packages(self):
         has_compatible_items  = False
         for item in self._items:
-            if item['is_compatible'] == 'True':
+            if item['is_compatible'] == True:
                 has_compatible_items = True
         return has_compatible_items
 
     def has_incompatible_packages(self):
         has_incompatible_items  = False
         for item in self._items:
-            if item['is_compatible'] == 'False':
+            if item['is_compatible'] == False:
                 has_incompatible_items = True
         return has_incompatible_items