This commit is contained in:
Tim Kuipers 2016-06-08 13:49:37 +02:00
commit 482bc21a9f
12 changed files with 118 additions and 112 deletions

View file

@ -2138,6 +2138,7 @@
"default_value": 0,
"minimum_value": "0",
"maximum_value": "machine_extruder_count - 1",
"enabled": "support_enable",
"global_only": "True",
"children": {
"support_infill_extruder_nr":

View file

@ -237,7 +237,7 @@ UM.ManagementPage
folder: base.model.getDefaultPath()
onAccepted:
{
var result = base.model.exportProfile(base.currentItem.id, base.currentItem.name, fileUrl, selectedNameFilter)
var result = base.model.exportProfile(base.currentItem.id, fileUrl)
if(result && result.status == "error")
{
messageDialog.icon = StandardIcon.Critical

View file

@ -143,7 +143,7 @@ Item{
UM.SimpleButton {
id: customisedSettings
visible: UM.ActiveProfile.hasCustomisedValues
visible: Cura.MachineManager.hasUserSettings
height: parent.height * 0.6
width: parent.height * 0.6

View file

@ -20,11 +20,11 @@ Item {
property var showRevertButton: true
property var showInheritButton: true
property var doDepthIdentation: true
property var doDepthIndentation: true
// Create properties to put property provider stuff in (bindings break in qt 5.5.1 otherwise)
property var state: propertyProvider.properties.state
property var stackLevel: propertyProvider.stackLevel
property var stackLevel: propertyProvider.stackLevels[0]
signal contextMenuRequested()
signal showTooltip(string text);
@ -101,7 +101,7 @@ Item {
id: label;
anchors.left: parent.left;
anchors.leftMargin: doDepthIdentation ? (UM.Theme.getSize("section_icon_column").width + 5) + ((definition.depth - 1) * UM.Theme.getSize("setting_control_depth_margin").width) : 0
anchors.leftMargin: doDepthIndentation ? (UM.Theme.getSize("section_icon_column").width + 5) + ((definition.depth - 1) * UM.Theme.getSize("setting_control_depth_margin").width) : 0
anchors.right: settingControls.left;
anchors.verticalCenter: parent.verticalCenter
@ -166,7 +166,15 @@ Item {
onClicked: {
focus = true;
propertyProvider.removeFromContainer(base.stackLevel)
// Get the deepest entry of this setting that we can find. TODO: This is a bit naive, in some cases
// there might be multiple profiles saying something about the same setting. There is no strategy
// how to handle this as of yet.
var last_entry = propertyProvider.stackLevels.slice(-1)[0]
// Put that entry into the "top" instance container.
// This ensures that the value in any of the deeper containers need not be removed, which is
// needed for the reset button (which deletes the top value) to correctly go back to profile
// defaults.
propertyProvider.setPropertyValue("value", propertyProvider.getPropertyValue("value", last_entry))
}
backgroundColor: UM.Theme.getColor("setting_control");

View file

@ -90,21 +90,11 @@ SettingItem
Keys.onReleased:
{
// text = text.replace(",", ".") // User convenience. We use dots for decimal values
// if(parseFloat(text) != base.parentValue)
// {
// base.valueChanged(parseFloat(text));
// }
propertyProvider.setPropertyValue("value", text)
}
onEditingFinished:
{
// if(parseFloat(text) != base.parentValue)
// {
// base.valueChanged(parseFloat(text));
// }
propertyProvider.setPropertyValue("value", text)
}
@ -121,33 +111,9 @@ SettingItem
{
target: input
property: "text"
value: control.format(propertyProvider.properties.value)
value: propertyProvider.properties.value
when: !input.activeFocus
}
}
//Rounds a floating point number to 4 decimals. This prevents floating
//point rounding errors.
//
//input: The number to round.
//decimals: The number of decimals (digits after the radix) to round to.
//return: The rounded number.
function roundFloat(input, decimals)
{
//First convert to fixed-point notation to round the number to 4 decimals and not introduce new floating point errors.
//Then convert to a string (is implicit). The fixed-point notation will be something like "3.200".
//Then remove any trailing zeroes and the radix.
return input.toFixed(decimals).replace(/\.?0*$/, ""); //Match on periods, if any ( \.? ), followed by any number of zeros ( 0* ), then the end of string ( $ ).
}
//Formats a value for display in the text field.
//
//This correctly handles formatting of float values.
//
//input: The string value to format.
//return: The formatted string.
function format(inputValue) {
return parseFloat(inputValue) ? roundFloat(parseFloat(inputValue), 4) : inputValue //If it's a float, round to four decimals.
}
}
}

View file

@ -29,7 +29,8 @@ ScrollView
model: UM.SettingDefinitionsModel {
id: definitionsModel;
containerId: Cura.MachineManager.activeDefinitionId
visibilityHandler: UM.SettingPreferenceVisibilityHandler {}
exclude: ["machine_settings"]
visibilityHandler: UM.SettingPreferenceVisibilityHandler { }
}
delegate: Loader