Browse Source

CURA-4606 CURA-5003 fix saving material metadata when switching material; fix crashing on fallback material on materials without fallback

Jack Ha 7 years ago
parent
commit
c7499d6e17
2 changed files with 3 additions and 1 deletions
  1. 2 1
      cura/Machines/MaterialManager.py
  2. 1 0
      resources/qml/Preferences/MaterialsPage.qml

+ 2 - 1
cura/Machines/MaterialManager.py

@@ -314,7 +314,8 @@ class MaterialManager(QObject):
     def getFallbackMaterialId(self, material_type: str) -> str:
         # For safety
         if material_type not in self._fallback_materials_map:
-            raise RuntimeError("Material type [%s] is not in the fallback materials table." % material_type)
+            Logger.log("w", "The material type [%s] does not have a fallback material" % material_type)
+            return None
         fallback_material = self._fallback_materials_map[material_type]
         if fallback_material:
             return self.getRootMaterialIDWithoutDiameter(fallback_material["id"])

+ 1 - 0
resources/qml/Preferences/MaterialsPage.qml

@@ -350,6 +350,7 @@ Item
 
                 onCurrentIndexChanged:
                 {
+                    forceActiveFocus();  // causes the changed fields to be saved
                     var model = materialsModel.getItem(currentIndex);
                     materialDetailsView.containerId = model.container_id;
                     materialDetailsView.currentMaterialNode = model.container_node;