Просмотр исходного кода

Merge branch 'master' into CURA-6862_truncate_profile_names

Remco Burema 5 лет назад
Родитель
Сommit
fde4804a58

+ 0 - 1
cura/Machines/MachineErrorChecker.py

@@ -58,7 +58,6 @@ class MachineErrorChecker(QObject):
 
         # Whenever the machine settings get changed, we schedule an error check.
         self._machine_manager.globalContainerChanged.connect(self.startErrorCheck)
-        self._machine_manager.globalValueChanged.connect(self.startErrorCheck)
 
         self._onMachineChanged()
 

+ 3 - 8
cura/Machines/MachineNode.py

@@ -134,6 +134,9 @@ 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")
 
@@ -142,14 +145,6 @@ 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:
-                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())
 
     ##  Gets the preferred global quality node, going by the preferred quality

+ 6 - 2
cura/Machines/Models/QualityManagementModel.py

@@ -13,6 +13,7 @@ from cura.Settings.ContainerManager import ContainerManager
 from cura.Machines.ContainerTree import ContainerTree
 from cura.Settings.cura_empty_instance_containers import empty_quality_changes_container
 from cura.Settings.IntentManager import IntentManager
+from cura.Machines.Models.MachineModelUtils import fetchLayerHeight
 
 from UM.i18n import i18nCatalog
 catalog = i18nCatalog("cura")
@@ -295,6 +296,8 @@ class QualityManagementModel(ListModel):
             if not quality_group.is_available:
                 continue
 
+            layer_height = fetchLayerHeight(quality_group)
+
             item = {"name": quality_group.name,
                     "is_read_only": True,
                     "quality_group": quality_group,
@@ -302,10 +305,11 @@ class QualityManagementModel(ListModel):
                     "quality_changes_group": None,
                     "intent_category": "default",
                     "section_name": catalog.i18nc("@label", "Default"),
+                    "layer_height": layer_height,  # layer_height is only used for sorting
                     }
             item_list.append(item)
-        # Sort by quality names
-        item_list = sorted(item_list, key = lambda x: x["name"].upper())
+        # Sort by layer_height for built-in qualities
+        item_list = sorted(item_list, key = lambda x: x["layer_height"])
 
         # Create intent items (non-default)
         available_intent_list = IntentManager.getInstance().getCurrentAvailableIntents()

+ 8 - 0
cura/Machines/VariantNode.py

@@ -101,6 +101,14 @@ class VariantNode(ContainerNode):
     def _materialAdded(self, container: ContainerInterface) -> None:
         if container.getMetaDataEntry("type") != "material":
             return  # Not interested.
+        if not ContainerRegistry.getInstance().findContainersMetadata(id = container.getId()):
+            # CURA-6889
+            # containerAdded and removed signals may be triggered in the next event cycle. If a container gets added
+            # and removed in the same event cycle, in the next cycle, the connections should just ignore the signals.
+            # The check here makes sure that the container in the signal still exists.
+            Logger.log("d", "Got container added signal for container [%s] but it no longer exists, do nothing.",
+                       container.getId())
+            return
         if not self.machine.has_materials:
             return  # We won't add any materials.
         material_definition = container.getMetaDataEntry("definition")

+ 8 - 0
cura/PrinterOutput/Models/MaterialOutputModel.py

@@ -34,3 +34,11 @@ class MaterialOutputModel(QObject):
     @pyqtProperty(str, constant = True)
     def name(self) -> str:
         return self._name
+
+    def __eq__(self, other):
+        if self is other:
+            return True
+        if type(other) is not MaterialOutputModel:
+            return False
+
+        return self.guid == other.guid and self.type == other.type and self.brand == other.brand and self.color == other.color and self.name == other.name

+ 7 - 8
cura/Settings/MachineManager.py

@@ -95,7 +95,6 @@ class MachineManager(QObject):
         extruder_manager.activeExtruderChanged.connect(self.activeQualityChanged)
 
         self.globalContainerChanged.connect(self.activeStackChanged)
-        self.globalValueChanged.connect(self.activeStackValueChanged)
         ExtruderManager.getInstance().activeExtruderChanged.connect(self.activeStackChanged)
         self.activeStackChanged.connect(self.activeStackValueChanged)
 
@@ -143,7 +142,6 @@ class MachineManager(QObject):
     activeStackChanged = pyqtSignal()  # Emitted whenever the active stack is changed (ie: when changing between extruders, changing a profile, but not when changing a value)
     extruderChanged = pyqtSignal()
 
