diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 7f68aed0b4..0d3ada2d97 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -154,6 +154,11 @@ jobs: - name: Create the Packages (Bash) run: conan install $CURA_CONAN_VERSION ${{ inputs.conan_args }} --build=missing --update -if cura_inst -g VirtualPythonEnv -o cura:enterprise=$ENTERPRISE -o cura:staging=$STAGING --json "cura_inst/conan_install_info.json" + - name: Upload the Package(s) + if: always() + run: | + conan upload "*" -r cura --all -c + - name: Set Environment variables for Cura (bash) run: | . ./cura_inst/bin/activate_github_actions_env.sh diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 6ba952d6bd..3667705952 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -154,6 +154,11 @@ jobs: - name: Create the Packages (Bash) run: conan install $CURA_CONAN_VERSION ${{ inputs.conan_args }} --build=missing --update -if cura_inst -g VirtualPythonEnv -o cura:enterprise=$ENTERPRISE -o cura:staging=$STAGING --json "cura_inst/conan_install_info.json" + - name: Upload the Package(s) + if: always() + run: | + conan upload "*" -r cura --all -c + - name: Set Environment variables for Cura (bash) run: | . ./cura_inst/bin/activate_github_actions_env.sh diff --git a/.github/workflows/requirements-conan-package.txt b/.github/workflows/requirements-conan-package.txt index 26d167db2b..6b4d4cffc8 100644 --- a/.github/workflows/requirements-conan-package.txt +++ b/.github/workflows/requirements-conan-package.txt @@ -1,2 +1,2 @@ -conan==1.56.0 +conan==1.60.2 sip diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 9844d7724c..5535f5f44f 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -124,6 +124,11 @@ jobs: - name: Create the Packages (Powershell) run: conan install $Env:CURA_CONAN_VERSION ${{ inputs.conan_args }} --build=missing --update -if cura_inst -g VirtualPythonEnv -o cura:enterprise=$Env:ENTERPRISE -o cura:staging=$Env:STAGING --json "cura_inst/conan_install_info.json" + - name: Upload the Package(s) + if: always() + run: | + conan upload "*" -r cura --all -c + - name: Set Environment variables for Cura (Powershell) run: | echo "${Env:WIX}\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append @@ -277,4 +282,4 @@ jobs: success_body: "Installers for ${{ inputs.cura_conan_version }}" failure_title: "Failed to create the Cura distributions" failure_body: "Failed to create at least 1 installer for ${{ inputs.cura_conan_version }}" - secrets: inherit \ No newline at end of file + secrets: inherit diff --git a/conanfile.py b/conanfile.py index 77cecf1134..1ab7d939af 100644 --- a/conanfile.py +++ b/conanfile.py @@ -10,7 +10,7 @@ from conan.tools.env import VirtualRunEnv, Environment, VirtualBuildEnv from conan.tools.scm import Version from conan.errors import ConanInvalidConfiguration, ConanException -required_conan_version = ">=1.54 <=1.56.0 || >=1.58.0 <2.0.0" +required_conan_version = ">=1.58.0 <2.0.0" class CuraConan(ConanFile): @@ -293,6 +293,7 @@ class CuraConan(ConanFile): self.options["pysavitar"].shared = True self.options["pynest2d"].shared = True self.options["cpython"].shared = True + self.options["boost"].header_only = True def validate(self): version = self.conf_info.get("user.cura:version", default = self.version, check_type = str) @@ -300,10 +301,11 @@ class CuraConan(ConanFile): raise ConanInvalidConfiguration("Only versions 5+ are support") def requirements(self): - self.requires("pyarcus/5.2.2") + self.requires("boost/1.82.0") + self.requires("pyarcus/(latest)@ultimaker/cura_10951") self.requires("curaengine/(latest)@ultimaker/testing") - self.requires("pysavitar/5.2.2") - self.requires("pynest2d/5.2.2") + self.requires("pysavitar/(latest)@ultimaker/cura_10951") + self.requires("pynest2d/(latest)@ultimaker/cura_10951") self.requires("uranium/(latest)@ultimaker/testing") self.requires("cura_binary_data/(latest)@ultimaker/testing") self.requires("cpython/3.10.4") @@ -338,7 +340,38 @@ class CuraConan(ConanFile): vr.generate() self._generate_cura_version(os.path.join(self.source_folder, "cura")) + self._generate_about_versions(os.path.join(self.source_folder, "resources","qml", "Dialogs")) + if not self.in_local_cache: + # Copy CuraEngine.exe to bindirs of Virtual Python Environment + curaengine = self.dependencies["curaengine"].cpp_info + copy(self, "CuraEngine.exe", curaengine.bindirs[0], self.source_folder, keep_path = False) + copy(self, "CuraEngine", curaengine.bindirs[0], self.source_folder, keep_path = False) + + # Copy resources of cura_binary_data + cura_binary_data = self.dependencies["cura_binary_data"].cpp_info + copy(self, "*", cura_binary_data.resdirs[0], str(self._share_dir.joinpath("cura")), keep_path = True) + copy(self, "*", cura_binary_data.resdirs[1], str(self._share_dir.joinpath("uranium")), keep_path = True) + if self.settings.os == "Windows": + copy(self, "*", cura_binary_data.resdirs[2], str(self._share_dir.joinpath("windows")), keep_path = True) + + for dependency in self.dependencies.host.values(): + for bindir in dependency.cpp_info.bindirs: + copy(self, "*.dll", bindir, str(self._site_packages), keep_path = False) + for libdir in dependency.cpp_info.libdirs: + copy(self, "*.pyd", libdir, str(self._site_packages), keep_path = False) + copy(self, "*.pyi", libdir, str(self._site_packages), keep_path = False) + copy(self, "*.dylib", libdir, str(self._base_dir.joinpath("lib")), keep_path = False) + + # Copy materials (flat) + rmdir(self, os.path.join(self.source_folder, "resources", "materials")) + fdm_materials = self.dependencies["fdm_materials"].cpp_info + copy(self, "*", fdm_materials.resdirs[0], self.source_folder) + + # Copy internal resources + if self.options.internal: + cura_private_data = self.dependencies["cura_private_data"].cpp_info + copy(self, "*", cura_private_data.resdirs[0], str(self._share_dir.joinpath("cura"))) if self.options.devtools: entitlements_file = "'{}'".format(os.path.join(self.source_folder, "packaging", "MacOS", "cura.entitlements")) @@ -357,8 +390,6 @@ class CuraConan(ConanFile): pot = self.python_requires["translationextractor"].module.ExtractTranslations(self, cpp_info.bindirs[0]) pot.generate() - self._generate_about_versions(os.path.join(self.source_folder, "resources","qml", "Dialogs")) - def build(self): if self.options.devtools: if self.settings.os != "Windows" or self.conf.get("tools.microsoft.bash:path", check_type = str): @@ -370,29 +401,6 @@ class CuraConan(ConanFile): cpp_info = self.dependencies["gettext"].cpp_info self.run(f"{cpp_info.bindirs[0]}/msgfmt {po_file} -o {mo_file} -f", env="conanbuild", ignore_errors=True) - def imports(self): - self.copy("CuraEngine.exe", root_package = "curaengine", src = "@bindirs", dst = "", keep_path = False) - self.copy("CuraEngine", root_package = "curaengine", src = "@bindirs", dst = "", keep_path = False) - - rmdir(self, os.path.join(self.source_folder, "resources", "materials")) - self.copy("*.fdm_material", root_package = "fdm_materials", src = "@resdirs", dst = "resources/materials", keep_path = False) - self.copy("*.sig", root_package = "fdm_materials", src = "@resdirs", dst = "resources/materials", keep_path = False) - - if self.options.internal: - self.copy("*", root_package = "cura_private_data", src = self.deps_cpp_info["cura_private_data"].resdirs[0], - dst = self._share_dir.joinpath("cura", "resources"), keep_path = True) - - # Copy resources of cura_binary_data - self.copy("*", root_package = "cura_binary_data", src = self.deps_cpp_info["cura_binary_data"].resdirs[0], - dst = self._share_dir.joinpath("cura", "resources"), keep_path = True) - self.copy("*", root_package = "cura_binary_data", src = self.deps_cpp_info["cura_binary_data"].resdirs[1], - dst =self._share_dir.joinpath("uranium", "resources"), keep_path = True) - - self.copy("*.dll", src = "@bindirs", dst = self._site_packages) - self.copy("*.pyd", src = "@libdirs", dst = self._site_packages) - self.copy("*.pyi", src = "@libdirs", dst = self._site_packages) - self.copy("*.dylib", src = "@libdirs", dst = self._script_dir) - def deploy(self): # Copy CuraEngine.exe to bindirs of Virtual Python Environment curaengine = self.dependencies["curaengine"].cpp_info diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 44ea69bd74..0b5ccab439 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -410,7 +410,9 @@ class CuraApplication(QtApplication): SettingFunction.registerOperator("extruderValue", self._cura_formula_functions.getValueInExtruder) SettingFunction.registerOperator("extruderValues", self._cura_formula_functions.getValuesInAllExtruders) - SettingFunction.registerOperator("anyExtruderNrWithOrDefault", self._cura_formula_functions.getAnyExtruderPositionWithOrDefault) + SettingFunction.registerOperator("anyExtruderWithMaterial", self._cura_formula_functions.getExtruderPositionWithMaterial) + SettingFunction.registerOperator("anyExtruderNrWithOrDefault", + self._cura_formula_functions.getAnyExtruderPositionWithOrDefault) SettingFunction.registerOperator("resolveOrValue", self._cura_formula_functions.getResolveOrValue) SettingFunction.registerOperator("defaultExtruderPosition", self._cura_formula_functions.getDefaultExtruderPosition) SettingFunction.registerOperator("valueFromContainer", self._cura_formula_functions.getValueFromContainerAtIndex) diff --git a/cura/Scene/ConvexHullDecorator.py b/cura/Scene/ConvexHullDecorator.py index 06ec247ae4..0dbf3ba782 100644 --- a/cura/Scene/ConvexHullDecorator.py +++ b/cura/Scene/ConvexHullDecorator.py @@ -111,11 +111,7 @@ class ConvexHullDecorator(SceneNodeDecorator): # Parent can be None if node is just loaded. if self._isSingularOneAtATimeNode(): - hull = self.getConvexHullHeadFull() - if hull is None: - return None - hull = self._add2DAdhesionMargin(hull) - return hull + return self.getConvexHullHeadFull() return self._compute2DConvexHull() @@ -323,6 +319,7 @@ class ConvexHullDecorator(SceneNodeDecorator): def _compute2DConvexHeadFull(self) -> Optional[Polygon]: convex_hull = self._compute2DConvexHull() + convex_hull = self._add2DAdhesionMargin(convex_hull) if convex_hull: return convex_hull.getMinkowskiHull(self._getHeadAndFans()) return None diff --git a/cura/Settings/CuraFormulaFunctions.py b/cura/Settings/CuraFormulaFunctions.py index fd6555e679..d7b6228e09 100644 --- a/cura/Settings/CuraFormulaFunctions.py +++ b/cura/Settings/CuraFormulaFunctions.py @@ -99,12 +99,21 @@ class CuraFormulaFunctions: # Get the first extruder that adheres to a specific (boolean) property, like 'material_is_support_material'. def getAnyExtruderPositionWithOrDefault(self, filter_key: str, - context: Optional["PropertyEvaluationContext"] = None) -> str: + context: Optional["PropertyEvaluationContext"] = None) -> str: for extruder in self._getActiveExtruders(context): value = extruder.getRawProperty(filter_key, "value", context=context) if value is None or not value: continue return str(extruder.position) + + # Get the first extruder with material that adheres to a specific (boolean) property, like 'material_is_support_material'. + def getExtruderPositionWithMaterial(self, filter_key: str, + context: Optional["PropertyEvaluationContext"] = None) -> str: + for extruder in self._getActiveExtruders(context): + material_container = extruder.material + value = material_container.getProperty(filter_key, "value", context) + if value is not None: + return str(extruder.position) return self.getDefaultExtruderPosition() # Get the resolve value or value for a given key. diff --git a/docs/profiles/getting_a_setting_value.md b/docs/profiles/getting_a_setting_value.md index bd106eb2da..7cd912ac45 100644 --- a/docs/profiles/getting_a_setting_value.md +++ b/docs/profiles/getting_a_setting_value.md @@ -54,7 +54,10 @@ There are also a few extra things that can be used in these expressions: * The function `extruderValue(extruder, key)` will evaluate a particular setting for a particular extruder. * The function `resolveOrValue(key)` will perform the full setting evaluation as described in this document for the current context (so if this setting is being evaluated for the second extruder it would perform it as if coming from the second extruder). * The function `defaultExtruderPosition()` will get the first extruder that is not disabled. For instance, if a printer has three extruders but the first is disabled, this would return `1` to indicate the second extruder (0-indexed). -* The function `anyExtruderNrWithOrDefault(key)` will filter the list of extruders on the key, and then give the first index for which it is true, or if none of them are, the default one as specified by the 'default extruder position' function above. +* The function `anyExtruderNrWithOrDefault(key)` will filter the list of extruders on the key, and then give the first + index for which it is true, or if none of them are, the default one as specified by the 'default extruder position' + function above. +* The function `anyExtruderWithMaterial(key)` will filter the list of extruders on the key of material quality, and then give the first index for which it is true, or if none of them are, the default one as specified by the 'default extruder position' function above. * The function `valueFromContainer(key, index)` will get a setting value from the global stack, but skip the first few containers in that stack. It will skip until it reaches a particular index in the container stack. * The function `extruderValueFromContainer(key, index)` will get a setting value from the current extruder stack, but skip the first few containers in that stack. It will skip until it reaches a particular index in the container stack. diff --git a/packaging/MacOS/build_macos.py b/packaging/MacOS/build_macos.py index bde28afab0..eae9afceff 100644 --- a/packaging/MacOS/build_macos.py +++ b/packaging/MacOS/build_macos.py @@ -153,6 +153,6 @@ if __name__ == "__main__": app_name = f"{args.app_name}.app" if args.build_pkg: - create_pkg_installer(args.filename + ".pkg", args.dist_path, cura_version, app_name) + create_pkg_installer(f"{args.filename}.pkg", args.dist_path, cura_version, app_name) if args.build_dmg: - create_dmg(args.filename + ".dmg", args.dist_path, args.source_path, app_name) + create_dmg(f"{args.filename}.dmg", args.dist_path, args.source_path, app_name) diff --git a/plugins/RemovableDriveOutputDevice/RemovableDriveOutputDevice.py b/plugins/RemovableDriveOutputDevice/RemovableDriveOutputDevice.py index e93473c25f..8c0c50d0b4 100644 --- a/plugins/RemovableDriveOutputDevice/RemovableDriveOutputDevice.py +++ b/plugins/RemovableDriveOutputDevice/RemovableDriveOutputDevice.py @@ -1,6 +1,7 @@ # Copyright (c) 2018 Ultimaker B.V. # Cura is released under the terms of the LGPLv3 or higher. +import os import os.path from UM.Application import Application @@ -143,38 +144,44 @@ class RemovableDriveOutputDevice(OutputDevice): def _onFinished(self, job): if self._stream: - # Explicitly closing the stream flushes the write-buffer + error = job.getError() try: + # Explicitly closing the stream flushes the write-buffer self._stream.close() - self._stream = None - except: - Logger.logException("w", "An exception occurred while trying to write to removable drive.") - message = Message(catalog.i18nc("@info:status", "Could not save to removable drive {0}: {1}").format(self.getName(),str(job.getError())), - title = catalog.i18nc("@info:title", "Error"), - message_type = Message.MessageType.ERROR) + except Exception as e: + if not error: + # Only log new error if there was no previous one + error = e + + self._stream = None + self._writing = False + self.writeFinished.emit(self) + + if not error: + message = Message( + catalog.i18nc("@info:status", "Saved to Removable Drive {0} as {1}").format(self.getName(), + os.path.basename( + job.getFileName())), + title=catalog.i18nc("@info:title", "File Saved"), + message_type=Message.MessageType.POSITIVE) + message.addAction("eject", catalog.i18nc("@action:button", "Eject"), "eject", + catalog.i18nc("@action", "Eject removable device {0}").format(self.getName())) + message.actionTriggered.connect(self._onActionTriggered) + message.show() + self.writeSuccess.emit(self) + else: + try: + os.remove(job.getFileName()) + except Exception as e: + Logger.logException("e", "Exception when trying to remove incomplete exported file %s", + str(job.getFileName())) + message = Message(catalog.i18nc("@info:status", + "Could not save to removable drive {0}: {1}").format(self.getName(), + str(job.getError())), + title=catalog.i18nc("@info:title", "Error"), + message_type=Message.MessageType.ERROR) message.show() self.writeError.emit(self) - return - - self._writing = False - self.writeFinished.emit(self) - if job.getResult(): - message = Message(catalog.i18nc("@info:status", "Saved to Removable Drive {0} as {1}").format(self.getName(), os.path.basename(job.getFileName())), - title = catalog.i18nc("@info:title", "File Saved"), - message_type = Message.MessageType.POSITIVE) - message.addAction("eject", catalog.i18nc("@action:button", "Eject"), "eject", catalog.i18nc("@action", "Eject removable device {0}").format(self.getName())) - message.actionTriggered.connect(self._onActionTriggered) - message.show() - self.writeSuccess.emit(self) - else: - message = Message(catalog.i18nc("@info:status", - "Could not save to removable drive {0}: {1}").format(self.getName(), - str(job.getError())), - title = catalog.i18nc("@info:title", "Error"), - message_type = Message.MessageType.ERROR) - message.show() - self.writeError.emit(self) - job.getStream().close() def _onActionTriggered(self, message, action): if action == "eject": diff --git a/plugins/UM3NetworkPrinting/src/Messages/NewPrinterDetectedMessage.py b/plugins/UM3NetworkPrinting/src/Messages/NewPrinterDetectedMessage.py index d85ade9dce..76254547da 100644 --- a/plugins/UM3NetworkPrinting/src/Messages/NewPrinterDetectedMessage.py +++ b/plugins/UM3NetworkPrinting/src/Messages/NewPrinterDetectedMessage.py @@ -37,24 +37,13 @@ class NewPrinterDetectedMessage(Message): def finalize(self, new_devices_added, new_output_devices): self.setProgress(None) - num_devices_added = len(new_devices_added) - max_disp_devices = 3 - - if num_devices_added > max_disp_devices: - num_hidden = num_devices_added - max_disp_devices - device_name_list = ["