WIP: Add first-start machine actions

This commit is contained in:
Lipu Fei 2019-03-19 12:08:42 +01:00
parent d4c0104bc2
commit 8d68db9ff0
16 changed files with 288 additions and 1559 deletions

View file

@ -41,6 +41,7 @@ UM.TooltipArea
// callback functions
property var forceUpdateOnChangeFunction: dummy_func
property var afterOnEditingFinishedFunction: dummy_func
property var setValueFunction: null
// a dummy function for default property values
function dummy_func() {}
@ -76,7 +77,7 @@ UM.TooltipArea
for (var i = 0; i < options.length; i++)
{
var option = options[i].substring(1, options[i].length - 1).split("', '")
append({text: option[1], value: option[0]})
append({ text: option[1], value: option[0] })
}
}
}
@ -118,9 +119,17 @@ UM.TooltipArea
onActivated:
{
if (propertyProvider.properties.value != model.get(index).value)
var newValue = model.get(index).value
if (propertyProvider.properties.value != newValue)
{
propertyProvider.setPropertyValue("value", model.get(index).value)
if (setValueFunction !== null)
{
setValueFunction(newValue)
}
else
{
propertyProvider.setPropertyValue("value", newValue)
}
forceUpdateOnChangeFunction()
afterOnEditingFinishedFunction()
}

View file

@ -1,55 +0,0 @@
import QtQuick 2.10
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.3
Item
{
id: base
anchors.fill: parent
TabBar
{
id: bar
width: parent.width
TabButton
{
text: "Printer"
}
Repeater
{
id: extrudersTabsRepeater
model: ["Extruder 1", "Extruder 2", "Extruder 3"]
TabButton
{
text: modelData
}
}
}
StackLayout
{
width: parent.width
currentIndex: bar.currentIndex
Item
{
id: printerTab
}
Repeater
{
model: ["Extruder 1", "Extruder 2", "Extruder 3"]
Item
{
anchors.centerIn: parent
Label // TODO: this is a dummy
{
anchors.centerIn: parent
text: modelData
}
}
}
}
}

View file

@ -1,120 +0,0 @@
// Copyright (c) 2019 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.10
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.3
import UM 1.3 as UM
import Cura 1.1 as Cura
//
// TextField for editing polygon data in the Machine Settings dialog.
//
UM.TooltipArea
{
UM.I18nCatalog { id: catalog; name: "cura"; }
height: textField.height
width: textField.width
text: tooltip
property alias containerStackId: propertyProvider.containerStackId
property alias settingKey: propertyProvider.key
property alias settingStoreIndex: propertyProvider.storeIndex
property alias labelText: fieldLabel.text
property alias labelWidth: fieldLabel.width
property string unitText: catalog.i18nc("@label", "mm")
// callback functions
property var forceUpdateOnChangeFunction: dummy_func
// a dummy function for default property values
function dummy_func() {}
property var printHeadPolygon:
{
"x": {
"min": 0,
"max": 0,
},
"y": {
"min": 0,
"max": 0,
},
}
UM.SettingPropertyProvider
{
id: propertyProvider
watchedProperties: [ "value" ]
}
Row
{
spacing: UM.Theme.getSize("default_margin").width
Label
{
id: fieldLabel
anchors.verticalCenter: textFieldWithUnit.verticalCenter
visible: text != ""
elide: Text.ElideRight
//width: Math.max(0, settingsTabs.labelColumnWidth)
}
Item
{
id: textFieldWithUnit
width: textField.width
height: textField.height
TextField
{
id: textField
text:
{
var polygon = JSON.parse(propertyProvider.properties.value)
var item = (axis == "x") ? 0 : 1
var result = polygon[0][item]
for (var i = 1; i < polygon.length; i++) {
result = (side == "min")
? Math.min(result, polygon[i][item])
: Math.max(result, polygon[i][item])
}
result = Math.abs(result)
printHeadPolygon[axis][side] = result
return result
}
validator: RegExpValidator { regExp: /[0-9\.,]{0,6}/ }
onEditingFinished:
{
printHeadPolygon[axis][side] = parseFloat(textField.text.replace(',','.'))
var polygon = [
[-printHeadPolygon["x"]["min"], printHeadPolygon["y"]["max"]],
[-printHeadPolygon["x"]["min"], -printHeadPolygon["y"]["min"]],
[ printHeadPolygon["x"]["max"], printHeadPolygon["y"]["max"]],
[ printHeadPolygon["x"]["max"], -printHeadPolygon["y"]["min"]]
]
var polygon_string = JSON.stringify(polygon)
if (polygon_string != propertyProvider.properties.value)
{
propertyProvider.setPropertyValue("value", polygon_string)
forceUpdateOnChangeFunction()
}
}
}
Label
{
id: unitLabel
text: unitText
anchors.right: textField.right
anchors.rightMargin: y - textField.y
anchors.verticalCenter: textField.verticalCenter
}
}
}
}

View file

@ -1,272 +0,0 @@
import QtQuick 2.10
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.3
Column
{
spacing: UM.Theme.getSize("default_margin").height
Row
{
width: parent.width
spacing: UM.Theme.getSize("default_margin").height
Column
{
width: settingsTabs.columnWidth
spacing: UM.Theme.getSize("default_lining").height
Label
{
text: catalog.i18nc("@label", "Printer Settings")
font.bold: true
renderType: Text.NativeRendering
}
Item { width: UM.Theme.getSize("default_margin").width; height: UM.Theme.getSize("default_margin").height }
Loader
{
id: buildAreaWidthField
sourceComponent: numericTextFieldWithUnit
property string settingKey: "machine_width"
property string label: catalog.i18nc("@label", "X (Width)")
property string unit: catalog.i18nc("@label", "mm")
property bool forceUpdateOnChange: true
}
Loader
{
id: buildAreaDepthField
sourceComponent: numericTextFieldWithUnit
property string settingKey: "machine_depth"
property string label: catalog.i18nc("@label", "Y (Depth)")
property string unit: catalog.i18nc("@label", "mm")
property bool forceUpdateOnChange: true
}
Loader
{
id: buildAreaHeightField
sourceComponent: numericTextFieldWithUnit
property string settingKey: "machine_height"
property string label: catalog.i18nc("@label", "Z (Height)")
property string unit: catalog.i18nc("@label", "mm")
property bool forceUpdateOnChange: true
}
Item { width: UM.Theme.getSize("default_margin").width; height: UM.Theme.getSize("default_margin").height }
Loader
{
id: shapeComboBox
sourceComponent: comboBoxWithOptions
property string settingKey: "machine_shape"
property string label: catalog.i18nc("@label", "Build plate shape")
property bool forceUpdateOnChange: true
}
Loader
{
id: centerIsZeroCheckBox
sourceComponent: simpleCheckBox
property string settingKey: "machine_center_is_zero"
property string label: catalog.i18nc("@option:check", "Origin at center")
property bool forceUpdateOnChange: true
}
Loader
{
id: heatedBedCheckBox
sourceComponent: simpleCheckBox
property var settingKey: "machine_heated_bed"
property string label: catalog.i18nc("@option:check", "Heated bed")
property bool forceUpdateOnChange: true
}
Item { width: UM.Theme.getSize("default_margin").width; height: UM.Theme.getSize("default_margin").height }
Loader
{
id: gcodeFlavorComboBox
sourceComponent: comboBoxWithOptions
property string settingKey: "machine_gcode_flavor"
property string label: catalog.i18nc("@label", "G-code flavor")
property bool forceUpdateOnChange: true
property var afterOnActivate: manager.updateHasMaterialsMetadata
}
}
Column
{
width: settingsTabs.columnWidth
spacing: UM.Theme.getSize("default_lining").height
Label
{
text: catalog.i18nc("@label", "Printhead Settings")
font.bold: true
renderType: Text.NativeRendering
}
Item { width: UM.Theme.getSize("default_margin").width; height: UM.Theme.getSize("default_margin").height }
Loader
{
id: printheadXMinField
sourceComponent: headPolygonTextField
property string label: catalog.i18nc("@label", "X min")
property string tooltip: catalog.i18nc("@tooltip", "Distance from the left of the printhead to the center of the nozzle. Used to prevent colissions between previous prints and the printhead when printing \"One at a Time\".")
property string axis: "x"
property string side: "min"
}
Loader
{
id: printheadYMinField
sourceComponent: headPolygonTextField
property string label: catalog.i18nc("@label", "Y min")
property string tooltip: catalog.i18nc("@tooltip", "Distance from the front of the printhead to the center of the nozzle. Used to prevent colissions between previous prints and the printhead when printing \"One at a Time\".")
property string axis: "y"
property string side: "min"
}
Loader
{
id: printheadXMaxField
sourceComponent: headPolygonTextField
property string label: catalog.i18nc("@label", "X max")
property string tooltip: catalog.i18nc("@tooltip", "Distance from the right of the printhead to the center of the nozzle. Used to prevent colissions between previous prints and the printhead when printing \"One at a Time\".")
property string axis: "x"
property string side: "max"
}
Loader
{
id: printheadYMaxField
sourceComponent: headPolygonTextField
property string label: catalog.i18nc("@label", "Y max")
property string tooltip: catalog.i18nc("@tooltip", "Distance from the rear of the printhead to the center of the nozzle. Used to prevent colissions between previous prints and the printhead when printing \"One at a Time\".")
property string axis: "y"
property string side: "max"
}
Item { width: UM.Theme.getSize("default_margin").width; height: UM.Theme.getSize("default_margin").height }
Loader
{
id: gantryHeightField
sourceComponent: numericTextFieldWithUnit
property string settingKey: "gantry_height"
property string label: catalog.i18nc("@label", "Gantry height")
property string unit: catalog.i18nc("@label", "mm")
property string tooltip: catalog.i18nc("@tooltip", "The height difference between the tip of the nozzle and the gantry system (X and Y axes). Used to prevent collisions between previous prints and the gantry when printing \"One at a Time\".")
property bool forceUpdateOnChange: true
}
Item { width: UM.Theme.getSize("default_margin").width; height: UM.Theme.getSize("default_margin").height }
UM.TooltipArea
{
height: childrenRect.height
width: childrenRect.width
text: machineExtruderCountProvider.properties.description
visible: extruderCountModel.count >= 2
Row
{
spacing: UM.Theme.getSize("default_margin").width
Label
{
anchors.verticalCenter: extruderCountComboBox.verticalCenter
width: Math.max(0, settingsTabs.labelColumnWidth)
text: catalog.i18nc("@label", "Number of Extruders")
elide: Text.ElideRight
renderType: Text.NativeRendering
}
ComboBox
{
id: extruderCountComboBox
model: ListModel
{
id: extruderCountModel
Component.onCompleted:
{
for(var i = 0; i < manager.definedExtruderCount; i++)
{
extruderCountModel.append({text: String(i + 1), value: i})
}
}
}
Connections
{
target: manager
onDefinedExtruderCountChanged:
{
extruderCountModel.clear();
for(var i = 0; i < manager.definedExtruderCount; ++i)
{
extruderCountModel.append({text: String(i + 1), value: i});
}
}
}
currentIndex: machineExtruderCountProvider.properties.value - 1
onActivated:
{
manager.setMachineExtruderCount(index + 1);
}
}
}
}
}
}
Row
{
spacing: UM.Theme.getSize("default_margin").width
anchors.left: parent.left
anchors.right: parent.right
height: parent.height - y
Column
{
height: parent.height
width: settingsTabs.columnWidth
Label
{
text: catalog.i18nc("@label", "Start G-code")
font.bold: true
}
Loader
{
id: machineStartGcodeField
sourceComponent: gcodeTextArea
property int areaWidth: parent.width
property int areaHeight: parent.height - y
property string settingKey: "machine_start_gcode"
property string tooltip: catalog.i18nc("@tooltip", "G-code commands to be executed at the very start.")
}
}
Column {
height: parent.height
width: settingsTabs.columnWidth
Label
{
text: catalog.i18nc("@label", "End G-code")
font.bold: true
}
Loader
{
id: machineEndGcodeField
sourceComponent: gcodeTextArea
property int areaWidth: parent.width
property int areaHeight: parent.height - y
property string settingKey: "machine_end_gcode"
property string tooltip: catalog.i18nc("@tooltip", "G-code commands to be executed at the very end.")
}
}
}
}

View file

@ -137,18 +137,18 @@ Item
// Create a network printer
const networkPrinterItem = addNetworkPrinterDropDown.contentItem.currentItem
CuraApplication.getDiscoveredPrintersModel().createMachineFromDiscoveredPrinter(networkPrinterItem)
// If we have created a machine, go to the last page, which is the "cloud" page.
base.gotoPage("cloud")
}
else
{
// Create a local printer
const localPrinterItem = addLocalPrinterDropDown.contentItem.currentItem
Cura.MachineManager.addMachine(localPrinterItem.id)
base.gotoPage("machine_actions")
}
// TODO: implement machine actions
// If we have created a machine, go to the last page, which is the "cloud" page.
base.gotoPage("cloud")
}
}
}

View file

@ -0,0 +1,91 @@
// Copyright (c) 2019 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.10
import QtQuick.Controls 2.3
import UM 1.3 as UM
import Cura 1.1 as Cura
//
// This component contains the content for the "What's new in Ultimaker Cura" page of the welcome on-boarding process.
//
Item
{
UM.I18nCatalog { id: catalog; name: "cura" }
property var machineActionsModel: CuraApplication.getFirstStartMachineActionsModel()
property int currentActionIndex: 0
property var currentActionItem: currentActionIndex >= machineActionsModel.count
? null : machineActionsModel.getItem(currentActionIndex)
property bool hasActions: machineActionsModel.count > 0
// Reset to the first page if the model gets changed.
Connections
{
target: machineActionsModel
onItemsChanged: currentActionIndex = 0
}
onVisibleChanged:
{
if (visible)
{
currentActionIndex = 0
if (!hasActions)
{
base.showNextPage()
}
}
}
Label
{
id: titleLabel
anchors.top: parent.top
anchors.topMargin: 40
anchors.horizontalCenter: parent.horizontalCenter
horizontalAlignment: Text.AlignHCenter
text: currentActionItem.title
color: UM.Theme.getColor("primary_button")
font: UM.Theme.getFont("large_bold")
renderType: Text.NativeRendering
}
Item
{
anchors.top: titleLabel.bottom
anchors.bottom: nextButton.top
anchors.topMargin: UM.Theme.getSize("default_margin").height
anchors.bottomMargin: UM.Theme.getSize("default_margin").height
anchors.left: parent.left
anchors.right: parent.right
data: currentActionItem == undefined ? null : currentActionItem.content
}
Cura.PrimaryButton
{
id: nextButton
anchors.right: parent.right
anchors.bottom: parent.bottom
anchors.margins: 40
text: catalog.i18nc("@button", "Next")
width: 140
fixedWidthMode: true
onClicked:
{
// If no more first-start actions to show, go to the next page.
if (currentActionIndex + 1 >= machineActionsModel.count)
{
currentActionIndex = 0
base.showNextPage()
return
}
currentActionIndex++
}
}
}

