Validate material profile

CURA-4851
This commit is contained in:
alekseisasin 2018-01-31 14:58:44 +01:00
parent 36eded925c
commit e5c72cfdc5
3 changed files with 10 additions and 3 deletions

View file

@ -459,7 +459,7 @@ class ContainerManager(QObject):
# \return \type{Dict} dict with a 'status' key containing the string 'success' or 'error', and a 'message' key
# containing a message for the user
@pyqtSlot(QUrl, result = "QVariantMap")
def importContainer(self, file_url_or_string: Union[QUrl, str]) -> Dict[str, str]:
def importMaterialContainer(self, file_url_or_string: Union[QUrl, str]) -> Dict[str, str]:
if not file_url_or_string:
return { "status": "error", "message": "Invalid path"}
@ -490,8 +490,9 @@ class ContainerManager(QObject):
container.deserialize(f.read())
except PermissionError:
return { "status": "error", "message": "Permission denied when trying to read the file"}
except Exception as ex:
return {"status": "error", "message": str(ex)}
container.setName(container_id)
container.setDirty(True)
self._container_registry.addContainer(container)