mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-22 22:23:57 -06:00
WIP: Make material import work
This commit is contained in:
parent
0b859bb308
commit
581699cd8d
2 changed files with 36 additions and 8 deletions
|
@ -108,8 +108,8 @@ Item
|
||||||
text: catalog.i18nc("@action:button", "Import")
|
text: catalog.i18nc("@action:button", "Import")
|
||||||
iconName: "document-import"
|
iconName: "document-import"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
forceActiveFocus()
|
forceActiveFocus();
|
||||||
// TODO
|
importMaterialDialog.open();
|
||||||
}
|
}
|
||||||
visible: true
|
visible: true
|
||||||
}
|
}
|
||||||
|
@ -144,6 +144,34 @@ Item
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FileDialog
|
||||||
|
{
|
||||||
|
id: importMaterialDialog
|
||||||
|
title: catalog.i18nc("@title:window", "Import Material")
|
||||||
|
selectExisting: true
|
||||||
|
nameFilters: Cura.ContainerManager.getContainerNameFilters("material")
|
||||||
|
folder: CuraApplication.getDefaultPath("dialog_material_path")
|
||||||
|
onAccepted:
|
||||||
|
{
|
||||||
|
var result = Cura.ContainerManager.importMaterialContainer(fileUrl);
|
||||||
|
|
||||||
|
messageDialog.title = catalog.i18nc("@title:window", "Import Material");
|
||||||
|
messageDialog.text = catalog.i18nc("@info:status Don't translate the XML tags <filename> or <message>!", "Could not import material <filename>%1</filename>: <message>%2</message>").arg(fileUrl).arg(result.message);
|
||||||
|
if (result.status == "success") {
|
||||||
|
messageDialog.icon = StandardIcon.Information;
|
||||||
|
messageDialog.text = catalog.i18nc("@info:status Don't translate the XML tag <filename>!", "Successfully imported material <filename>%1</filename>").arg(fileUrl);
|
||||||
|
}
|
||||||
|
else if (result.status == "duplicate") {
|
||||||
|
messageDialog.icon = StandardIcon.Warning;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
messageDialog.icon = StandardIcon.Critical;
|
||||||
|
}
|
||||||
|
messageDialog.open();
|
||||||
|
CuraApplication.setDefaultPath("dialog_material_path", folder);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
FileDialog
|
FileDialog
|
||||||
{
|
{
|
||||||
id: exportMaterialDialog
|
id: exportMaterialDialog
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue