mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 06:57:28 -06:00
Correctly differentiate between plugins and materials in missing packages dialog
CURA-10719
This commit is contained in:
parent
42002dac36
commit
0e77a05c74
3 changed files with 21 additions and 5 deletions
|
@ -310,7 +310,7 @@ class ThreeMFWriter(MeshWriter):
|
||||||
"package_version": package_data.get("package_version") if package_data.get("package_version") else "",
|
"package_version": package_data.get("package_version") if package_data.get("package_version") else "",
|
||||||
"sdk_version_semver": package_data.get("sdk_version_semver") if package_data.get(
|
"sdk_version_semver": package_data.get("sdk_version_semver") if package_data.get(
|
||||||
"sdk_version_semver") else "",
|
"sdk_version_semver") else "",
|
||||||
"type": "backend_plugin",
|
"type": "plugin",
|
||||||
}
|
}
|
||||||
|
|
||||||
# Storing in a dict and fetching values to avoid duplicates
|
# Storing in a dict and fetching values to avoid duplicates
|
||||||
|
|
|
@ -20,7 +20,6 @@ class MissingPackageList(RemotePackageList):
|
||||||
def __init__(self, packages_metadata: List[Dict[str, str]], parent: Optional["QObject"] = None) -> None:
|
def __init__(self, packages_metadata: List[Dict[str, str]], parent: Optional["QObject"] = None) -> None:
|
||||||
super().__init__(parent)
|
super().__init__(parent)
|
||||||
self._packages_metadata: List[Dict[str, str]] = packages_metadata
|
self._packages_metadata: List[Dict[str, str]] = packages_metadata
|
||||||
self._package_type_filter = "material"
|
|
||||||
self._search_type = "package_ids"
|
self._search_type = "package_ids"
|
||||||
self._requested_search_string = ",".join(map(lambda package: package["id"], packages_metadata))
|
self._requested_search_string = ",".join(map(lambda package: package["id"], packages_metadata))
|
||||||
|
|
||||||
|
@ -38,7 +37,14 @@ class MissingPackageList(RemotePackageList):
|
||||||
|
|
||||||
for package_metadata in self._packages_metadata:
|
for package_metadata in self._packages_metadata:
|
||||||
if package_metadata["id"] not in returned_packages_ids:
|
if package_metadata["id"] not in returned_packages_ids:
|
||||||
package = PackageModel.fromIncompletePackageInformation(package_metadata["display_name"], package_metadata["package_version"], self._package_type_filter)
|
package_type = package_metadata["type"] if "type" in package_metadata else "material"
|
||||||
|
# When this feature was originally introduced only missing materials were detected. With the inclusion
|
||||||
|
# of backend plugins this system was extended to also detect missing plugins. With that change the type
|
||||||
|
# of the package was added to the metadata. Project files before this change do not have this type. So
|
||||||
|
# if the type is not present we assume it is a material.
|
||||||
|
package = PackageModel.fromIncompletePackageInformation(package_metadata["display_name"],
|
||||||
|
package_metadata["package_version"],
|
||||||
|
package_type)
|
||||||
self.appendItem({"package": package})
|
self.appendItem({"package": package})
|
||||||
|
|
||||||
self.itemsChanged.emit()
|
self.itemsChanged.emit()
|
||||||
|
|
|
@ -87,12 +87,22 @@ class PackageModel(QObject):
|
||||||
self._is_missing_package_information = False
|
self._is_missing_package_information = False
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def fromIncompletePackageInformation(cls, display_name: str, package_version: str, package_type: str) -> "PackageModel":
|
def fromIncompletePackageInformation(cls, display_name: str, package_version: str,
|
||||||
|
package_type: str) -> "PackageModel":
|
||||||
|
description = ""
|
||||||
|
match package_type:
|
||||||
|
case "material":
|
||||||
|
description = catalog.i18nc("@label:label Ultimaker Marketplace is a brand name, don't translate",
|
||||||
|
"The material package associated with the Cura project could not be found on the Ultimaker Marketplace. Use the partial material profile definition stored in the Cura project file at your own risk.")
|
||||||
|
case "plugin":
|
||||||
|
description = catalog.i18nc("@label:label Ultimaker Marketplace is a brand name, don't translate",
|
||||||
|
"The plugin associated with the Cura project could not be found on the Ultimaker Marketplace. As the plugin may be required to slice the project it might not be possible to correctly slice the file.")
|
||||||
|
|
||||||
package_data = {
|
package_data = {
|
||||||
"display_name": display_name,
|
"display_name": display_name,
|
||||||
"package_version": package_version,
|
"package_version": package_version,
|
||||||
"package_type": package_type,
|
"package_type": package_type,
|
||||||
"description": catalog.i18nc("@label:label Ultimaker Marketplace is a brand name, don't translate", "The material package associated with the Cura project could not be found on the Ultimaker Marketplace. Use the partial material profile definition stored in the Cura project file at your own risk.")
|
"description": description,
|
||||||
}
|
}
|
||||||
package_model = cls(package_data)
|
package_model = cls(package_data)
|
||||||
package_model.setIsMissingPackageInformation(True)
|
package_model.setIsMissingPackageInformation(True)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue