Browse Source

Fix 'Could not get metadata of container <empty string>'

Turns out that the side bar header was requesting the metadata before the active material was set. Now I'm just saying that if the active material was not set, it should not be compatible.

Contributes to issue CURA-4243, side-ways.
Ghostkeeper 7 years ago
parent
commit
839c8ccc52

+ 1 - 1
cura/Settings/MachineManager.py

@@ -151,7 +151,7 @@ class MachineManager(QObject):
         if not self._global_container_stack:
             return
 
-        containers = ContainerRegistry.getInstance().findInstanceContainersMetadata(type="variant", definition=self._global_container_stack.getBottom().getId(), name=hotend_id)
+        containers = ContainerRegistry.getInstance().findInstanceContainersMetadata(type = "variant", definition = self._global_container_stack.getBottom().getId(), name = hotend_id)
         if containers:  # New material ID is known
             extruder_manager = ExtruderManager.getInstance()
             machine_id = self.activeMachineId

+ 1 - 1
resources/qml/Preferences/MaterialView.qml

@@ -41,7 +41,7 @@ TabView
 
     Tab
     {
-        title: catalog.i18nc("@title","Information")
+        title: catalog.i18nc("@title", "Information")
 
         anchors.margins: UM.Theme.getSize("default_margin").width
 

+ 4 - 0
resources/qml/SidebarHeader.qml

@@ -252,6 +252,10 @@ Column
             visible: Cura.MachineManager.hasMaterials
             property var valueError:
             {
+                if(Cura.MachineManager.activeMaterialId === "")
+                {
+                    return false
+                }
                 var data = Cura.ContainerManager.getContainerMetaDataEntry(Cura.MachineManager.activeMaterialId, "compatible")
                 if(data == "False")
                 {