From 21e4f99b9db7d3205532bcfacab14ce08bdbd12f Mon Sep 17 00:00:00 2001 From: Saumya Jain Date: Mon, 22 Apr 2024 14:00:56 +0200 Subject: [PATCH] Add core compatibility check for Factor4 machine A new function has been added to the MachineManager class to check for core compatibility in the Factor4 machine. This function ensures the selected core is compatible for use with the Factor4 machine and if not, it displays a warning icon with an appropriate message. CURA-11851 --- cura/Settings/MachineManager.py | 18 ++++++++++++++++++ .../ConfigurationMenu/CustomConfiguration.qml | 11 ++++++----- resources/themes/cura-dark/theme.json | 2 ++ resources/themes/cura-light/theme.json | 1 + 4 files changed, 27 insertions(+), 5 deletions(-) diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index 1503fb5f39..ff6d95f3c3 100755 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -847,6 +847,24 @@ class MachineManager(QObject): return result + @pyqtProperty(bool, notify = activeMaterialChanged) + def variantCoreUsableForFactor4(self) -> bool: + """The selected core is usable if it is in second extruder of Factor4 + """ + result = True + if not self._global_container_stack: + return result + if self.activeMachine.id != "UltiMaker Factor 4": + return result + + for extruder_container in self._global_container_stack.extruderList: + if( extruder_container.id.startswith("ultimaker_factor4_extruder_right")): + if extruder_container.material == empty_material_container: + return True + if extruder_container.variant.id.startswith("ultimaker_factor4_bb"): + return False + return True + @pyqtSlot(str, result = str) def getDefinitionByMachineId(self, machine_id: str) -> Optional[str]: """Get the Definition ID of a machine (specified by ID) diff --git a/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml b/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml index d1bf323e7d..da703f767e 100644 --- a/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml +++ b/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml @@ -311,10 +311,11 @@ Item { id: warnings height: visible ? childrenRect.height : 0 - visible: buildplateCompatibilityError || buildplateCompatibilityWarning + visible: buildplateCompatibilityError || buildplateCompatibilityWarning || coreCompatibilityWarning property bool buildplateCompatibilityError: !Cura.MachineManager.variantBuildplateCompatible && !Cura.MachineManager.variantBuildplateUsable property bool buildplateCompatibilityWarning: Cura.MachineManager.variantBuildplateUsable + property bool coreCompatibilityWarning: !Cura.MachineManager.variantCoreUsableForFactor4 // This is a space holder aligning the warning messages. UM.Label @@ -335,8 +336,8 @@ Item source: UM.Theme.getIcon("Warning") width: UM.Theme.getSize("section_icon").width height: UM.Theme.getSize("section_icon").height - color: UM.Theme.getColor("material_compatibility_warning") - visible: !Cura.MachineManager.isCurrentSetupSupported || warnings.buildplateCompatibilityError || warnings.buildplateCompatibilityWarning + color: warnings.coreCompatibilityWarning? UM.Theme.getColor("core_compatibility_warning"): UM.Theme.getColor("material_compatibility_warning") + visible: !Cura.MachineManager.isCurrentSetupSupported || warnings.buildplateCompatibilityError || warnings.buildplateCompatibilityWarning || warnings.coreCompatibilityWarning } UM.Label @@ -345,8 +346,8 @@ Item anchors.left: warningImage.right anchors.leftMargin: UM.Theme.getSize("default_margin").width width: selectors.controlWidth - warningImage.width - UM.Theme.getSize("default_margin").width - text: catalog.i18nc("@label", "Use glue for better adhesion with this material combination.") - visible: CuraSDKVersion == "dev" ? false : warnings.buildplateCompatibilityError || warnings.buildplateCompatibilityWarning + text:warnings.coreCompatibilityWarning? catalog.i18nc("@label", "Combination not recommended. Load PVA in the left print-core for better reliability."): catalog.i18nc("@label", "Use glue for better adhesion with this material combination.") + visible: CuraSDKVersion == "dev" ? false : warnings.buildplateCompatibilityError || warnings.buildplateCompatibilityWarning|| warnings.coreCompatibilityWarning wrapMode: Text.WordWrap } } diff --git a/resources/themes/cura-dark/theme.json b/resources/themes/cura-dark/theme.json index 64c3e002a9..699b4537c3 100644 --- a/resources/themes/cura-dark/theme.json +++ b/resources/themes/cura-dark/theme.json @@ -179,6 +179,8 @@ "material_compatibility_warning": [255, 255, 255, 255], + "core_compatibility_warning": [255, 255, 255, 255], + "quality_slider_available": [255, 255, 255, 255], "monitor_printer_family_tag": [86, 86, 106, 255], diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index 8f3f9076c5..db2aebcd8f 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -349,6 +349,7 @@ "setting_validation_ok": "background_2", "material_compatibility_warning": [243, 166, 59, 255], + "core_compatibility_warning": [243, 166, 59, 255], "progressbar_background": [245, 245, 245, 255], "progressbar_control": [50, 130, 255, 255],