Add some more information for the unhappy route and a message to inform the user.

CURA-6990
This commit is contained in:
j.delarago 2022-05-31 16:29:56 +02:00
parent 094c781b02
commit 29b6450704
2 changed files with 12 additions and 3 deletions

View file

@ -4,6 +4,7 @@ import os
from typing import Any, cast, Dict, List, Set, Tuple, TYPE_CHECKING, Optional from typing import Any, cast, Dict, List, Set, Tuple, TYPE_CHECKING, Optional
from UM.Logger import Logger
from cura.CuraApplication import CuraApplication # To find some resource types. from cura.CuraApplication import CuraApplication # To find some resource types.
from cura.Settings.GlobalStack import GlobalStack from cura.Settings.GlobalStack import GlobalStack
@ -70,9 +71,9 @@ class CuraPackageManager(PackageManager):
parsed_guid = XmlMaterialProfile.getMetadataFromSerialized(f.read(), "GUID") parsed_guid = XmlMaterialProfile.getMetadataFromSerialized(f.read(), "GUID")
if guid == parsed_guid: if guid == parsed_guid:
return package_id return package_id
continue
Logger.error("Could not find package_id for file: {} with GUID: {} ".format(file_name, guid))
return ""
def getMachinesUsingPackage(self, package_id: str) -> Tuple[List[Tuple[GlobalStack, str, str]], List[Tuple[GlobalStack, str, str]]]: def getMachinesUsingPackage(self, package_id: str) -> Tuple[List[Tuple[GlobalStack, str, str]], List[Tuple[GlobalStack, str, str]]]:
"""Returns a list of where the package is used """Returns a list of where the package is used

View file

@ -9,6 +9,7 @@ from UM.Math.Vector import Vector
from UM.Logger import Logger from UM.Logger import Logger
from UM.Math.Matrix import Matrix from UM.Math.Matrix import Matrix
from UM.Application import Application from UM.Application import Application
from UM.Message import Message
from UM.Scene.SceneNode import SceneNode from UM.Scene.SceneNode import SceneNode
from cura.CuraApplication import CuraApplication from cura.CuraApplication import CuraApplication
@ -269,7 +270,14 @@ class ThreeMFWriter(MeshWriter):
package_id = package_manager.getMaterialFilePackageId(extruder.material.getFileName(), extruder.material.getMetaDataEntry("GUID")) package_id = package_manager.getMaterialFilePackageId(extruder.material.getFileName(), extruder.material.getMetaDataEntry("GUID"))
package_data = package_manager.getInstalledPackageInfo(package_id) package_data = package_manager.getInstalledPackageInfo(package_id)
if not package_data or package_data.get("is_bundled"): if not package_data:
message = Message(catalog.i18nc("@error:uninstall",
"It was not possible to store material package information in project file: {material}. This project may not open correctly on other systems.".format(material=extruder.getName())),
title=catalog.i18nc("@info:title", "Failed to save material package information"),
message_type=Message.MessageType.WARNING)
message.show()
if package_data.get("is_bundled"):
continue continue
material_metadata = {"id": package_id, material_metadata = {"id": package_id,