View file

@ -1,183 +0,0 @@
// Copyright (c) 2019 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.10
import QtQuick.Controls 2.3
import UM 1.3 as UM
import Cura 1.1 as Cura
import "../MachineSettings"
//
// This component contains the content for the "Welcome" page of the welcome on-boarding process.
//
Item
{
id: base
UM.I18nCatalog { id: catalog; name: "cura" }
anchors.left: parent.left
anchors.right: parent.right
anchors.top: parent.top
property int labelWidth: 180
property int controlWidth: UM.Theme.getSize("setting_control").width * 3 / 4
property var labelFont: UM.Theme.getFont("medium")
property int columnWidth: (parent.width - 2 * UM.Theme.getSize("default_margin").width) / 2
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
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.margins: UM.Theme.getSize("default_margin").width
height: childrenRect.height
// =======================================
// Left-side column "Nozzle Settings"
// =======================================
Column
{
anchors.top: parent.top
anchors.left: parent.left
width: parent.width * 2 / 3
spacing: base.columnSpacing
Label // Title Label
{
text: catalog.i18nc("@title:label", "Nozzle Settings")
font: UM.Theme.getFont("medium_bold")
renderType: Text.NativeRendering
}
NumericTextFieldWithUnit // "Nozzle size"
{
id: extruderNozzleSizeField
visible: !Cura.MachineManager.hasVariants
containerStackId: base.extruderStackId
settingKey: "machine_nozzle_size"
settingStoreIndex: propertyStoreIndex
labelText: catalog.i18nc("@label", "Nozzle size")
labelFont: base.labelFont
labelWidth: base.labelWidth
controlWidth: base.controlWidth
unitText: catalog.i18nc("@label", "mm")
forceUpdateOnChangeFunction: forceUpdateFunction
}
NumericTextFieldWithUnit // "Compatible material diameter"
{
id: extruderCompatibleMaterialDiameterField
containerStackId: base.extruderStackId
settingKey: "material_diameter"
settingStoreIndex: propertyStoreIndex
labelText: catalog.i18nc("@label", "Compatible material diameter")
labelFont: base.labelFont
labelWidth: base.labelWidth
controlWidth: base.controlWidth
unitText: catalog.i18nc("@label", "mm")
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"
{
id: extruderNozzleOffsetXField
containerStackId: base.extruderStackId
settingKey: "machine_nozzle_offset_x"
settingStoreIndex: propertyStoreIndex
labelText: catalog.i18nc("@label", "Nozzle offset X")
labelFont: base.labelFont
labelWidth: base.labelWidth
controlWidth: base.controlWidth
unitText: catalog.i18nc("@label", "mm")
forceUpdateOnChangeFunction: forceUpdateFunction
}
NumericTextFieldWithUnit // "Nozzle offset Y"
{
id: extruderNozzleOffsetYField
containerStackId: base.extruderStackId
settingKey: "machine_nozzle_offset_y"
settingStoreIndex: propertyStoreIndex
labelText: catalog.i18nc("@label", "Nozzle offset Y")
labelFont: base.labelFont
labelWidth: base.labelWidth
controlWidth: base.controlWidth
unitText: catalog.i18nc("@label", "mm")
forceUpdateOnChangeFunction: forceUpdateFunction
}
NumericTextFieldWithUnit // "Cooling Fan Number"
{
id: extruderNozzleCoolingFanNumberField
containerStackId: base.extruderStackId
settingKey: "machine_extruder_cooling_fan_number"
settingStoreIndex: propertyStoreIndex
labelText: catalog.i18nc("@label", "Cooling Fan Number")
labelFont: base.labelFont
labelWidth: base.labelWidth
controlWidth: base.controlWidth
unitText: ""
forceUpdateOnChangeFunction: forceUpdateFunction
}
}
}
Item // Extruder Start and End G-code
{
id: lowerBlock
anchors.top: upperBlock.bottom
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.right: parent.right
anchors.margins: UM.Theme.getSize("default_margin").width
GcodeTextArea // "Extruder Start G-code"
{
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.bottomMargin: UM.Theme.getSize("default_margin").height
anchors.left: parent.left
width: base.columnWidth - UM.Theme.getSize("default_margin").width
labelText: catalog.i18nc("@title:label", "Extruder Start G-code")
containerStackId: base.extruderStackId
settingKey: "machine_extruder_start_code"
settingStoreIndex: propertyStoreIndex
}
GcodeTextArea // "Extruder End G-code"
{
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.bottomMargin: UM.Theme.getSize("default_margin").height
anchors.right: parent.right
width: base.columnWidth - UM.Theme.getSize("default_margin").width
labelText: catalog.i18nc("@title:label", "Extruder End G-code")
containerStackId: base.extruderStackId
settingKey: "machine_extruder_end_code"
settingStoreIndex: propertyStoreIndex
}
}
}

View file

@ -1,337 +0,0 @@
// Copyright (c) 2019 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.10
import QtQuick.Controls 2.3
import UM 1.3 as UM
import Cura 1.1 as Cura
import "../MachineSettings"
//
// This the content in the "Printer" tab in the Machine Settings dialog.
//
Item
{
id: base
UM.I18nCatalog { id: catalog; name: "cura" }
anchors.left: parent.left
anchors.right: parent.right
anchors.top: parent.top
property int labelWidth: 130
property int controlWidth: UM.Theme.getSize("setting_control").width * 3 / 4
property var labelFont: UM.Theme.getFont("medium")
property int columnWidth: (parent.width - 2 * UM.Theme.getSize("default_margin").width) / 2
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
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.margins: UM.Theme.getSize("default_margin").width
height: childrenRect.height
// =======================================
// Left-side column for "Printer Settings"
// =======================================
Column
{
anchors.top: parent.top
anchors.left: parent.left
width: base.columnWidth
spacing: base.columnSpacing
Label // Title Label
{
text: catalog.i18nc("@title:label", "Printer Settings")
font: UM.Theme.getFont("medium_bold")
renderType: Text.NativeRendering
}
NumericTextFieldWithUnit // "X (Width)"
{
id: machineXWidthField
containerStackId: machineStackId
settingKey: "machine_width"
settingStoreIndex: propertyStoreIndex
labelText: catalog.i18nc("@label", "X (Width)")
labelFont: base.labelFont
labelWidth: base.labelWidth
controlWidth: base.controlWidth
unitText: catalog.i18nc("@label", "mm")
forceUpdateOnChangeFunction: forceUpdateFunction
}
NumericTextFieldWithUnit // "Y (Depth)"
{
id: machineYDepthField
containerStackId: machineStackId
settingKey: "machine_depth"
settingStoreIndex: propertyStoreIndex
labelText: catalog.i18nc("@label", "Y (Depth)")
labelFont: base.labelFont
labelWidth: base.labelWidth
controlWidth: base.controlWidth
unitText: catalog.i18nc("@label", "mm")
forceUpdateOnChangeFunction: forceUpdateFunction
}
NumericTextFieldWithUnit // "Z (Height)"
{
id: machineZHeightField
containerStackId: machineStackId
settingKey: "machine_height"
settingStoreIndex: propertyStoreIndex
labelText: catalog.i18nc("@label", "Z (Height)")
labelFont: base.labelFont
labelWidth: base.labelWidth
controlWidth: base.controlWidth
unitText: catalog.i18nc("@label", "mm")
forceUpdateOnChangeFunction: forceUpdateFunction
}
ComboBoxWithOptions // "Build plate shape"
{
id: buildPlateShapeComboBox
containerStackId: machineStackId
settingKey: "machine_shape"
settingStoreIndex: propertyStoreIndex
labelText: catalog.i18nc("@label", "Build plate shape")
labelFont: base.labelFont
labelWidth: base.labelWidth
controlWidth: base.controlWidth
forceUpdateOnChangeFunction: forceUpdateFunction
}
SimpleCheckBox // "Origin at center"
{
id: originAtCenterCheckBox
containerStackId: machineStackId
settingKey: "machine_center_is_zero"
settingStoreIndex: propertyStoreIndex
labelText: catalog.i18nc("@label", "Origin at center")
labelFont: base.labelFont
labelWidth: base.labelWidth
forceUpdateOnChangeFunction: forceUpdateFunction
}
SimpleCheckBox // "Heated bed"
{
id: heatedBedCheckBox
containerStackId: machineStackId
settingKey: "machine_heated_bed"
settingStoreIndex: propertyStoreIndex
labelText: catalog.i18nc("@label", "Heated bed")
labelFont: base.labelFont
labelWidth: base.labelWidth
forceUpdateOnChangeFunction: forceUpdateFunction
}
ComboBoxWithOptions // "G-code flavor"
{
id: gcodeFlavorComboBox
containerStackId: machineStackId
settingKey: "machine_gcode_flavor"
settingStoreIndex: propertyStoreIndex
labelText: catalog.i18nc("@label", "G-code flavor")
labelFont: base.labelFont
labelWidth: base.labelWidth
controlWidth: base.controlWidth
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
}
}
// =======================================
// Right-side column for "Printhead Settings"
// =======================================
Column
{
anchors.top: parent.top
anchors.right: parent.right
width: base.columnWidth
spacing: base.columnSpacing
Label // Title Label
{
text: catalog.i18nc("@title:label", "Printhead Settings")
font: UM.Theme.getFont("medium_bold")
renderType: Text.NativeRendering
}
PrintHeadMinMaxTextField // "X min"
{
id: machineXMinField
settingStoreIndex: propertyStoreIndex
labelText: catalog.i18nc("@label", "X min")
labelFont: base.labelFont
labelWidth: base.labelWidth
controlWidth: base.controlWidth
unitText: catalog.i18nc("@label", "mm")
axisName: "x"
axisMinOrMax: "min"
forceUpdateOnChangeFunction: forceUpdateFunction
}
PrintHeadMinMaxTextField // "Y min"
{
id: machineYMinField
settingStoreIndex: propertyStoreIndex
labelText: catalog.i18nc("@label", "Y min")
labelFont: base.labelFont
labelWidth: base.labelWidth
controlWidth: base.controlWidth
unitText: catalog.i18nc("@label", "mm")
axisName: "y"
axisMinOrMax: "min"
forceUpdateOnChangeFunction: forceUpdateFunction
}
PrintHeadMinMaxTextField // "X max"
{
id: machineXMaxField
settingStoreIndex: propertyStoreIndex
labelText: catalog.i18nc("@label", "X max")
labelFont: base.labelFont
labelWidth: base.labelWidth
controlWidth: base.controlWidth
unitText: catalog.i18nc("@label", "mm")
axisName: "x"
axisMinOrMax: "max"
forceUpdateOnChangeFunction: forceUpdateFunction
}
PrintHeadMinMaxTextField // "Y max"
{
id: machineYMaxField
containerStackId: machineStackId
settingKey: "machine_head_with_fans_polygon"
settingStoreIndex: propertyStoreIndex
labelText: catalog.i18nc("@label", "Y max")
labelFont: base.labelFont
labelWidth: base.labelWidth
controlWidth: base.controlWidth
unitText: catalog.i18nc("@label", "mm")
axisName: "y"
axisMinOrMax: "max"
forceUpdateOnChangeFunction: forceUpdateFunction
}
NumericTextFieldWithUnit // "Gantry Height"
{
id: machineGantryHeightField
containerStackId: machineStackId
settingKey: "gantry_height"
settingStoreIndex: propertyStoreIndex
labelText: catalog.i18nc("@label", "Gantry Height")
labelFont: base.labelFont
labelWidth: base.labelWidth
controlWidth: base.controlWidth
unitText: catalog.i18nc("@label", "mm")
forceUpdateOnChangeFunction: forceUpdateFunction
}
ComboBoxWithOptions // "Number of Extruders"
{
id: numberOfExtrudersComboBox
containerStackId: machineStackId
settingKey: "machine_extruder_count"
settingStoreIndex: propertyStoreIndex
labelText: catalog.i18nc("@label", "Number of Extruders")
labelFont: base.labelFont
labelWidth: base.labelWidth
controlWidth: base.controlWidth
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
{
id: extruderCountModel
Component.onCompleted:
{
extruderCountModel.clear()
for (var i = 1; i <= Cura.MachineManager.activeMachine.maxExtruderCount; i++)
{
extruderCountModel.append({text: String(i), value: i})
}
}
}
}
}
}
Item // Start and End G-code
{
id: lowerBlock
anchors.top: upperBlock.bottom
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.right: parent.right
anchors.margins: UM.Theme.getSize("default_margin").width
GcodeTextArea // "Start G-code"
{
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.bottomMargin: UM.Theme.getSize("default_margin").height
anchors.left: parent.left
width: base.columnWidth - UM.Theme.getSize("default_margin").width
labelText: catalog.i18nc("@title:label", "Start G-code")
containerStackId: machineStackId
settingKey: "machine_start_gcode"
settingStoreIndex: propertyStoreIndex
}
GcodeTextArea // "End G-code"
{
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.bottomMargin: UM.Theme.getSize("default_margin").height
anchors.right: parent.right
width: base.columnWidth - UM.Theme.getSize("default_margin").width
labelText: catalog.i18nc("@title:label", "End G-code")
containerStackId: machineStackId
settingKey: "machine_end_gcode"
settingStoreIndex: propertyStoreIndex
}
}
}

View file

@ -67,7 +67,7 @@ Item
break
}
}
if (page_index > 0)
if (page_index >= 0)
{
currentStep = page_index
}

View file

@ -1,107 +0,0 @@
// Copyright (c) 2019 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.10
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.3
import UM 1.3 as UM
import Cura 1.1 as Cura
import "../MachineSettings"
import "../Widgets"
//
// This component contains the content for the "Welcome" page of the welcome on-boarding process.
//
Item
{
id: base
UM.I18nCatalog { id: catalog; name: "cura" }
anchors.fill: parent
anchors.margins: UM.Theme.getSize("default_margin").width
property var extrudersModel: Cura.ExtrudersModel {}
// 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
{
target: extrudersModel
onItemsChanged: tabNameModel.update()
}
ListModel
{
id: tabNameModel
Component.onCompleted: update()
function update()
{
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 })
}
}
}
Rectangle
{
anchors.fill: parent
border.color: tabBar.visible ? UM.Theme.getColor("lining") : "transparent"
border.width: UM.Theme.getSize("default_lining").width
radius: UM.Theme.getSize("default_radius").width
UM.TabRow
{
id: tabBar
width: parent.width
Repeater
{
model: tabNameModel
delegate: CuraTabButton
{
text: model.name
}
}
}
StackLayout
{
id: tabStack
anchors.top: tabBar.bottom
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
width: parent.width
currentIndex: tabBar.currentIndex
MachineSettingsPrinterTab
{
id: printerTab
}
Repeater
{
model: extrudersModel
delegate: MachineSettingsExtruderTab
{
id: discoverTab
extruderPosition: model.index
extruderStackId: model.id
}
}
}
}
}

View file

@ -17,3 +17,20 @@ SettingView 1.0 SettingView.qml
ProfileMenu 1.0 ProfileMenu.qml
CheckBoxWithTooltip 1.0 CheckBoxWithTooltip.qml
ToolTip 1.0 ToolTip.qml
# Cura/Widgets
CuraCheckBox 1.0 CuraCheckBox.qml
CuraComboBox 1.0 CuraComboBox.qml
CuraProgressBar 1.0 CuraProgressBar.qml
CuraTabButton 1.0 CuraTabButton.qml
# Cura/MachineSettings
ComboBoxWithOptions 1.0 ComboBoxWithOptions.qml
GcodeTextArea 1.0 GcodeTextArea.qml
NumericTextFieldWithUnit 1.0 NumericTextFieldWithUnit.qml
PrintHeadMinMaxTextField 1.0 PrintHeadMinMaxTextField.qml
SimpleCheckBox 1.0 SimpleCheckBox.qml