Add tooltip to gcode areas

This commit is contained in:
fieldOfView 2017-07-09 13:35:50 +02:00
parent 1eeb953072
commit 4705ada6ef

View File

@ -348,24 +348,13 @@ Cura.MachineAction
text: catalog.i18nc("@label", "Start Gcode") text: catalog.i18nc("@label", "Start Gcode")
font.bold: true font.bold: true
} }
TextArea Loader
{ {
id: machineStartGcodeField id: machineStartGcodeField
width: parent.width sourceComponent: gcodeTextArea
height: parent.height - y property int areaWidth: parent.width
font: UM.Theme.getFont("fixed") property int areaHeight: parent.height - y
text: machineStartGcodeProvider.properties.value property string settingKey: "machine_start_gcode"
onActiveFocusChanged:
{
if(!activeFocus)
{
machineStartGcodeProvider.setPropertyValue("value", machineStartGcodeField.text)
}
}
Component.onCompleted:
{
wrapMode = TextEdit.NoWrap;
}
} }
} }
@ -377,24 +366,13 @@ Cura.MachineAction
text: catalog.i18nc("@label", "End Gcode") text: catalog.i18nc("@label", "End Gcode")
font.bold: true font.bold: true
} }
TextArea Loader
{ {
id: machineEndGcodeField id: machineEndGcodeField
width: parent.width sourceComponent: gcodeTextArea
height: parent.height - y property int areaWidth: parent.width
font: UM.Theme.getFont("fixed") property int areaHeight: parent.height - y
text: machineEndGcodeProvider.properties.value property string settingKey: "machine_end_gcode"
onActiveFocusChanged:
{
if(!activeFocus)
{
machineEndGcodeProvider.setPropertyValue("value", machineEndGcodeField.text)
}
}
Component.onCompleted:
{
wrapMode = TextEdit.NoWrap;
}
} }
} }
} }
@ -526,25 +504,15 @@ Cura.MachineAction
text: catalog.i18nc("@label", "Extruder Start Gcode") text: catalog.i18nc("@label", "Extruder Start Gcode")
font.bold: true font.bold: true
} }
TextArea Loader
{ {
id: extruderStartGcodeField id: extruderStartGcodeField
width: parent.width sourceComponent: gcodeTextArea
height: parent.height - y property int areaWidth: parent.width
font: UM.Theme.getFont("fixed") property int areaHeight: parent.height - y
text: (extruderStartGcodeProvider.properties.value) ? extruderStartGcodeProvider.properties.value : "" property string settingKey: "machine_extruder_start_code"
onActiveFocusChanged: property bool isExtruderSetting: true
{ }
if(!activeFocus)
{
extruderStartGcodeProvider.setPropertyValue("value", extruderStartGcodeField.text)
}
}
Component.onCompleted:
{
wrapMode = TextEdit.NoWrap;
}
}
} }
Column { Column {
height: parent.height height: parent.height
@ -554,24 +522,14 @@ Cura.MachineAction
text: catalog.i18nc("@label", "Extruder End Gcode") text: catalog.i18nc("@label", "Extruder End Gcode")
font.bold: true font.bold: true
} }
TextArea Loader
{ {
id: extruderEndGcodeField id: extruderEndGcodeField
width: parent.width sourceComponent: gcodeTextArea
height: parent.height - y property int areaWidth: parent.width
font: UM.Theme.getFont("fixed") property int areaHeight: parent.height - y
text: (extruderEndGcodeProvider.properties.value) ? extruderEndGcodeProvider.properties.value : "" property string settingKey: "machine_extruder_end_code"
onActiveFocusChanged: property bool isExtruderSetting: true
{
if(!activeFocus)
{
extruderEndGcodeProvider.setPropertyValue("value", extruderEndGcodeField.text)
}
}
Component.onCompleted:
{
wrapMode = TextEdit.NoWrap;
}
} }
} }
} }
@ -782,6 +740,60 @@ Cura.MachineAction
} }
} }
Component
{
id: gcodeTextArea
UM.TooltipArea
{
height: gcodeArea.height
width: gcodeArea.width
text: propertyProvider.properties.description
property bool _isExtruderSetting: (typeof(isExtruderSetting) === 'undefined') ? false: isExtruderSetting
UM.SettingPropertyProvider
{
id: propertyProvider
containerStackId: {
if(_isExtruderSetting)
{
if(settingsTabs.currentIndex > 0)
{
return Cura.MachineManager.activeStackId;
}
return "";
}
return Cura.MachineManager.activeMachineId;
}
key: settingKey
watchedProperties: [ "value", "description" ]
storeIndex: manager.containerIndex
}
TextArea
{
id: gcodeArea
width: areaWidth
height: areaHeight
font: UM.Theme.getFont("fixed")
text: (propertyProvider.properties.value) ? propertyProvider.properties.value : ""
onActiveFocusChanged:
{
if(!activeFocus)
{
propertyProvider.setPropertyValue("value", gcodeField.text)
}
}
Component.onCompleted:
{
wrapMode = TextEdit.NoWrap;
}
}
}
}
UM.SettingPropertyProvider UM.SettingPropertyProvider
{ {
id: machineExtruderCountProvider id: machineExtruderCountProvider
@ -801,45 +813,4 @@ Cura.MachineAction
watchedProperties: [ "value", "description" ] watchedProperties: [ "value", "description" ]
storeIndex: manager.containerIndex storeIndex: manager.containerIndex
} }
UM.SettingPropertyProvider
{
id: machineStartGcodeProvider
containerStackId: Cura.MachineManager.activeMachineId
key: "machine_start_gcode"
watchedProperties: [ "value", "description" ]
storeIndex: manager.containerIndex
}
UM.SettingPropertyProvider
{
id: machineEndGcodeProvider
containerStackId: Cura.MachineManager.activeMachineId
key: "machine_end_gcode"
watchedProperties: [ "value", "description" ]
storeIndex: manager.containerIndex
}
UM.SettingPropertyProvider
{
id: extruderStartGcodeProvider
containerStackId: settingsTabs.currentIndex > 0 ? Cura.MachineManager.activeStackId : ""
key: "machine_extruder_start_code"
watchedProperties: [ "value", "description" ]
storeIndex: manager.containerIndex
}
UM.SettingPropertyProvider
{
id: extruderEndGcodeProvider
containerStackId: settingsTabs.currentIndex > 0 ? Cura.MachineManager.activeStackId : ""
key: "machine_extruder_end_code"
watchedProperties: [ "value", "description" ]
storeIndex: manager.containerIndex
}
} }