menu: add ability for enable to hide certain menus

This commit is contained in:
Jordan Ruthe
2020-11-28 13:57:51 -05:00
parent 728f9cfa0f
commit 48c276d22f
4 changed files with 52 additions and 3 deletions

View File

@@ -32,9 +32,16 @@ panel: preheat
method: printer.gcode.script
# Parameters that would be passed with the method above
params: {"script":"G28 X"}
# Enable allows hiding of a menu if the condition is false. This statement is evaluated in Jinja2
# Available variables are listed below.
enable: {{ printer.power_devices.count > 0 }}
```
Available panels are listed here: [docs/panels.md](panels.md)
Certain variables are available for conditional testing of the enable statement:
```
printer.power_devices.count # Number of power devices configured in Moonraker
```
A sample configuration of a main menu would be as follows: