Add a notice to linked materials and allow "unlinking" a material.

This commit is contained in:
fieldOfView 2017-04-29 19:49:12 +02:00
parent 23cd6b1c2c
commit 67b8302d40
2 changed files with 62 additions and 1 deletions

View file

@ -24,6 +24,16 @@ TabView
property double spoolLength: calculateSpoolLength()
property real costPerMeter: calculateCostPerMeter()
property string linkedMaterialNames:
{
if(!base.containerId || !base.editingEnabled)
{
return ""
}
var linkedMaterials = Cura.ContainerManager.getLinkedMaterials(base.containerId);
return linkedMaterials.join(", ");
}
Tab
{
title: catalog.i18nc("@title","Information")
@ -196,6 +206,23 @@ TabView
height: parent.rowHeight
}
Item { width: parent.width; height: UM.Theme.getSize("default_margin").height; visible: unlinkMaterialButton.visible }
Label
{
width: parent.width
verticalAlignment: Qt.AlignVCenter
text: catalog.i18nc("@label", "This material is linked to %1 and shares some of its properties.").arg(base.linkedMaterialNames)
wrapMode: Text.WordWrap
visible: unlinkMaterialButton.visible
}
Button
{
id: unlinkMaterialButton
text: catalog.i18nc("@label", "Unlink Material")
visible: base.linkedMaterialNames != ""
onClicked: Cura.ContainerManager.unlinkMaterial(base.containerId)
}
Item { width: parent.width; height: UM.Theme.getSize("default_margin").height }
Label { width: parent.width; height: parent.rowHeight; verticalAlignment: Qt.AlignVCenter; text: catalog.i18nc("@label", "Description") }