mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-04-23 06:09:38 +08:00
WIP: Cleanup ContainerManager
This commit is contained in:
parent
2cd9891000
commit
7e84e7570f
@ -706,34 +706,6 @@ class ContainerManager(QObject):
|
|||||||
quality_changes.addMetaDataEntry("setting_version", CuraApplication.SettingVersion)
|
quality_changes.addMetaDataEntry("setting_version", CuraApplication.SettingVersion)
|
||||||
return quality_changes
|
return quality_changes
|
||||||
|
|
||||||
|
|
||||||
## Import profiles from a list of file_urls.
|
|
||||||
# Each QUrl item must end with .curaprofile, or it will not be imported.
|
|
||||||
#
|
|
||||||
# \param QVariant<QUrl>, essentially a list with QUrl objects.
|
|
||||||
# \return Dict with keys status, text
|
|
||||||
@pyqtSlot("QVariantList", result="QVariantMap")
|
|
||||||
def importProfiles(self, file_urls):
|
|
||||||
status = "ok"
|
|
||||||
results = {"ok": [], "error": []}
|
|
||||||
for file_url in file_urls:
|
|
||||||
if not file_url.isValid():
|
|
||||||
continue
|
|
||||||
path = file_url.toLocalFile()
|
|
||||||
if not path:
|
|
||||||
continue
|
|
||||||
if not path.endswith(".curaprofile"):
|
|
||||||
continue
|
|
||||||
|
|
||||||
single_result = self._container_registry.importProfile(path)
|
|
||||||
if single_result["status"] == "error":
|
|
||||||
status = "error"
|
|
||||||
results[single_result["status"]].append(single_result["message"])
|
|
||||||
|
|
||||||
return {
|
|
||||||
"status": status,
|
|
||||||
"message": "\n".join(results["ok"] + results["error"])}
|
|
||||||
|
|
||||||
## Import single profile, file_url does not have to end with curaprofile
|
## Import single profile, file_url does not have to end with curaprofile
|
||||||
@pyqtSlot(QUrl, result="QVariantMap")
|
@pyqtSlot(QUrl, result="QVariantMap")
|
||||||
def importProfile(self, file_url):
|
def importProfile(self, file_url):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user