Currently, menu list item enable/disable seems to not be refreshed when you’re in the menu, only when you first enter it. For example, the below adds a new input item to the main menu which should only be enabled when some trivial variable is 1. When you first enter the menu and change the input to 1 (which updates the variable) you can see the name is updated, but the item still stays there even though the enable should be false. If you go back and then reopen the menu, you’ll see this menu item is no longer there.
[gcode_macro TEST]
variable_val: 0
gcode:
[menu __main __test]
name: {"test %d %f" % (menu.input, printer.toolhead.estimated_print_time)}
enable: {printer['gcode_macro TEST'].val == 0}
type: input
input: {printer['gcode_macro TEST'].val}
index: 1
input_min: 0
input_max: 1
input_step: 1
realtime: false
gcode:
SET_GCODE_VARIABLE MACRO=TEST VARIABLE=val VALUE={menu.input|int}
Expected behaviour is that as soon as the enable template returns false, the item disappears. There’s potentially another case where the whole menu itself becomes disabled (not just one of the items you’re seeing) - in that case, it should force you back one level?
I had a squiz through menu.py
but I’m hoping it’s something someone who knows the code could implement in 5 minutes …