Skip to content

Commit c63b566

Browse files
committed
fix: no parameters on python gcode macros
Signed-off-by: Pedro Lamas <pedrolamas@gmail.com>
1 parent 665e047 commit c63b566

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

src/components/widgets/macros/MacroBtn.vue

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,19 +140,36 @@ export default class MacroBtn extends Mixins(StateMixin) {
140140
return ''
141141
}
142142
143+
get klippyApp () {
144+
return this.$store.getters['printer/getKlippyApp']
145+
}
146+
147+
get supportsPythonGcodeMacros () {
148+
return ['danger-klipper', 'kalico'].includes(this.klippyApp.name)
149+
}
150+
143151
handleClick () {
144152
this.$emit('click', this.macroName)
145153
}
146154
147155
mounted () {
148-
if (!this.macro.config || !this.macro.config.gcode) return
156+
const gcode = this.macro.config?.gcode
157+
158+
if (!gcode) return
149159
150160
const paramNameForRawGcodeCommand = this.paramNameForRawGcodeCommand
151161
152162
if (paramNameForRawGcodeCommand) {
153163
this.$set(this.params, paramNameForRawGcodeCommand, { value: '', reset: '' })
154164
} else {
155-
for (const { name, value } of gcodeMacroParams(this.macro.config.gcode)) {
165+
if (
166+
this.supportsPythonGcodeMacros &&
167+
/^\s*!/.test(gcode)
168+
) {
169+
return
170+
}
171+
172+
for (const { name, value } of gcodeMacroParams(gcode)) {
156173
if (!name.startsWith('_') && !this.params[name]) {
157174
this.$set(this.params, name, { value, reset: value })
158175
}

0 commit comments

Comments
 (0)