mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-15 18:57:52 -06:00
Add typing and always add error message if loading failed
There were some places where it would return None. Then in the QML it would give a QML error that the null object has no dictionary items. Contributes to issue CURA-5929.
This commit is contained in:
parent
4551b73d5c
commit
9c555bf67f
2 changed files with 11 additions and 12 deletions
|
@ -419,13 +419,13 @@ class ContainerManager(QObject):
|
|||
self._container_name_filters[name_filter] = entry
|
||||
|
||||
## Import single profile, file_url does not have to end with curaprofile
|
||||
@pyqtSlot(QUrl, result="QVariantMap")
|
||||
def importProfile(self, file_url: QUrl):
|
||||
@pyqtSlot(QUrl, result = "QVariantMap")
|
||||
def importProfile(self, file_url: QUrl) -> Dict[str, str]:
|
||||
if not file_url.isValid():
|
||||
return
|
||||
return {"status": "error", "message": catalog.i18nc("@info:status", "Invalid file URL:") + " " + file_url}
|
||||
path = file_url.toLocalFile()
|
||||
if not path:
|
||||
return
|
||||
return {"status": "error", "message": catalog.i18nc("@info:status", "Invalid file URL:") + " " + file_url}
|
||||
return self._container_registry.importProfile(path)
|
||||
|
||||
@pyqtSlot(QObject, QUrl, str)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue