Merge branch 'feature_drag_curaprofile' of github.com:Ultimaker/Cura

This commit is contained in:
Jaime van Kessel 2016-11-04 14:31:58 +01:00
commit 2eb1c61033
3 changed files with 75 additions and 8 deletions

View file

@ -246,15 +246,35 @@ UM.MainWindow
{
if(drop.urls.length > 0)
{
// Import models
for(var i in drop.urls)
{
UM.MeshFileHandler.readLocalFile(drop.urls[i]);
if (i == drop.urls.length - 1)
{
var meshName = backgroundItem.getMeshName(drop.urls[i].toString())
backgroundItem.hasMesh(decodeURIComponent(meshName))
// There is no endsWith in this version of JS...
if ((drop.urls[i].length <= 12) || (drop.urls[i].substring(drop.urls[i].length-12) !== ".curaprofile")) {
// Drop an object
UM.MeshFileHandler.readLocalFile(drop.urls[i]);
if (i == drop.urls.length - 1)
{
var meshName = backgroundItem.getMeshName(drop.urls[i].toString());
backgroundItem.hasMesh(decodeURIComponent(meshName));
}
}
}
// Import profiles
var import_result = Cura.ContainerManager.importProfiles(drop.urls);
if (import_result.message !== "") {
messageDialog.text = import_result.message
if(import_result.status == "ok")
{
messageDialog.icon = StandardIcon.Information
}
else
{
messageDialog.icon = StandardIcon.Critical
}
messageDialog.open()
}
}
}
}

View file

@ -310,7 +310,7 @@ UM.ManagementPage
folder: CuraApplication.getDefaultPath("dialog_profile_path")
onAccepted:
{
var result = base.model.importProfile(fileUrl)
var result = Cura.ContainerManager.importProfile(fileUrl);
messageDialog.text = result.message
if(result.status == "ok")
{
@ -339,7 +339,7 @@ UM.ManagementPage
onAccepted:
{
var containers = Cura.ContainerManager.findInstanceContainers({"type": "quality_changes", "name": base.currentItem.name})
var result = base.model.exportProfile(containers, fileUrl, selectedNameFilter)
var result = Cura.ContainerManager.exportProfile(containers, fileUrl, selectedNameFilter)
if(result && result.status == "error")
{