From 5eb7f228f81373cfffa7f316b848da679e79fb32 Mon Sep 17 00:00:00 2001 From: Olivier B Date: Tue, 13 Jan 2026 11:57:30 +0100 Subject: [PATCH] Use new option feature comment:multiline Updated descriptions for G-code inputs and modified handling of multiline G-code. --- .../PostProcessingPlugin/scripts/FilamentChange.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/plugins/PostProcessingPlugin/scripts/FilamentChange.py b/plugins/PostProcessingPlugin/scripts/FilamentChange.py index 583113eaea..aed75be9e8 100644 --- a/plugins/PostProcessingPlugin/scripts/FilamentChange.py +++ b/plugins/PostProcessingPlugin/scripts/FilamentChange.py @@ -3,8 +3,8 @@ # Modification 06.09.2020 # add checkbox, now you can choose and use configuration from the firmware itself. -# Modification 10.01.2026 -# add multiline in custom G-code, using '\n'. +# Modification 01.13.2026 +# convert G-code Before and G-Code After inputs to textareas (#21298). from typing import List from ..Script import Script @@ -137,9 +137,10 @@ class FilamentChange(Script): "before_macro": { "label": "G-code Before", - "description": "Any custom G-code to run before the filament change happens, for example, M300 S1000 P10000 for a long beep. Use \\\\n to separate lines.", + "description": "Any custom G-code to run before the filament change happens, for example, M300 S1000 P10000 for a long beep.", "unit": "", "type": "str", + "comments": "multiline", "default_value": "M300 S1000 P10000", "enabled": "enabled and enable_before_macro" }, @@ -154,9 +155,10 @@ class FilamentChange(Script): "after_macro": { "label": "G-code After", - "description": "Any custom G-code to run after the filament has been changed right before continuing the print, for example, you can add a sequence to purge filament and wipe the nozzle. Use \\\\n to separate lines.", + "description": "Any custom G-code to run after the filament has been changed right before continuing the print, for example, you can add a sequence to purge filament and wipe the nozzle.", "unit": "", "type": "str", + "comments": "multiline", "default_value": "M300 S440 P500", "enabled": "enabled and enable_after_macro" } @@ -199,7 +201,7 @@ class FilamentChange(Script): color_change = ";BEGIN FilamentChange plugin\n" if enable_before_macro: - color_change = color_change + before_macro.replace("\\n", "\n") + "\n" + color_change = color_change + before_macro + "\n" color_change = color_change + "M600" @@ -225,7 +227,7 @@ class FilamentChange(Script): color_change = color_change + "\n" if enable_after_macro: - color_change = color_change + after_macro.replace("\\n", "\n") + "\n" + color_change = color_change + after_macro + "\n" color_change = color_change + ";END FilamentChange plugin\n"