-    globalValueChanged = pyqtSignal()  # Emitted whenever a value inside global container is changed.
     activeStackValueChanged = pyqtSignal()  # Emitted whenever a value inside the active stack is changed.
     activeStackValidationChanged = pyqtSignal()  # Emitted whenever a validation inside active container is changed
     stacksValidationChanged = pyqtSignal()  # Emitted whenever a validation is changed
@@ -156,7 +154,6 @@ class MachineManager(QObject):
     printerConnectedStatusChanged = pyqtSignal() # Emitted every time the active machine change or the outputdevices change
 
     rootMaterialChanged = pyqtSignal()
-    discoveredPrintersChanged = pyqtSignal()
 
     def setInitialActiveMachine(self) -> None:
         active_machine_id = self._application.getPreferences().getValue("cura/active_machine")
@@ -182,9 +179,11 @@ class MachineManager(QObject):
 
         # Create the configuration model with the current data in Cura
         self._current_printer_configuration.printerType = self._global_container_stack.definition.getName()
-        self._current_printer_configuration.extruderConfigurations = []
-        for extruder in self._global_container_stack.extruderList:
-            extruder_configuration = ExtruderConfigurationModel()
+
+        if len(self._current_printer_configuration.extruderConfigurations) != len(self._global_container_stack.extruderList):
+            self._current_printer_configuration.extruderConfigurations = [ExtruderConfigurationModel() for extruder in self._global_container_stack.extruderList]
+
+        for extruder, extruder_configuration in zip(self._global_container_stack.extruderList, self._current_printer_configuration.extruderConfigurations):
             # For compare just the GUID is needed at this moment
             mat_type = extruder.material.getMetaDataEntry("material") if extruder.material != empty_material_container else None
             mat_guid = extruder.material.getMetaDataEntry("GUID") if extruder.material != empty_material_container else None
@@ -196,7 +195,6 @@ class MachineManager(QObject):
             extruder_configuration.position = int(extruder.getMetaDataEntry("position"))
             extruder_configuration.material = material_model
             extruder_configuration.hotendID = extruder.variant.getName() if extruder.variant != empty_variant_container else None
-            self._current_printer_configuration.extruderConfigurations.append(extruder_configuration)
 
         # An empty build plate configuration from the network printer is presented as an empty string, so use "" for an
         # empty build plate.
@@ -1516,7 +1514,8 @@ class MachineManager(QObject):
         if self._global_container_stack is None:
             return
         machine_definition_id = self._global_container_stack.definition.id
-        variant_node = self._variant_manager.getVariantNode(machine_definition_id, variant_name)
+        machine_node = ContainerTree.getInstance().machines.get(machine_definition_id)
+        variant_node = machine_node.variants.get(variant_name)
         self.setVariant(position, variant_node)
 
     @pyqtSlot(str, "QVariant")

+ 2 - 2
resources/definitions/Mark2_for_Ultimaker2.def.json

@@ -209,10 +209,10 @@
             "enabled": false
         },
         "prime_tower_position_x": {
-            "default_value": 185
+            "value": "185"
         },
         "prime_tower_position_y": {
-            "default_value": 160
+            "value": "160"
         },
         "machine_disallowed_areas": {
             "default_value": [

+ 2 - 2
resources/definitions/bibo2_dual.def.json

@@ -85,10 +85,10 @@
             "default_value": 2
         },
         "prime_tower_position_x": {
-            "default_value": 50
+            "value": "50"
         },
         "prime_tower_position_y": {
-            "default_value": 50
+            "value": "50"
         }
     }
 }

+ 2 - 2
resources/definitions/builder_premium_large.def.json

@@ -50,8 +50,8 @@
         "speed_wall_0": { "value": "math.ceil(speed_wall * 20 / 25)" },
         "speed_wall_x": { "value": "speed_wall" },
 
-        "prime_tower_position_x": { "default_value": 175 },
-        "prime_tower_position_y": { "default_value": 178 },
+        "prime_tower_position_x": { "value": "175" },
+        "prime_tower_position_y": { "value": "178" },
         "prime_tower_wipe_enabled": { "default_value": false },
         "prime_tower_min_volume": { "default_value": 50 },
 

+ 2 - 2
resources/definitions/builder_premium_medium.def.json

@@ -50,8 +50,8 @@
         "speed_wall_0": { "value": "math.ceil(speed_wall * 20 / 25)" },
         "speed_wall_x": { "value": "speed_wall" },
 
-        "prime_tower_position_x": { "default_value": 175 },
-        "prime_tower_position_y": { "default_value": 178 },
+        "prime_tower_position_x": { "value": "175" },
+        "prime_tower_position_y": { "value": "178" },
         "prime_tower_wipe_enabled": { "default_value": false },
         "prime_tower_min_volume": { "default_value": 50 },
 

Некоторые файлы не были показаны из-за большого количества измененных файлов