Browse Source

Merge branch '4.7'

Ghostkeeper 4 years ago
parent
commit
1f09ea58cc

+ 1 - 1
cura/ApplicationMetadata.py

@@ -13,7 +13,7 @@ DEFAULT_CURA_DEBUG_MODE = False
 # Each release has a fixed SDK version coupled with it. It doesn't make sense to make it configurable because, for
 # example Cura 3.2 with SDK version 6.1 will not work. So the SDK version is hard-coded here and left out of the
 # CuraVersion.py.in template.
-CuraSDKVersion = "7.2.0"
+CuraSDKVersion = "7.3.0"
 
 try:
     from cura.CuraVersion import CuraAppName  # type: ignore

+ 13 - 3
cura/Machines/MachineNode.py

@@ -135,9 +135,7 @@ class MachineNode(ContainerNode):
                 groups_by_name[name] = QualityChangesGroup(name, quality_type = quality_changes["quality_type"],
                                                            intent_category = quality_changes.get("intent_category", "default"),
                                                            parent = CuraApplication.getInstance())
-                # CURA-6882
-                # Custom qualities are always available, even if they are based on the "not supported" profile.
-                groups_by_name[name].is_available = True
+
             elif groups_by_name[name].intent_category == "default":  # Intent category should be stored as "default" if everything is default or as the intent if any of the extruder have an actual intent.
                 groups_by_name[name].intent_category = quality_changes.get("intent_category", "default")
 
@@ -146,6 +144,18 @@ class MachineNode(ContainerNode):
             else:  # Global profile.
                 groups_by_name[name].metadata_for_global = quality_changes
 
+        quality_groups = self.getQualityGroups(variant_names, material_bases, extruder_enabled)
+        for quality_changes_group in groups_by_name.values():
+            if quality_changes_group.quality_type not in quality_groups:
+                if quality_changes_group.quality_type == "not_supported":
+                    # Quality changes based on an empty profile are always available. 
+                    quality_changes_group.is_available = True
+                else:
+                    quality_changes_group.is_available = False
+            else:
+                # Quality changes group is available iff the quality group it depends on is available. Irrespective of whether the intent category is available.
+                quality_changes_group.is_available = quality_groups[quality_changes_group.quality_type].is_available
+
         return list(groups_by_name.values())
 
     def preferredGlobalQuality(self) -> "QualityNode":

+ 7 - 0
cura/Machines/Models/QualityManagementModel.py

@@ -333,6 +333,7 @@ class QualityManagementModel(ListModel):
                     "layer_height": layer_height,  # layer_height is only used for sorting
                     }
             item_list.append(item)
+
         # Sort by layer_height for built-in qualities
         item_list = sorted(item_list, key = lambda x: x["layer_height"])
 
@@ -341,6 +342,9 @@ class QualityManagementModel(ListModel):
         available_intent_list = [i for i in available_intent_list if i[0] != "default"]
         result = []
         for intent_category, quality_type in available_intent_list:
