mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-25 15:44:04 -06:00
Brackets on new line
As per our code style.
This commit is contained in:
parent
10e474ad27
commit
f35005c8ba
1 changed files with 31 additions and 16 deletions
|
@ -30,20 +30,24 @@ TabView
|
||||||
property bool reevaluateLinkedMaterials: false
|
property bool reevaluateLinkedMaterials: false
|
||||||
property string linkedMaterialNames:
|
property string linkedMaterialNames:
|
||||||
{
|
{
|
||||||
if (reevaluateLinkedMaterials) {
|
if (reevaluateLinkedMaterials)
|
||||||
|
{
|
||||||
reevaluateLinkedMaterials = false;
|
reevaluateLinkedMaterials = false;
|
||||||
}
|
}
|
||||||
if (!base.containerId || !base.editingEnabled) {
|
if (!base.containerId || !base.editingEnabled)
|
||||||
|
{
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
var linkedMaterials = Cura.ContainerManager.getLinkedMaterials(base.currentMaterialNode, true);
|
var linkedMaterials = Cura.ContainerManager.getLinkedMaterials(base.currentMaterialNode, true);
|
||||||
if (linkedMaterials.length == 0) {
|
if (linkedMaterials.length == 0)
|
||||||
|
{
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
return linkedMaterials.join(", ");
|
return linkedMaterials.join(", ");
|
||||||
}
|
}
|
||||||
|
|
||||||
function getApproximateDiameter(diameter) {
|
function getApproximateDiameter(diameter)
|
||||||
|
{
|
||||||
return Math.round(diameter);
|
return Math.round(diameter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,13 +158,15 @@ TabView
|
||||||
}
|
}
|
||||||
|
|
||||||
Label { width: scrollView.columnWidth; height: parent.rowHeight; verticalAlignment: Qt.AlignVCenter; text: catalog.i18nc("@label", "Color") }
|
Label { width: scrollView.columnWidth; height: parent.rowHeight; verticalAlignment: Qt.AlignVCenter; text: catalog.i18nc("@label", "Color") }
|
||||||
Row {
|
Row
|
||||||
|
{
|
||||||
width: scrollView.columnWidth
|
width: scrollView.columnWidth
|
||||||
height: parent.rowHeight
|
height: parent.rowHeight
|
||||||
spacing: Math.round(UM.Theme.getSize("default_margin").width / 2)
|
spacing: Math.round(UM.Theme.getSize("default_margin").width / 2)
|
||||||
|
|
||||||
// color indicator square
|
// color indicator square
|
||||||
Rectangle {
|
Rectangle
|
||||||
|
{
|
||||||
id: colorSelector
|
id: colorSelector
|
||||||
color: properties.color_code
|
color: properties.color_code
|
||||||
|
|
||||||
|
@ -171,7 +177,8 @@ TabView
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
||||||
// open the color selection dialog on click
|
// open the color selection dialog on click
|
||||||
MouseArea {
|
MouseArea
|
||||||
|
{
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
onClicked: colorDialog.open()
|
onClicked: colorDialog.open()
|
||||||
enabled: base.editingEnabled
|
enabled: base.editingEnabled
|
||||||
|
@ -179,7 +186,8 @@ TabView
|
||||||
}
|
}
|
||||||
|
|
||||||
// pretty color name text field
|
// pretty color name text field
|
||||||
ReadOnlyTextField {
|
ReadOnlyTextField
|
||||||
|
{
|
||||||
id: colorLabel;
|
id: colorLabel;
|
||||||
text: properties.color_name;
|
text: properties.color_name;
|
||||||
readOnly: !base.editingEnabled
|
readOnly: !base.editingEnabled
|
||||||
|
@ -188,7 +196,8 @@ TabView
|
||||||
|
|
||||||
// popup dialog to select a new color
|
// popup dialog to select a new color
|
||||||
// if successful it sets the properties.color_code value to the new color
|
// if successful it sets the properties.color_code value to the new color
|
||||||
ColorDialog {
|
ColorDialog
|
||||||
|
{
|
||||||
id: colorDialog
|
id: colorDialog
|
||||||
color: properties.color_code
|
color: properties.color_code
|
||||||
onAccepted: base.setMetaDataEntry("color_code", properties.color_code, color)
|
onAccepted: base.setMetaDataEntry("color_code", properties.color_code, color)
|
||||||
|
@ -258,7 +267,8 @@ TabView
|
||||||
decimals: 2
|
decimals: 2
|
||||||
maximumValue: 100000000
|
maximumValue: 100000000
|
||||||
|
|
||||||
onValueChanged: {
|
onValueChanged:
|
||||||
|
{
|
||||||
base.setMaterialPreferenceValue(properties.guid, "spool_cost", parseFloat(value))
|
base.setMaterialPreferenceValue(properties.guid, "spool_cost", parseFloat(value))
|
||||||
updateCostPerMeter()
|
updateCostPerMeter()
|
||||||
}
|
}
|
||||||
|
@ -275,7 +285,8 @@ TabView
|
||||||
decimals: 0
|
decimals: 0
|
||||||
maximumValue: 10000
|
maximumValue: 10000
|
||||||
|
|
||||||
onValueChanged: {
|
onValueChanged:
|
||||||
|
{
|
||||||
base.setMaterialPreferenceValue(properties.guid, "spool_weight", parseFloat(value))
|
base.setMaterialPreferenceValue(properties.guid, "spool_weight", parseFloat(value))
|
||||||
updateCostPerMeter()
|
updateCostPerMeter()
|
||||||
}
|
}
|
||||||
|
@ -401,7 +412,8 @@ TabView
|
||||||
{
|
{
|
||||||
id: spinBox
|
id: spinBox
|
||||||
anchors.left: label.right
|
anchors.left: label.right
|
||||||
value: {
|
value:
|
||||||
|
{
|
||||||
// In case the setting is not in the material...
|
// In case the setting is not in the material...
|
||||||
if (!isNaN(parseFloat(materialPropertyProvider.properties.value)))
|
if (!isNaN(parseFloat(materialPropertyProvider.properties.value)))
|
||||||
{
|
{
|
||||||
|
@ -493,8 +505,10 @@ TabView
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tiny convenience function to check if a value really changed before trying to set it.
|
// Tiny convenience function to check if a value really changed before trying to set it.
|
||||||
function setMetaDataEntry(entry_name, old_value, new_value) {
|
function setMetaDataEntry(entry_name, old_value, new_value)
|
||||||
if (old_value != new_value) {
|
{
|
||||||
|
if (old_value != new_value)
|
||||||
|
{
|
||||||
Cura.ContainerManager.setContainerMetaDataEntry(base.currentMaterialNode, entry_name, new_value)
|
Cura.ContainerManager.setContainerMetaDataEntry(base.currentMaterialNode, entry_name, new_value)
|
||||||
// make sure the UI properties are updated as well since we don't re-fetch the entire model here
|
// make sure the UI properties are updated as well since we don't re-fetch the entire model here
|
||||||
// When the entry_name is something like properties/diameter, we take the last part of the entry_name
|
// When the entry_name is something like properties/diameter, we take the last part of the entry_name
|
||||||
|
@ -546,10 +560,11 @@ TabView
|
||||||
}
|
}
|
||||||
|
|
||||||
// update the display name of the material
|
// update the display name of the material
|
||||||
function updateMaterialDisplayName (old_name, new_name)
|
function updateMaterialDisplayName(old_name, new_name)
|
||||||
{
|
{
|
||||||
// don't change when new name is the same
|
// don't change when new name is the same
|
||||||
if (old_name == new_name) {
|
if (old_name == new_name)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue