mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-11-02 20:52:20 -07:00
WIP: Make MachineSetting panel work
This commit is contained in:
parent
8242a3801c
commit
987ebba33b
8 changed files with 168 additions and 51 deletions
|
|
@ -23,8 +23,6 @@ Item
|
|||
anchors.right: parent.right
|
||||
anchors.top: parent.top
|
||||
|
||||
property string extruderStackId: ""
|
||||
|
||||
property int labelWidth: 180
|
||||
property int controlWidth: UM.Theme.getSize("setting_control").width * 3 / 4
|
||||
property var labelFont: UM.Theme.getFont("medium")
|
||||
|
|
@ -33,6 +31,15 @@ Item
|
|||
property int columnSpacing: 3
|
||||
property int propertyStoreIndex: 5 // definition_changes
|
||||
|
||||
property string extruderStackId: ""
|
||||
property int extruderPosition: 0
|
||||
property var forceUpdateFunction: CuraApplication.getMachineSettingsManager().forceUpdate
|
||||
|
||||
function updateMaterialDiameter()
|
||||
{
|
||||
CuraApplication.getMachineSettingsManager().updateMaterialForDiameter(extruderPosition)
|
||||
}
|
||||
|
||||
Item
|
||||
{
|
||||
id: upperBlock
|
||||
|
|
@ -73,7 +80,7 @@ Item
|
|||
labelWidth: base.labelWidth
|
||||
controlWidth: base.controlWidth
|
||||
unitText: catalog.i18nc("@label", "mm")
|
||||
// TODO: add forceUpdateOnChangeFunction:
|
||||
forceUpdateOnChangeFunction: forceUpdateFunction
|
||||
}
|
||||
|
||||
NumericTextFieldWithUnit // "Compatible material diameter"
|
||||
|
|
@ -87,7 +94,9 @@ Item
|
|||
labelWidth: base.labelWidth
|
||||
controlWidth: base.controlWidth
|
||||
unitText: catalog.i18nc("@label", "mm")
|
||||
// TODO: add forceUpdateOnChangeFunction:
|
||||
forceUpdateOnChangeFunction: forceUpdateFunction
|
||||
// Other modules won't automatically respond after the user changes the value, so we need to force it.
|
||||
afterOnEditingFinishedFunction: updateMaterialDiameter
|
||||
}
|
||||
|
||||
NumericTextFieldWithUnit // "Nozzle offset X"
|
||||
|
|
@ -101,7 +110,7 @@ Item
|
|||
labelWidth: base.labelWidth
|
||||
controlWidth: base.controlWidth
|
||||
unitText: catalog.i18nc("@label", "mm")
|
||||
// TODO: add forceUpdateOnChangeFunction:
|
||||
forceUpdateOnChangeFunction: forceUpdateFunction
|
||||
}
|
||||
|
||||
NumericTextFieldWithUnit // "Nozzle offset Y"
|
||||
|
|
@ -115,7 +124,7 @@ Item
|
|||
labelWidth: base.labelWidth
|
||||
controlWidth: base.controlWidth
|
||||
unitText: catalog.i18nc("@label", "mm")
|
||||
// TODO: add forceUpdateOnChangeFunction:
|
||||
forceUpdateOnChangeFunction: forceUpdateFunction
|
||||
}
|
||||
|
||||
NumericTextFieldWithUnit // "Cooling Fan Number"
|
||||
|
|
@ -129,7 +138,7 @@ Item
|
|||
labelWidth: base.labelWidth
|
||||
controlWidth: base.controlWidth
|
||||
unitText: ""
|
||||
// TODO: add forceUpdateOnChangeFunction:
|
||||
forceUpdateOnChangeFunction: forceUpdateFunction
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,6 +30,10 @@ Item
|
|||
property int columnSpacing: 3
|
||||
property int propertyStoreIndex: 5 // definition_changes
|
||||
|
||||
property string machineStackId: Cura.MachineManager.activeMachineId
|
||||
|
||||
property var forceUpdateFunction: CuraApplication.getMachineSettingsManager().forceUpdate
|
||||
|
||||
Item
|
||||
{
|
||||
id: upperBlock
|
||||
|
|
@ -61,7 +65,7 @@ Item
|
|||
NumericTextFieldWithUnit // "X (Width)"
|
||||
{
|
||||
id: machineXWidthField
|
||||
containerStackId: Cura.MachineManager.activeMachineId
|
||||
containerStackId: machineStackId
|
||||
settingKey: "machine_width"
|
||||
settingStoreIndex: propertyStoreIndex
|
||||
labelText: catalog.i18nc("@label", "X (Width)")
|
||||
|
|
@ -69,13 +73,13 @@ Item
|
|||
labelWidth: base.labelWidth
|
||||
controlWidth: base.controlWidth
|
||||
unitText: catalog.i18nc("@label", "mm")
|
||||
// TODO: add forceUpdateOnChangeFunction:
|
||||
forceUpdateOnChangeFunction: forceUpdateFunction
|
||||
}
|
||||
|
||||
NumericTextFieldWithUnit // "Y (Depth)"
|
||||
{
|
||||
id: machineYDepthField
|
||||
containerStackId: Cura.MachineManager.activeMachineId
|
||||
containerStackId: machineStackId
|
||||
settingKey: "machine_depth"
|
||||
settingStoreIndex: propertyStoreIndex
|
||||
labelText: catalog.i18nc("@label", "Y (Depth)")
|
||||
|
|
@ -83,13 +87,13 @@ Item
|
|||
labelWidth: base.labelWidth
|
||||
controlWidth: base.controlWidth
|
||||
unitText: catalog.i18nc("@label", "mm")
|
||||
// TODO: add forceUpdateOnChangeFunction:
|
||||
forceUpdateOnChangeFunction: forceUpdateFunction
|
||||
}
|
||||
|
||||
NumericTextFieldWithUnit // "Z (Height)"
|
||||
{
|
||||
id: machineZHeightField
|
||||
containerStackId: Cura.MachineManager.activeMachineId
|
||||
containerStackId: machineStackId
|
||||
settingKey: "machine_height"
|
||||
settingStoreIndex: propertyStoreIndex
|
||||
labelText: catalog.i18nc("@label", "Z (Height)")
|
||||
|
|
@ -97,58 +101,61 @@ Item
|
|||
labelWidth: base.labelWidth
|
||||
controlWidth: base.controlWidth
|
||||
unitText: catalog.i18nc("@label", "mm")
|
||||
// TODO: add forceUpdateOnChangeFunction:
|
||||
forceUpdateOnChangeFunction: forceUpdateFunction
|
||||
}
|
||||
|
||||
ComboBoxWithOptions // "Build plate shape"
|
||||
{
|
||||
id: buildPlateShapeComboBox
|
||||
containerStackId: Cura.MachineManager.activeMachineId
|
||||
containerStackId: machineStackId
|
||||
settingKey: "machine_shape"
|
||||
settingStoreIndex: propertyStoreIndex
|
||||
labelText: catalog.i18nc("@label", "Build plate shape")
|
||||
labelFont: base.labelFont
|
||||
labelWidth: base.labelWidth
|
||||
controlWidth: base.controlWidth
|
||||
// TODO: add forceUpdateOnChangeFunction:
|
||||
forceUpdateOnChangeFunction: forceUpdateFunction
|
||||
}
|
||||
|
||||
SimpleCheckBox // "Origin at center"
|
||||
{
|
||||
id: originAtCenterCheckBox
|
||||
containerStackId: Cura.MachineManager.activeMachineId
|
||||
containerStackId: machineStackId
|
||||
settingKey: "machine_center_is_zero"
|
||||
settingStoreIndex: propertyStoreIndex
|
||||
labelText: catalog.i18nc("@label", "Origin at center")
|
||||
labelFont: base.labelFont
|
||||
labelWidth: base.labelWidth
|
||||
// TODO: add forceUpdateOnChangeFunction:
|
||||
forceUpdateOnChangeFunction: forceUpdateFunction
|
||||
}
|
||||
|
||||
SimpleCheckBox // "Heated bed"
|
||||
{
|
||||
id: heatedBedCheckBox
|
||||
containerStackId: Cura.MachineManager.activeMachineId
|
||||
containerStackId: machineStackId
|
||||
settingKey: "machine_heated_bed"
|
||||
settingStoreIndex: propertyStoreIndex
|
||||
labelText: catalog.i18nc("@label", "Heated bed")
|
||||
labelFont: base.labelFont
|
||||
labelWidth: base.labelWidth
|
||||
// TODO: add forceUpdateOnChangeFunction:
|
||||
forceUpdateOnChangeFunction: forceUpdateFunction
|
||||
}
|
||||
|
||||
ComboBoxWithOptions // "G-code flavor"
|
||||
{
|
||||
id: gcodeFlavorComboBox
|
||||
containerStackId: Cura.MachineManager.activeMachineId
|
||||
containerStackId: machineStackId
|
||||
settingKey: "machine_gcode_flavor"
|
||||
settingStoreIndex: propertyStoreIndex
|
||||
labelText: catalog.i18nc("@label", "G-code flavor")
|
||||
labelFont: base.labelFont
|
||||
labelWidth: base.labelWidth
|
||||
controlWidth: base.controlWidth
|
||||
// TODO: add forceUpdateOnChangeFunction:
|
||||
// TODO: add afterOnActivate: manager.updateHasMaterialsMetadata
|
||||
forceUpdateOnChangeFunction: forceUpdateFunction
|
||||
// FIXME(Lipu): better document this.
|
||||
// This has something to do with UM2 and UM2+ regarding "has_material" and the gcode flavor settings.
|
||||
// I don't remember exactly what.
|
||||
afterOnEditingFinishedFunction: CuraApplication.getMachineSettingsManager().updateHasMaterialsMetadata
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -185,7 +192,7 @@ Item
|
|||
axisName: "x"
|
||||
axisMinOrMax: "min"
|
||||
|
||||
// TODO: add forceUpdateOnChangeFunction:
|
||||
forceUpdateOnChangeFunction: forceUpdateFunction
|
||||
}
|
||||
|
||||
PrintHeadMinMaxTextField // "Y min"
|
||||
|
|
@ -203,7 +210,7 @@ Item
|
|||
axisName: "y"
|
||||
axisMinOrMax: "min"
|
||||
|
||||
// TODO: add forceUpdateOnChangeFunction:
|
||||
forceUpdateOnChangeFunction: forceUpdateFunction
|
||||
}
|
||||
|
||||
PrintHeadMinMaxTextField // "X max"
|
||||
|
|
@ -221,14 +228,14 @@ Item
|
|||
axisName: "x"
|
||||
axisMinOrMax: "max"
|
||||
|
||||
// TODO: add forceUpdateOnChangeFunction:
|
||||
forceUpdateOnChangeFunction: forceUpdateFunction
|
||||
}
|
||||
|
||||
PrintHeadMinMaxTextField // "Y max"
|
||||
{
|
||||
id: machineYMaxField
|
||||
|
||||
containerStackId: Cura.MachineManager.activeMachineId
|
||||
containerStackId: machineStackId
|
||||
settingKey: "machine_head_with_fans_polygon"
|
||||
settingStoreIndex: propertyStoreIndex
|
||||
|
||||
|
|
@ -241,13 +248,13 @@ Item
|
|||
axisName: "y"
|
||||
axisMinOrMax: "max"
|
||||
|
||||
// TODO: add forceUpdateOnChangeFunction:
|
||||
forceUpdateOnChangeFunction: forceUpdateFunction
|
||||
}
|
||||
|
||||
NumericTextFieldWithUnit // "Gantry Height"
|
||||
{
|
||||
id: machineGantryHeightField
|
||||
containerStackId: Cura.MachineManager.activeMachineId
|
||||
containerStackId: machineStackId
|
||||
settingKey: "gantry_height"
|
||||
settingStoreIndex: propertyStoreIndex
|
||||
labelText: catalog.i18nc("@label", "Gantry Height")
|
||||
|
|
@ -255,21 +262,24 @@ Item
|
|||
labelWidth: base.labelWidth
|
||||
controlWidth: base.controlWidth
|
||||
unitText: catalog.i18nc("@label", "mm")
|
||||
// TODO: add forceUpdateOnChangeFunction:
|
||||
forceUpdateOnChangeFunction: forceUpdateFunction
|
||||
}
|
||||
|
||||
ComboBoxWithOptions // "Number of Extruders"
|
||||
{
|
||||
id: numberOfExtrudersComboBox
|
||||
containerStackId: Cura.MachineManager.activeMachineId
|
||||
containerStackId: machineStackId
|
||||
settingKey: "machine_extruder_count"
|
||||
settingStoreIndex: propertyStoreIndex
|
||||
labelText: catalog.i18nc("@label", "Number of Extruders")
|
||||
labelFont: base.labelFont
|
||||
labelWidth: base.labelWidth
|
||||
controlWidth: base.controlWidth
|
||||
// TODO: add forceUpdateOnChangeFunction:
|
||||
// TODO: add afterOnActivate: manager.updateHasMaterialsMetadata
|
||||
forceUpdateOnChangeFunction: forceUpdateFunction
|
||||
// FIXME(Lipu): better document this.
|
||||
// This has something to do with UM2 and UM2+ regarding "has_material" and the gcode flavor settings.
|
||||
// I don't remember exactly what.
|
||||
afterOnEditingFinishedFunction: CuraApplication.getMachineSettingsManager().updateHasMaterialsMetadata
|
||||
|
||||
optionModel: ListModel
|
||||
{
|
||||
|
|
@ -305,7 +315,7 @@ Item
|
|||
width: base.columnWidth - UM.Theme.getSize("default_margin").width
|
||||
|
||||
labelText: catalog.i18nc("@title:label", "Start G-code")
|
||||
containerStackId: Cura.MachineManager.activeMachineId
|
||||
containerStackId: machineStackId
|
||||
settingKey: "machine_start_gcode"
|
||||
settingStoreIndex: propertyStoreIndex
|
||||
}
|
||||
|
|
@ -319,7 +329,7 @@ Item
|
|||
width: base.columnWidth - UM.Theme.getSize("default_margin").width
|
||||
|
||||
labelText: catalog.i18nc("@title:label", "End G-code")
|
||||
containerStackId: Cura.MachineManager.activeMachineId
|
||||
containerStackId: machineStackId
|
||||
settingKey: "machine_end_gcode"
|
||||
settingStoreIndex: propertyStoreIndex
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,11 +26,31 @@ Item
|
|||
|
||||
property var extrudersModel: Cura.ExtrudersModel {}
|
||||
|
||||
onVisibleChanged:
|
||||
// If we create a CuraTabButton for "Printer" and use Repeater for extruders, for some reason, once the component
|
||||
// finishes it will automatically change "currentIndex = 1", and it is VERY difficult to change "currentIndex = 0"
|
||||
// after that. Using a model and a Repeater to create both "Printer" and extruder CuraTabButtons seem to solve this
|
||||
// problem.
|
||||
Connections
|
||||
{
|
||||
if (visible)
|
||||
target: extrudersModel
|
||||
onItemsChanged: tabNameModel.update()
|
||||
}
|
||||
|
||||
ListModel
|
||||
{
|
||||
id: tabNameModel
|
||||
|
||||
Component.onCompleted: update()
|
||||
|
||||
function update()
|
||||
{
|
||||
tabBar.currentIndex = 0
|
||||
clear()
|
||||
append({ name: catalog.i18nc("@title:tab", "Printer") })
|
||||
for (var i = 0; i < extrudersModel.count; i++)
|
||||
{
|
||||
const m = extrudersModel.getItem(i)
|
||||
append({ name: m.name })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -46,14 +66,9 @@ Item
|
|||
id: tabBar
|
||||
width: parent.width
|
||||
|
||||
CuraTabButton
|
||||
{
|
||||
text: catalog.i18nc("@title:tab", "Printer")
|
||||
}
|
||||
|
||||
Repeater
|
||||
{
|
||||
model: extrudersModel
|
||||
model: tabNameModel
|
||||
delegate: CuraTabButton
|
||||
{
|
||||
text: model.name
|
||||
|
|
@ -83,6 +98,7 @@ Item
|
|||
delegate: MachineSettingsExtruderTab
|
||||
{
|
||||
id: discoverTab
|
||||
extruderPosition: model.index
|
||||
extruderStackId: model.id
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue