mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-04-23 14:19:37 +08:00
Allow plugins to add additional components to print monitor buttons
CURA-2277
This commit is contained in:
commit
8930eae9cd
@ -42,9 +42,10 @@ Please checkout [cura-build](https://github.com/Ultimaker/cura-build)
|
||||
|
||||
Third party plugins
|
||||
-------------
|
||||
* [Print time calculator](https://github.com/nallath/PrintCostCalculator)
|
||||
* [Post processing plugin](https://github.com/nallath/PostProcessingPlugin)
|
||||
* [Barbarian Plugin](https://github.com/nallath/BarbarianPlugin) Simple scale tool for imperial to metric.
|
||||
* [Print Cost Calculator](https://github.com/nallath/PrintCostCalculator): Calculates weight and monetary cost of your print.
|
||||
* [Post Processing Plugin](https://github.com/nallath/PostProcessingPlugin): Allows for post-processing scripts to run on g-code.
|
||||
* [Barbarian Plugin](https://github.com/nallath/BarbarianPlugin): Simple scale tool for imperial to metric.
|
||||
* [X3G Writer](https://github.com/Ghostkeeper/X3GWriter): Adds support for exporting X3G files.
|
||||
|
||||
Making profiles for other printers
|
||||
----------------------------------
|
||||
|
52
resources/definitions/prusa_i3_mk2.def.json
Normal file
52
resources/definitions/prusa_i3_mk2.def.json
Normal file
@ -0,0 +1,52 @@
|
||||
{
|
||||
"id": "prusa_i3_mk2",
|
||||
"version": 2,
|
||||
"name": "Prusa i3 Mk2",
|
||||
"inherits": "fdmprinter",
|
||||
"metadata": {
|
||||
"visible": true,
|
||||
"author": "Apsu",
|
||||
"manufacturer": "Prusa Research",
|
||||
"category": "Other",
|
||||
"file_formats": "text/x-gcode",
|
||||
"icon": "icon_ultimaker2",
|
||||
"platform": "prusai3_platform.stl",
|
||||
"has_materials": true
|
||||
},
|
||||
|
||||
"overrides": {
|
||||
"machine_heated_bed": { "default_value": true },
|
||||
"machine_width": { "default_value": 250 },
|
||||
"machine_height": { "default_value": 200 },
|
||||
"machine_depth": { "default_value": 210 },
|
||||
"machine_center_is_zero": { "default_value": false },
|
||||
"material_diameter": { "default_value": 1.75 },
|
||||
"material_bed_temperature": { "default_value": 55 },
|
||||
"machine_nozzle_size": { "default_value": 0.4 },
|
||||
"layer_height": { "default_value": 0.1 },
|
||||
"layer_height_0": { "default_value": 0.15 },
|
||||
"retraction_amount": { "default_value": 0.8 },
|
||||
"retraction_speed": { "default_value": 35 },
|
||||
"retraction_retract_speed": { "default_value": 35 },
|
||||
"retraction_prime_speed": { "default_value": 35 },
|
||||
"adhesion_type": { "default_value": "skirt" },
|
||||
"machine_nozzle_heat_up_speed": { "default_value": 2 },
|
||||
"machine_nozzle_cool_down_speed": { "default_value": 2 },
|
||||
"machine_head_with_fans_polygon": { "default_value": [[-31,31],[34,31],[34,-40],[-31,-40]] },
|
||||
"gantry_height": { "default_value": 28 },
|
||||
"machine_max_feedrate_z": { "default_value": 12 },
|
||||
"machine_max_feedrate_e": { "default_value": 120 },
|
||||
"machine_max_acceleration_z": { "default_value": 500 },
|
||||
"machine_acceleration": { "default_value": 1000 },
|
||||
"machine_max_jerk_xy": { "default_value": 10 },
|
||||
"machine_max_jerk_z": { "default_value": 0.2 },
|
||||
"machine_max_jerk_e": { "default_value": 2.5 },
|
||||
"machine_gcode_flavor": { "default_value": "RepRap (Marlin/Sprinter)" },
|
||||
"machine_start_gcode": {
|
||||
"default_value": "G21 ; set units to millimeters\nG90 ; use absolute positioning\nM82 ; absolute extrusion mode\nG28 W ; home all without mesh bed level\nG80 ; mesh bed leveling\nM104 S{material_print_temperature} ; set extruder temp\nM140 S{material_bed_temperature} ; set bed temp\nM190 S{material_bed_temperature} ; wait for bed temp\nM109 S{material_print_temperature} ; wait for extruder temp\nG92 E0.0 ; reset extruder distance position\nG1 Y-3.0 F1000.0 ; go outside print area\nG1 X60.0 E9.0 F1000.0 ; intro line\nG1 X100.0 E21.5 F1000.0 ; intro line\nG92 E0.0 ; reset extruder distance position"
|
||||
},
|
||||
"machine_end_gcode": {
|
||||
"default_value": "M104 S0 ; turn off extruder\nM140 S0 ; turn off heatbed\nM107 ; turn off fan\nG1 X0 Y210; home X axis and push Y forward\nM84 ; disable motors"
|
||||
}
|
||||
}
|
||||
}
|
@ -146,187 +146,206 @@ Rectangle
|
||||
}
|
||||
}
|
||||
|
||||
Button
|
||||
{
|
||||
id: abortButton
|
||||
|
||||
visible: printerConnected
|
||||
enabled: printerConnected && Cura.MachineManager.printerOutputDevices[0].acceptsCommands &&
|
||||
(["paused", "printing", "pre_print"].indexOf(Cura.MachineManager.printerOutputDevices[0].jobState) >= 0)
|
||||
|
||||
height: UM.Theme.getSize("save_button_save_to_button").height
|
||||
Row {
|
||||
id: buttonsRow
|
||||
height: abortButton.height
|
||||
anchors.top: progressBar.bottom
|
||||
anchors.topMargin: UM.Theme.getSize("default_margin").height
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: UM.Theme.getSize("default_margin").width
|
||||
spacing: UM.Theme.getSize("default_margin").width
|
||||
|
||||
text: catalog.i18nc("@label:", "Abort Print")
|
||||
onClicked: confirmationDialog.visible = true
|
||||
Row {
|
||||
id: additionalComponentsRow
|
||||
spacing: UM.Theme.getSize("default_margin").width
|
||||
}
|
||||
|
||||
style: ButtonStyle
|
||||
{
|
||||
background: Rectangle
|
||||
Connections {
|
||||
target: Printer
|
||||
onAdditionalComponentsChanged:
|
||||
{
|
||||
border.width: UM.Theme.getSize("default_lining").width
|
||||
border.color:
|
||||
{
|
||||
if(!control.enabled)
|
||||
return UM.Theme.getColor("action_button_disabled_border");
|
||||
else if(control.pressed)
|
||||
return UM.Theme.getColor("action_button_active_border");
|
||||
else if(control.hovered)
|
||||
return UM.Theme.getColor("action_button_hovered_border");
|
||||
else
|
||||
return UM.Theme.getColor("action_button_border");
|
||||
if(areaId == "monitorButtons") {
|
||||
for (var component in Printer.additionalComponents["monitorButtons"]) {
|
||||
Printer.additionalComponents["monitorButtons"][component].parent = additionalComponentsRow
|
||||
}
|
||||
}
|
||||
color:
|
||||
}
|
||||
}
|
||||
|
||||
Button
|
||||
{
|
||||
id: pauseResumeButton
|
||||
|
||||
height: UM.Theme.getSize("save_button_save_to_button").height
|
||||
|
||||
property bool userClicked: false
|
||||
property string lastJobState: ""
|
||||
|
||||
visible: printerConnected
|
||||
enabled: (!userClicked) && printerConnected && Cura.MachineManager.printerOutputDevices[0].acceptsCommands &&
|
||||
(["paused", "printing"].indexOf(Cura.MachineManager.printerOutputDevices[0].jobState) >= 0)
|
||||
|
||||
text: {
|
||||
var result = "";
|
||||
if (!printerConnected)
|
||||
{
|
||||
if(!control.enabled)
|
||||
return UM.Theme.getColor("action_button_disabled");
|
||||
else if(control.pressed)
|
||||
return UM.Theme.getColor("action_button_active");
|
||||
else if(control.hovered)
|
||||
return UM.Theme.getColor("action_button_hovered");
|
||||
else
|
||||
return UM.Theme.getColor("action_button");
|
||||
return "";
|
||||
}
|
||||
Behavior on color { ColorAnimation { duration: 50; } }
|
||||
var jobState = Cura.MachineManager.printerOutputDevices[0].jobState;
|
||||
|
||||
implicitWidth: actualLabel.contentWidth + (UM.Theme.getSize("default_margin").width * 2)
|
||||
|
||||
Label
|
||||
if (jobState == "paused")
|
||||
{
|
||||
id: actualLabel
|
||||
anchors.centerIn: parent
|
||||
return catalog.i18nc("@label:", "Resume");
|
||||
}
|
||||
else
|
||||
{
|
||||
return catalog.i18nc("@label:", "Pause");
|
||||
}
|
||||
}
|
||||
onClicked:
|
||||
{
|
||||
var current_job_state = Cura.MachineManager.printerOutputDevices[0].jobState
|
||||
if(current_job_state == "paused")
|
||||
{
|
||||
Cura.MachineManager.printerOutputDevices[0].setJobState("print");
|
||||
}
|
||||
else if(current_job_state == "printing")
|
||||
{
|
||||
Cura.MachineManager.printerOutputDevices[0].setJobState("pause");
|
||||
}
|
||||
}
|
||||
|
||||
style: ButtonStyle
|
||||
{
|
||||
background: Rectangle
|
||||
{
|
||||
border.width: UM.Theme.getSize("default_lining").width
|
||||
border.color:
|
||||
{
|
||||
if(!control.enabled)
|
||||
return UM.Theme.getColor("action_button_disabled_border");
|
||||
else if(control.pressed)
|
||||
return UM.Theme.getColor("action_button_active_border");
|
||||
else if(control.hovered)
|
||||
return UM.Theme.getColor("action_button_hovered_border");
|
||||
else
|
||||
return UM.Theme.getColor("action_button_border");
|
||||
}
|
||||
color:
|
||||
{
|
||||
if(!control.enabled)
|
||||
return UM.Theme.getColor("action_button_disabled_text");
|
||||
return UM.Theme.getColor("action_button_disabled");
|
||||
else if(control.pressed)
|
||||
return UM.Theme.getColor("action_button_active_text");
|
||||
return UM.Theme.getColor("action_button_active");
|
||||
else if(control.hovered)
|
||||
return UM.Theme.getColor("action_button_hovered_text");
|
||||
return UM.Theme.getColor("action_button_hovered");
|
||||
else
|
||||
return UM.Theme.getColor("action_button_text");
|
||||
return UM.Theme.getColor("action_button");
|
||||
}
|
||||
Behavior on color { ColorAnimation { duration: 50; } }
|
||||
|
||||
implicitWidth: actualLabel.contentWidth + (UM.Theme.getSize("default_margin").width * 2)
|
||||
|
||||
Label
|
||||
{
|
||||
id: actualLabel
|
||||
anchors.centerIn: parent
|
||||
color:
|
||||
{
|
||||
if(!control.enabled)
|
||||
return UM.Theme.getColor("action_button_disabled_text");
|
||||
else if(control.pressed)
|
||||
return UM.Theme.getColor("action_button_active_text");
|
||||
else if(control.hovered)
|
||||
return UM.Theme.getColor("action_button_hovered_text");
|
||||
else
|
||||
return UM.Theme.getColor("action_button_text");
|
||||
}
|
||||
font: UM.Theme.getFont("action_button")
|
||||
text: control.text
|
||||
}
|
||||
font: UM.Theme.getFont("action_button")
|
||||
text: control.text;
|
||||
}
|
||||
}
|
||||
label: Item { }
|
||||
}
|
||||
}
|
||||
|
||||
MessageDialog
|
||||
{
|
||||
id: confirmationDialog
|
||||
|
||||
title: catalog.i18nc("@window:title", "Abort print")
|
||||
icon: StandardIcon.Warning
|
||||
text: catalog.i18nc("@label", "Are you sure you want to abort the print?")
|
||||
standardButtons: StandardButton.Yes | StandardButton.No
|
||||
Component.onCompleted: visible = false
|
||||
onYes: Cura.MachineManager.printerOutputDevices[0].setJobState("abort")
|
||||
}
|
||||
|
||||
Button
|
||||
{
|
||||
id: pauseResumeButton
|
||||
|
||||
height: UM.Theme.getSize("save_button_save_to_button").height
|
||||
anchors.top: progressBar.bottom
|
||||
anchors.topMargin: UM.Theme.getSize("default_margin").height
|
||||
anchors.right: abortButton.left
|
||||
anchors.rightMargin: UM.Theme.getSize("default_margin").width
|
||||
|
||||
property bool userClicked: false
|
||||
property string lastJobState: ""
|
||||
|
||||
visible: printerConnected
|
||||
enabled: (!userClicked) && printerConnected && Cura.MachineManager.printerOutputDevices[0].acceptsCommands &&
|
||||
(["paused", "printing"].indexOf(Cura.MachineManager.printerOutputDevices[0].jobState) >= 0)
|
||||
|
||||
text: {
|
||||
var result = "";
|
||||
if (!printerConnected)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
var jobState = Cura.MachineManager.printerOutputDevices[0].jobState;
|
||||
|
||||
if (jobState == "paused")
|
||||
{
|
||||
return catalog.i18nc("@label:", "Resume");
|
||||
}
|
||||
else
|
||||
{
|
||||
return catalog.i18nc("@label:", "Pause");
|
||||
label: Item { }
|
||||
}
|
||||
}
|
||||
onClicked:
|
||||
|
||||
Button
|
||||
{
|
||||
var current_job_state = Cura.MachineManager.printerOutputDevices[0].jobState
|
||||
if(current_job_state == "paused")
|
||||
{
|
||||
Cura.MachineManager.printerOutputDevices[0].setJobState("print");
|
||||
}
|
||||
else if(current_job_state == "printing")
|
||||
{
|
||||
Cura.MachineManager.printerOutputDevices[0].setJobState("pause");
|
||||
}
|
||||
}
|
||||
id: abortButton
|
||||
|
||||
style: ButtonStyle
|
||||
{
|
||||
background: Rectangle
|
||||
visible: printerConnected
|
||||
enabled: printerConnected && Cura.MachineManager.printerOutputDevices[0].acceptsCommands &&
|
||||
(["paused", "printing", "pre_print"].indexOf(Cura.MachineManager.printerOutputDevices[0].jobState) >= 0)
|
||||
|
||||
height: UM.Theme.getSize("save_button_save_to_button").height
|
||||
|
||||
text: catalog.i18nc("@label:", "Abort Print")
|
||||
onClicked: confirmationDialog.visible = true
|
||||
|
||||
style: ButtonStyle
|
||||
{
|
||||
border.width: UM.Theme.getSize("default_lining").width
|
||||
border.color:
|
||||
background: Rectangle
|
||||
{
|
||||
if(!control.enabled)
|
||||
return UM.Theme.getColor("action_button_disabled_border");
|
||||
else if(control.pressed)
|
||||
return UM.Theme.getColor("action_button_active_border");
|
||||
else if(control.hovered)
|
||||
return UM.Theme.getColor("action_button_hovered_border");
|
||||
else
|
||||
return UM.Theme.getColor("action_button_border");
|
||||
}
|
||||
color:
|
||||
{
|
||||
if(!control.enabled)
|
||||
return UM.Theme.getColor("action_button_disabled");
|
||||
else if(control.pressed)
|
||||
return UM.Theme.getColor("action_button_active");
|
||||
else if(control.hovered)
|
||||
return UM.Theme.getColor("action_button_hovered");
|
||||
else
|
||||
return UM.Theme.getColor("action_button");
|
||||
}
|
||||
Behavior on color { ColorAnimation { duration: 50; } }
|
||||
|
||||
implicitWidth: actualLabel.contentWidth + (UM.Theme.getSize("default_margin").width * 2)
|
||||
|
||||
Label
|
||||
{
|
||||
id: actualLabel
|
||||
anchors.centerIn: parent
|
||||
border.width: UM.Theme.getSize("default_lining").width
|
||||
border.color:
|
||||
{
|
||||
if(!control.enabled)
|
||||
return UM.Theme.getColor("action_button_disabled_border");
|
||||
else if(control.pressed)
|
||||
return UM.Theme.getColor("action_button_active_border");
|
||||
else if(control.hovered)
|
||||
return UM.Theme.getColor("action_button_hovered_border");
|
||||
else
|
||||
return UM.Theme.getColor("action_button_border");
|
||||
}
|
||||
color:
|
||||
{
|
||||
if(!control.enabled)
|
||||
return UM.Theme.getColor("action_button_disabled_text");
|
||||
return UM.Theme.getColor("action_button_disabled");
|
||||
else if(control.pressed)
|
||||
return UM.Theme.getColor("action_button_active_text");
|
||||
return UM.Theme.getColor("action_button_active");
|
||||
else if(control.hovered)
|
||||
return UM.Theme.getColor("action_button_hovered_text");
|
||||
return UM.Theme.getColor("action_button_hovered");
|
||||
else
|
||||
return UM.Theme.getColor("action_button_text");
|
||||
return UM.Theme.getColor("action_button");
|
||||
}
|
||||
Behavior on color { ColorAnimation { duration: 50; } }
|
||||
|
||||
implicitWidth: actualLabel.contentWidth + (UM.Theme.getSize("default_margin").width * 2)
|
||||
|
||||
Label
|
||||
{
|
||||
id: actualLabel
|
||||
anchors.centerIn: parent
|
||||
color:
|
||||
{
|
||||
if(!control.enabled)
|
||||
return UM.Theme.getColor("action_button_disabled_text");
|
||||
else if(control.pressed)
|
||||
return UM.Theme.getColor("action_button_active_text");
|
||||
else if(control.hovered)
|
||||
return UM.Theme.getColor("action_button_hovered_text");
|
||||
else
|
||||
return UM.Theme.getColor("action_button_text");
|
||||
}
|
||||
font: UM.Theme.getFont("action_button")
|
||||
text: control.text;
|
||||
}
|
||||
font: UM.Theme.getFont("action_button")
|
||||
text: control.text
|
||||
}
|
||||
label: Item { }
|
||||
}
|
||||
label: Item { }
|
||||
}
|
||||
|
||||
MessageDialog
|
||||
{
|
||||
id: confirmationDialog
|
||||
|
||||
title: catalog.i18nc("@window:title", "Abort print")
|
||||
icon: StandardIcon.Warning
|
||||
text: catalog.i18nc("@label", "Are you sure you want to abort the print?")
|
||||
standardButtons: StandardButton.Yes | StandardButton.No
|
||||
Component.onCompleted: visible = false
|
||||
onYes: Cura.MachineManager.printerOutputDevices[0].setJobState("abort")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user