+            if not quality_group_dict[quality_type].is_available:
+                continue
+            
             result.append({
                 "name": quality_group_dict[quality_type].name,  # Use the quality name as the display name
                 "is_read_only": True,
@@ -361,6 +365,9 @@ class QualityManagementModel(ListModel):
             # CURA-6913 Note that custom qualities can be based on "not supported", so the quality group can be None.
             quality_group = quality_group_dict.get(quality_changes_group.quality_type)
             quality_type = quality_changes_group.quality_type
+
+            if not quality_changes_group.is_available:
+                continue
             item = {"name": quality_changes_group.name,
                     "is_read_only": False,
                     "quality_group": quality_group,

+ 2 - 1
cura/Settings/CuraStackBuilder.py

@@ -62,7 +62,8 @@ class CuraStackBuilder:
         for position in extruder_dict:
             try:
                 cls.createExtruderStackWithDefaultSetup(new_global_stack, position)
-            except IndexError:
+            except IndexError as e:
+                Logger.logException("e", "Failed to create an extruder stack for position {pos}: {err}".format(pos = position, err = str(e)))
                 return None
 
         for new_extruder in new_global_stack.extruderList:  # Only register the extruders if we're sure that all of them are correct.

+ 16 - 15
plugins/3MFReader/ThreeMFWorkspaceReader.py

@@ -762,21 +762,22 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
                 Job.yieldThread()
                 QCoreApplication.processEvents()  # Ensure that the GUI does not freeze.
 
-        # Handle quality changes if any
-        self._processQualityChanges(global_stack)
-
-        # Prepare the machine
-        self._applyChangesToMachine(global_stack, extruder_stack_dict)
-
-        Logger.log("d", "Workspace loading is notifying rest of the code of changes...")
-        # Actually change the active machine.
-        #
-        # This is scheduled for later is because it depends on the Variant/Material/Qualitiy Managers to have the latest
-        # data, but those managers will only update upon a container/container metadata changed signal. Because this
-        # function is running on the main thread (Qt thread), although those "changed" signals have been emitted, but
-        # they won't take effect until this function is done.
-        # To solve this, we schedule _updateActiveMachine() for later so it will have the latest data.
-        self._updateActiveMachine(global_stack)
+        if global_stack:
+            # Handle quality changes if any
+            self._processQualityChanges(global_stack)
+
+            # Prepare the machine
+            self._applyChangesToMachine(global_stack, extruder_stack_dict)
+
+            Logger.log("d", "Workspace loading is notifying rest of the code of changes...")
+            # Actually change the active machine.
+            #
+            # This is scheduled for later is because it depends on the Variant/Material/Qualitiy Managers to have the latest
+            # data, but those managers will only update upon a container/container metadata changed signal. Because this
+            # function is running on the main thread (Qt thread), although those "changed" signals have been emitted, but
+            # they won't take effect until this function is done.
+            # To solve this, we schedule _updateActiveMachine() for later so it will have the latest data.
+            self._updateActiveMachine(global_stack)
 
         # Load all the nodes / mesh data of the workspace
         nodes = self._3mf_mesh_reader.read(file_name)

+ 1 - 1
plugins/3MFReader/plugin.json

@@ -3,6 +3,6 @@
     "author": "Ultimaker B.V.",
     "version": "1.0.1",
     "description": "Provides support for reading 3MF files.",
-    "api": "7.2.0",
+    "api": "7.3.0",
     "i18n-catalog": "cura"
 }

+ 1 - 1
plugins/3MFWriter/plugin.json

@@ -3,6 +3,6 @@
     "author": "Ultimaker B.V.",
     "version": "1.0.1",
     "description": "Provides support for writing 3MF files.",
-    "api": "7.2.0",
+    "api": "7.3.0",
     "i18n-catalog": "cura"
 }

+ 1 - 1
plugins/AMFReader/plugin.json

@@ -3,5 +3,5 @@
     "author": "fieldOfView",
     "version": "1.0.0",
     "description": "Provides support for reading AMF files.",
-    "api": "7.2.0"
+    "api": "7.3.0"
 }

+ 1 - 1
plugins/CuraDrive/plugin.json

@@ -3,6 +3,6 @@
     "author": "Ultimaker B.V.",
     "description": "Backup and restore your configuration.",
     "version": "1.2.0",
-    "api": "7.2.0",
+    "api": "7.3.0",
     "i18n-catalog": "cura"
 }

+ 1 - 1
plugins/CuraEngineBackend/plugin.json

@@ -2,7 +2,7 @@
     "name": "CuraEngine Backend",
     "author": "Ultimaker B.V.",
     "description": "Provides the link to the CuraEngine slicing backend.",
-    "api": "7.2.0",
+    "api": "7.3.0",
     "version": "1.0.1",
     "i18n-catalog": "cura"
 }

Some files were not shown because too many files changed in this diff