Use more neutral setting and variable names

It may be just Marlin that implements this right now, but that is bound to change.

Contributes to issue CURA-8219.
This commit is contained in:
Ghostkeeper 2021-05-05 14:49:41 +02:00
parent 29e4cf06b3
commit e1e25d629e
No known key found for this signature in database
GPG key ID: D2A8871EE34EC59A

View file

@ -1,8 +1,8 @@
# Copyright (c) 2019 Ultimaker B.V. # Copyright (c) 2021 Ultimaker B.V.
# The PostProcessingPlugin is released under the terms of the AGPLv3 or higher. # The PostProcessingPlugin is released under the terms of the AGPLv3 or higher.
# Modifikation 06.09.2020 # Modification 06.09.2020
# add checkbox, now you can choose and use configuration from Marlin Advanced Pause Feature! # add checkbox, now you can choose and use configuration from the firmware itself.
from typing import List from typing import List
from ..Script import Script from ..Script import Script
@ -16,20 +16,12 @@ class FilamentChange(Script):
def getSettingDataString(self): def getSettingDataString(self):
return """{ return """{
"name":"Filament Change", "name": "Filament Change",
"key": "FilamentChange", "key": "FilamentChange",
"metadata": {}, "metadata": {},
"version": 2, "version": 2,
"settings": "settings":
{ {
"marlin":
{
"label": "Use Marlin Config?",
"description": "Use configuration from Marlin Advanced Pause Feature!",
"type": "bool",
"default_value": true
},
"layer_number": "layer_number":
{ {
"label": "Layer", "label": "Layer",
@ -38,7 +30,13 @@ class FilamentChange(Script):
"type": "str", "type": "str",
"default_value": "1" "default_value": "1"
}, },
"firmware_config":
{
"label": "Use Firmware Configuration",
"description": "Use the settings in your firmware, or customise the parameters of the filament change here.",
"type": "bool",
"default_value": true
},
"initial_retract": "initial_retract":
{ {
"label": "Initial Retraction", "label": "Initial Retraction",
@ -46,8 +44,7 @@ class FilamentChange(Script):
"unit": "mm", "unit": "mm",
"type": "float", "type": "float",
"default_value": 30.0, "default_value": 30.0,
"enabled": "marlin == 0" "enabled": "not firmware_config"
}, },
"later_retract": "later_retract":
{ {
@ -56,8 +53,7 @@ class FilamentChange(Script):
"unit": "mm", "unit": "mm",
"type": "float", "type": "float",
"default_value": 300.0, "default_value": 300.0,
"enabled": "marlin == 0" "enabled": "not firmware_config"
}, },
"x_position": "x_position":
{ {
@ -66,8 +62,7 @@ class FilamentChange(Script):
"unit": "mm", "unit": "mm",
"type": "float", "type": "float",
"default_value": 0, "default_value": 0,
"enabled": "marlin == 0" "enabled": "not firmware_config"
}, },
"y_position": "y_position":
{ {
@ -76,8 +71,7 @@ class FilamentChange(Script):
"unit": "mm", "unit": "mm",
"type": "float", "type": "float",
"default_value": 0, "default_value": 0,
"enabled": "marlin == 0" "enabled": "not firmware_config"
} }
} }
}""" }"""
@ -93,11 +87,11 @@ class FilamentChange(Script):
later_retract = self.getSettingValueByKey("later_retract") later_retract = self.getSettingValueByKey("later_retract")
x_pos = self.getSettingValueByKey("x_position") x_pos = self.getSettingValueByKey("x_position")
y_pos = self.getSettingValueByKey("y_position") y_pos = self.getSettingValueByKey("y_position")
marlin_conf = self.getSettingValueByKey("marlin") firmware_config = self.getSettingValueByKey("firmware_config")
color_change = "M600" color_change = "M600"
if marlin_conf: if firmware_config:
color_change = color_change + " ; Generated by FilamentChange plugin\n" color_change = color_change + " ; Generated by FilamentChange plugin\n"
else: else:
if initial_retract is not None and initial_retract > 0.: if initial_retract is not None and initial_retract > 0.: