From b2a2e8ed6445e95356aa3521c87a22b22d8cb019 Mon Sep 17 00:00:00 2001 From: Tim Kuipers Date: Wed, 28 Feb 2018 13:44:45 +0100 Subject: [PATCH 1/7] support_wall_count setting --- resources/definitions/fdmprinter.def.json | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/resources/definitions/fdmprinter.def.json b/resources/definitions/fdmprinter.def.json index d282eeae0a..883cd1ecef 100644 --- a/resources/definitions/fdmprinter.def.json +++ b/resources/definitions/fdmprinter.def.json @@ -3574,6 +3574,19 @@ "settable_per_mesh": false, "settable_per_extruder": true }, + "support_wall_count": + { + "label": "Support Wall Line Count", + "description": "The number of walls with which to surround support infill. Adding a wall can make support print more reliably and can support overhangs better, but increases print time and material used.", + "default_value": 1, + "minimum_value": "0", + "minimum_value_warning": "1 if support_pattern == 'concentric' else 0", + "maximum_value_warning": "3", + "type": "int", + "value": "1 if (support_pattern == 'grid' or support_pattern == 'triangles' or support_pattern == 'concentric') else 0", + "limit_to_extruder": "support_infill_extruder_nr", + "settable_per_mesh": true + }, "zig_zaggify_support": { "label": "Connect Support Lines", From 70ca0538320d640c843f3d46b1ae6c39e841102d Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Tue, 15 May 2018 15:32:02 +0200 Subject: [PATCH 2/7] CURA-5358 Add the quality folder to the scope of the VersionUpgrade --- cura/CuraApplication.py | 1 + 1 file changed, 1 insertion(+) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 80390c907f..034d045ce6 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -207,6 +207,7 @@ class CuraApplication(QtApplication): UM.VersionUpgradeManager.VersionUpgradeManager.getInstance().setCurrentVersions( { + ("quality", InstanceContainer.Version * 1000000 + self.SettingVersion): (self.ResourceTypes.QualityInstanceContainer, "application/x-uranium-instancecontainer"), ("quality_changes", InstanceContainer.Version * 1000000 + self.SettingVersion): (self.ResourceTypes.QualityChangesInstanceContainer, "application/x-uranium-instancecontainer"), ("machine_stack", ContainerStack.Version * 1000000 + self.SettingVersion): (self.ResourceTypes.MachineStack, "application/x-cura-globalstack"), ("extruder_train", ContainerStack.Version * 1000000 + self.SettingVersion): (self.ResourceTypes.ExtruderStack, "application/x-cura-extruderstack"), From 5345bc2867842b9798fa6ecac5dcc6b5ab3e83f2 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Tue, 15 May 2018 16:08:19 +0200 Subject: [PATCH 3/7] CURA-5358 Fill the dictionaries also if it's a custom material. But making difference between those materials that depend on a built-in material and those that don't depend on others. --- cura/Machines/MaterialManager.py | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/cura/Machines/MaterialManager.py b/cura/Machines/MaterialManager.py index 719795ac45..ad3c7f165f 100644 --- a/cura/Machines/MaterialManager.py +++ b/cura/Machines/MaterialManager.py @@ -113,8 +113,6 @@ class MaterialManager(QObject): grouped_by_type_dict = dict() material_types_without_fallback = set() for root_material_id, material_node in self._material_group_map.items(): - if not self._container_registry.isReadOnly(root_material_id): - continue material_type = material_node.root_material_node.metadata["material"] if material_type not in grouped_by_type_dict: grouped_by_type_dict[material_type] = {"generic": None, @@ -127,9 +125,15 @@ class MaterialManager(QObject): diameter = material_node.root_material_node.metadata.get("approximate_diameter") if diameter != self._default_approximate_diameter_for_quality_search: to_add = False # don't add if it's not the default diameter + if to_add: - grouped_by_type_dict[material_type] = material_node.root_material_node.metadata - material_types_without_fallback.remove(material_type) + # Checking this first allow us to differentiate between not read only materials: + # - if it's in the list, it means that is a new material without fallback + # - if it is not, then it is a custom material with a fallback material (parent) + if material_type in material_types_without_fallback: + grouped_by_type_dict[material_type] = material_node.root_material_node.metadata + material_types_without_fallback.remove(material_type) + # Remove the materials that have no fallback materials for material_type in material_types_without_fallback: del grouped_by_type_dict[material_type] @@ -147,9 +151,6 @@ class MaterialManager(QObject): material_group_dict = dict() keys_to_fetch = ("name", "material", "brand", "color") for root_material_id, machine_node in self._material_group_map.items(): - if not self._container_registry.isReadOnly(root_material_id): - continue - root_material_metadata = machine_node.root_material_node.metadata key_data = [] @@ -157,8 +158,13 @@ class MaterialManager(QObject): key_data.append(root_material_metadata.get(key)) key_data = tuple(key_data) + # If the key_data doesn't exist, no matter if the material is read only... if key_data not in material_group_dict: material_group_dict[key_data] = dict() + else: + # ...but if key_data exists, we just overrite it if the material is read only, otherwise we skip it + if not machine_node.is_read_only: + continue approximate_diameter = root_material_metadata.get("approximate_diameter") material_group_dict[key_data][approximate_diameter] = root_material_metadata["id"] From fd73751b91f32a5b0b1b3ed8a4af6933211b84c5 Mon Sep 17 00:00:00 2001 From: Jack Ha Date: Tue, 15 May 2018 16:10:01 +0200 Subject: [PATCH 4/7] Make the ToolboxProgressButton labels actually overrideable --- .../Toolbox/resources/qml/ToolboxProgressButton.qml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/plugins/Toolbox/resources/qml/ToolboxProgressButton.qml b/plugins/Toolbox/resources/qml/ToolboxProgressButton.qml index d3aafae987..a977ef999b 100644 --- a/plugins/Toolbox/resources/qml/ToolboxProgressButton.qml +++ b/plugins/Toolbox/resources/qml/ToolboxProgressButton.qml @@ -14,9 +14,9 @@ Item property var active: false property var complete: false - property var readyLabel: "Install" - property var activeLabel: "Installing" - property var completeLabel: "Installed" + property var readyLabel: catalog.i18nc("@action:button", "Install") + property var activeLabel: catalog.i18nc("@action:button", "Cancel") + property var completeLabel: catalog.i18nc("@action:button", "Installed") property var readyAction: null // Action when button is ready and clicked (likely install) property var activeAction: null // Action when button is active and clicked (likely cancel) @@ -32,15 +32,15 @@ Item { if (complete) { - return catalog.i18nc("@action:button", "Installed") + return completeLabel } else if (active) { - return catalog.i18nc("@action:button", "Cancel") + return activeLabel } else { - return catalog.i18nc("@action:button", "Install") + return readyLabel } } onClicked: From 9281c235557e22102fc5d6f418178c5c36cb27a9 Mon Sep 17 00:00:00 2001 From: Jack Ha Date: Tue, 15 May 2018 16:23:54 +0200 Subject: [PATCH 5/7] Fix uninstallable user package which was also bundled; make update package somewhat better by not trying to uninstall builtin package --- cura/CuraPackageManager.py | 10 +++++++--- plugins/Toolbox/src/Toolbox.py | 3 ++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/cura/CuraPackageManager.py b/cura/CuraPackageManager.py index ec75174db4..2006c8804b 100644 --- a/cura/CuraPackageManager.py +++ b/cura/CuraPackageManager.py @@ -171,7 +171,7 @@ class CuraPackageManager(QObject): package_info["is_active"] = self._plugin_registry.isActivePlugin(package_id) # If the package ID is in bundled, label it as such - package_info["is_bundled"] = package_info["package_id"] in self._bundled_package_dict.keys() + package_info["is_bundled"] = package_info["package_id"] in self._bundled_package_dict.keys() and not self.isUserInstalledPackage(package_info["package_id"]) # If there is not a section in the dict for this type, add it if package_info["package_type"] not in installed_packages_dict: @@ -182,7 +182,7 @@ class CuraPackageManager(QObject): return installed_packages_dict - # Checks if the given package is installed. + # Checks if the given package is installed (at all). def isPackageInstalled(self, package_id: str) -> bool: return self.getInstalledPackageInfo(package_id) is not None @@ -242,7 +242,7 @@ class CuraPackageManager(QObject): Logger.log("i", "Attempt to remove package [%s] that is not installed, do nothing.", package_id) return - # Temp hack + # Extra safety check if package_id not in self._installed_package_dict and package_id in self._bundled_package_dict: Logger.log("i", "Not uninstalling [%s] because it is a bundled package.") return @@ -258,6 +258,10 @@ class CuraPackageManager(QObject): self._saveManagementData() self.installedPackagesChanged.emit() + ## Is the package an user installed package? + def isUserInstalledPackage(self, package_id: str): + return package_id in self._installed_package_dict + # Removes everything associated with the given package ID. def _purgePackage(self, package_id: str) -> None: # Iterate through all directories in the data storage directory and look for sub-directories that belong to diff --git a/plugins/Toolbox/src/Toolbox.py b/plugins/Toolbox/src/Toolbox.py index 07a7bcbe73..622198666d 100644 --- a/plugins/Toolbox/src/Toolbox.py +++ b/plugins/Toolbox/src/Toolbox.py @@ -232,7 +232,8 @@ class Toolbox(QObject, Extension): if remote_package: download_url = remote_package["download_url"] Logger.log("d", "Updating package [%s]..." % plugin_id) - self.uninstall(plugin_id) + if self._package_manager.isUserInstalledPackage(plugin_id): + self.uninstall(plugin_id) self.startDownload(download_url) else: Logger.log("e", "Could not update package [%s] because there is no remote package info available.", plugin_id) From 27c8b43133e8c2d7f04d46c6e9ef8b956c07260f Mon Sep 17 00:00:00 2001 From: Aleksei S Date: Tue, 15 May 2018 16:43:02 +0200 Subject: [PATCH 6/7] Added setting "support_wall_count" to the expert setting's visibility list --- resources/definitions/fdmprinter.def.json | 1 + resources/setting_visibility/expert.cfg | 1 + 2 files changed, 2 insertions(+) diff --git a/resources/definitions/fdmprinter.def.json b/resources/definitions/fdmprinter.def.json index 38d50fb7e3..5d7eed5c6d 100644 --- a/resources/definitions/fdmprinter.def.json +++ b/resources/definitions/fdmprinter.def.json @@ -3713,6 +3713,7 @@ "maximum_value_warning": "3", "type": "int", "value": "1 if (support_pattern == 'grid' or support_pattern == 'triangles' or support_pattern == 'concentric') else 0", + "enabled": "support_enable", "limit_to_extruder": "support_infill_extruder_nr", "settable_per_mesh": true }, diff --git a/resources/setting_visibility/expert.cfg b/resources/setting_visibility/expert.cfg index d6989f8b26..db271cc985 100644 --- a/resources/setting_visibility/expert.cfg +++ b/resources/setting_visibility/expert.cfg @@ -220,6 +220,7 @@ support_bottom_extruder_nr support_type support_angle support_pattern +support_wall_count zig_zaggify_support support_connect_zigzags support_infill_rate From bc965bacfc9528d123a39e8061d3e48f3c09771c Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Tue, 15 May 2018 16:46:07 +0200 Subject: [PATCH 7/7] CURA-5358 Not use the prefix for installing packages and so no need to rename directories for the packaged files --- cura/CuraPackageManager.py | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/cura/CuraPackageManager.py b/cura/CuraPackageManager.py index c765587eef..de57e5417a 100644 --- a/cura/CuraPackageManager.py +++ b/cura/CuraPackageManager.py @@ -18,9 +18,6 @@ from UM.Version import Version class CuraPackageManager(QObject): Version = 1 - # The prefix that's added to all files for an installed package to avoid naming conflicts with user created files. - PREFIX_PLACE_HOLDER = "-CP;" - def __init__(self, parent = None): super().__init__(parent) @@ -305,27 +302,15 @@ class CuraPackageManager(QObject): if not os.path.exists(src_dir_path): continue - - # Need to rename the container files so they don't get ID conflicts - to_rename_files = sub_dir_name not in ("plugins",) - self.__installPackageFiles(package_id, src_dir_path, dst_dir_path, need_to_rename_files= to_rename_files) + self.__installPackageFiles(package_id, src_dir_path, dst_dir_path) # Remove the file os.remove(filename) - def __installPackageFiles(self, package_id: str, src_dir: str, dst_dir: str, need_to_rename_files: bool = True) -> None: + def __installPackageFiles(self, package_id: str, src_dir: str, dst_dir: str) -> None: + Logger.log("i", "Moving package {package_id} from {src_dir} to {dst_dir}".format(package_id=package_id, src_dir=src_dir, dst_dir=dst_dir)) shutil.move(src_dir, dst_dir) - # Rename files if needed - if not need_to_rename_files: - return - for root, _, file_names in os.walk(dst_dir): - for filename in file_names: - new_filename = self.PREFIX_PLACE_HOLDER + package_id + "-" + filename - old_file_path = os.path.join(root, filename) - new_file_path = os.path.join(root, new_filename) - os.rename(old_file_path, new_file_path) - # Gets package information from the given file. def getPackageInfo(self, filename: str) -> Dict[str, Any]: with zipfile.ZipFile(filename) as archive: