menu: add config_sections of printer.cfg to improve menu filtering
remove idle_timeout from the enable status (not used) make status data do less stuff for performance reasons separate printer and moonraker in status enable docs: make menu config look more like configuration reference of klipper also fixes some mistakes and simplify the description
This commit is contained in:
parent
d21033ad55
commit
49a8fa8186
@ -155,52 +155,46 @@ printer is idle. The __print menu is accessible from the printing status page.
|
|||||||
A menu item is configured as follows:
|
A menu item is configured as follows:
|
||||||
```{ .ini .no-copy }
|
```{ .ini .no-copy }
|
||||||
[menu __main my_menu_item]
|
[menu __main my_menu_item]
|
||||||
# To build a sub-menu of this menu item, you would next use [menu __main my_menu_item sub_menu_item]
|
|
||||||
name: Item Name
|
name: Item Name
|
||||||
# Optional Parameters
|
# To build a sub-menu of this menu item, you would next use [menu __main my_menu_item sub_menu_item]
|
||||||
#
|
#
|
||||||
|
# The following items are optional:
|
||||||
|
# icon: home
|
||||||
# Icon name to be used, it can be any image in the directory:
|
# Icon name to be used, it can be any image in the directory:
|
||||||
# KlipperScreen/styles/{theme}/images/ where {theme} is your current theme
|
# KlipperScreen/styles/{theme}/images/ where {theme} is your current theme
|
||||||
# Supported formats svg or png
|
# Supported formats svg or png
|
||||||
icon: home
|
#
|
||||||
|
# style: mycolor4
|
||||||
# Icon style, defined as "button.mycolor4" (for example) in the theme css
|
# Icon style, defined as "button.mycolor4" (for example) in the theme css
|
||||||
style: mycolor4
|
# panel: preheat
|
||||||
# Panel from the panels listed below
|
# Panel from the panels folder in the KlipperScreen folder
|
||||||
panel: preheat
|
# method: printer.gcode.script
|
||||||
# Moonraker method to call when the item is selected
|
# Moonraker method to call when the item is selected
|
||||||
method: printer.gcode.script
|
# params: {"script":"G28 X"}
|
||||||
# Parameters that would be passed with the method above
|
# Parameters that would be passed with the method above
|
||||||
params: {"script":"G28 X"}
|
# enable: {{ 'screws_tilt_adjust' in printer.config_sections and printer.power_devices.count > 0 }}
|
||||||
# Enable allows hiding of a menu if the condition is false. This statement is evaluated in Jinja2
|
# Enable allows hiding of a menu if the condition is false. (evaluated with Jinja2)
|
||||||
# Available variables are listed below.
|
# Available variables are listed below.
|
||||||
enable: {{ printer.power_devices.count > 0 }}
|
|
||||||
```
|
```
|
||||||
Available panels are listed here: [docs/panels.md](Panels.md)
|
Available panels are listed here: [docs/panels.md](Panels.md)
|
||||||
|
|
||||||
Certain variables are available for conditional testing of the enable statement:
|
Certain variables are available for conditional testing of the enable statement:
|
||||||
```{ .yaml .no-copy }
|
```{ .yaml .no-copy }
|
||||||
|
# Configured in Moonraker
|
||||||
|
moonraker.power_devices.count # Number of power devices
|
||||||
|
moonraker.cameras.count # Number of cameras
|
||||||
|
moonraker.spoolman # Has spoolman
|
||||||
|
|
||||||
|
# Printer specific
|
||||||
|
printer.pause_resume.is_paused # Printing job is paused
|
||||||
printer.extruders.count # Number of extruders
|
printer.extruders.count # Number of extruders
|
||||||
printer.temperature_devices.count # Number of temperature related devices that are not extruders
|
printer.temperature_devices.count # Number of temperature related devices (not extruders)
|
||||||
printer.fans.count # Number of fans
|
printer.fans.count # Number of fans
|
||||||
printer.power_devices.count # Number of power devices configured in Moonraker
|
printer.output_pins.count # Number of pins configured
|
||||||
printer.gcode_macros.count # Number of gcode macros
|
printer.gcode_macros.count # Number of gcode macros
|
||||||
printer.gcode_macros.list # List of names of the gcode macros
|
printer.gcode_macros.list # List of names of the gcode macros
|
||||||
printer.output_pins.count # Number of fans
|
printer.leds.count # Number of leds
|
||||||
|
printer.config_sections # Array of section headers of Klipper config (printer.cfg)
|
||||||
printer.bltouch # Available if bltouch section defined in config
|
|
||||||
printer.probe # Available if probe section defined in config
|
|
||||||
printer.bed_mesh # Available if bed_mesh section defined in config
|
|
||||||
printer.quad_gantry_level # Available if quad_gantry_level section defined in config
|
|
||||||
printer.z_tilt # Available if z_tilt section defined in config
|
|
||||||
|
|
||||||
printer.firmware_retraction # True if defined in config
|
|
||||||
printer.input_shaper # True if defined in config
|
|
||||||
printer.bed_screws # True if defined in config
|
|
||||||
printer.screws_tilt_adjust # True if defined in config
|
|
||||||
|
|
||||||
printer.idle_timeout # Idle timeout section
|
|
||||||
printer.pause_resume # Pause resume section of Klipper
|
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -210,11 +204,6 @@ A sample configuration of a main menu would be as follows:
|
|||||||
name: Homing
|
name: Homing
|
||||||
icon: home
|
icon: home
|
||||||
|
|
||||||
[menu __main preheat]
|
|
||||||
name: Preheat
|
|
||||||
icon: heat-up
|
|
||||||
panel: preheat
|
|
||||||
|
|
||||||
[menu __main homing homeall]
|
[menu __main homing homeall]
|
||||||
name: Home All
|
name: Home All
|
||||||
icon: home
|
icon: home
|
||||||
@ -228,6 +217,10 @@ method: printer.gcode.script
|
|||||||
params: {"script":"MY_MACRO"}
|
params: {"script":"MY_MACRO"}
|
||||||
enable: {{ 'MY_MACRO' in printer.gcode_macros.list }}
|
enable: {{ 'MY_MACRO' in printer.gcode_macros.list }}
|
||||||
|
|
||||||
|
[menu __main preheat]
|
||||||
|
name: Preheat
|
||||||
|
icon: heat-up
|
||||||
|
panel: preheat
|
||||||
```
|
```
|
||||||
|
|
||||||
## KlipperScreen behaviour towards configuration
|
## KlipperScreen behaviour towards configuration
|
||||||
|
@ -19,8 +19,6 @@ extruder = 210
|
|||||||
[menu __main]
|
[menu __main]
|
||||||
name: {{ gettext('Main Menu') }}
|
name: {{ gettext('Main Menu') }}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[menu __main move]
|
[menu __main move]
|
||||||
name: {{ gettext('Move') }}
|
name: {{ gettext('Move') }}
|
||||||
icon: move
|
icon: move
|
||||||
@ -61,14 +59,14 @@ name: {{ gettext('Quad Gantry Level') }}
|
|||||||
icon: home-z
|
icon: home-z
|
||||||
method: printer.gcode.script
|
method: printer.gcode.script
|
||||||
params: {"script":"QUAD_GANTRY_LEVEL"}
|
params: {"script":"QUAD_GANTRY_LEVEL"}
|
||||||
enable: {{ printer.quad_gantry_level is defined }}
|
enable: {{ 'quad_gantry_level' in printer.config_sections }}
|
||||||
|
|
||||||
[menu move homing Z-Tilt]
|
[menu move homing Z-Tilt]
|
||||||
name: {{ gettext('Z Tilt') }}
|
name: {{ gettext('Z Tilt') }}
|
||||||
icon: z-tilt
|
icon: z-tilt
|
||||||
method: printer.gcode.script
|
method: printer.gcode.script
|
||||||
params: {"script":"Z_TILT_ADJUST"}
|
params: {"script":"Z_TILT_ADJUST"}
|
||||||
enable: {{ printer.z_tilt is defined }}
|
enable: {{ 'z_tilt' in printer.config_sections }}
|
||||||
|
|
||||||
[menu __main temperature]
|
[menu __main temperature]
|
||||||
name: {{ gettext('Temperature') }}
|
name: {{ gettext('Temperature') }}
|
||||||
@ -95,13 +93,13 @@ panel: print
|
|||||||
name: {{ gettext('Bed Level') }}
|
name: {{ gettext('Bed Level') }}
|
||||||
icon: bed-level
|
icon: bed-level
|
||||||
panel: bed_level
|
panel: bed_level
|
||||||
enable: {{ printer.bed_screws or printer.screws_tilt_adjust}}
|
enable: {{ 'bed_screws' in printer.config_sections or 'screws_tilt_adjust' in printer.config_sections }}
|
||||||
|
|
||||||
[menu __main more bedmesh]
|
[menu __main more bedmesh]
|
||||||
name: {{ gettext('Bed Mesh') }}
|
name: {{ gettext('Bed Mesh') }}
|
||||||
icon: bed-mesh
|
icon: bed-mesh
|
||||||
panel: bed_mesh
|
panel: bed_mesh
|
||||||
enable: {{ printer.bed_mesh is defined }}
|
enable: {{ 'bed_mesh' in printer.config_sections }}
|
||||||
|
|
||||||
[menu __main more zoffset]
|
[menu __main more zoffset]
|
||||||
name: {{ gettext('Z Calibrate') }}
|
name: {{ gettext('Z Calibrate') }}
|
||||||
@ -147,13 +145,13 @@ enable: {{ printer.output_pins.count > 0 }}
|
|||||||
name: {{ gettext('Power') }}
|
name: {{ gettext('Power') }}
|
||||||
icon: shutdown
|
icon: shutdown
|
||||||
panel: power
|
panel: power
|
||||||
enable: {{ printer.power_devices.count > 0 }}
|
enable: {{ moonraker.power_devices.count > 0 }}
|
||||||
|
|
||||||
[menu __main more camera]
|
[menu __main more camera]
|
||||||
name: {{ gettext('Camera') }}
|
name: {{ gettext('Camera') }}
|
||||||
icon: camera
|
icon: camera
|
||||||
panel: camera
|
panel: camera
|
||||||
enable: {{ printer.cameras.count > 0 }}
|
enable: {{ moonraker.cameras.count > 0 }}
|
||||||
|
|
||||||
[menu __main more console]
|
[menu __main more console]
|
||||||
name: {{ gettext('Console') }}
|
name: {{ gettext('Console') }}
|
||||||
@ -220,7 +218,7 @@ enable: {{ printer.fans.count > 0 }}
|
|||||||
name: {{ gettext('Move') }}
|
name: {{ gettext('Move') }}
|
||||||
icon: move
|
icon: move
|
||||||
panel: move
|
panel: move
|
||||||
enable: {{ (printer.pause_resume.is_paused == True) }}
|
enable: {{ printer.pause_resume.is_paused }}
|
||||||
|
|
||||||
[menu __print extrude]
|
[menu __print extrude]
|
||||||
name: {{ gettext('Extrude') }}
|
name: {{ gettext('Extrude') }}
|
||||||
@ -232,7 +230,7 @@ enable: {{ printer.extruders.count > 0 }}
|
|||||||
name: {{ gettext('Power') }}
|
name: {{ gettext('Power') }}
|
||||||
icon: shutdown
|
icon: shutdown
|
||||||
panel: power
|
panel: power
|
||||||
enable: {{ printer.power_devices.count > 0 }}
|
enable: {{ moonraker.power_devices.count > 0 }}
|
||||||
|
|
||||||
[menu __print led]
|
[menu __print led]
|
||||||
name: {{ gettext('Leds') }}
|
name: {{ gettext('Leds') }}
|
||||||
@ -251,7 +249,7 @@ enable: {{ printer.gcode_macros.count > 0 }}
|
|||||||
name: {{ gettext('Camera') }}
|
name: {{ gettext('Camera') }}
|
||||||
icon: camera
|
icon: camera
|
||||||
panel: camera
|
panel: camera
|
||||||
enable: {{ printer.cameras.count > 0 }}
|
enable: {{ moonraker.cameras.count > 0 }}
|
||||||
|
|
||||||
[menu __print console]
|
[menu __print console]
|
||||||
name: {{ gettext('Console') }}
|
name: {{ gettext('Console') }}
|
||||||
@ -272,7 +270,7 @@ panel: network
|
|||||||
name: {{ gettext('Retraction') }}
|
name: {{ gettext('Retraction') }}
|
||||||
icon: retract
|
icon: retract
|
||||||
panel: retraction
|
panel: retraction
|
||||||
enable: {{ printer.firmware_retraction }}
|
enable: {{ 'firmware_retraction' in printer.config_sections }}
|
||||||
|
|
||||||
[menu __print settings]
|
[menu __print settings]
|
||||||
name: KlipperScreen
|
name: KlipperScreen
|
||||||
@ -286,7 +284,7 @@ name: {{ gettext('Menu') }}
|
|||||||
name: {{ gettext('Power') }}
|
name: {{ gettext('Power') }}
|
||||||
icon: shutdown
|
icon: shutdown
|
||||||
panel: power
|
panel: power
|
||||||
enable: {{ printer.power_devices.count > 0 }}
|
enable: {{ moonraker.power_devices.count > 0 }}
|
||||||
|
|
||||||
[menu __splashscreen network]
|
[menu __splashscreen network]
|
||||||
name: {{ gettext('Network') }}
|
name: {{ gettext('Network') }}
|
||||||
@ -308,10 +306,10 @@ panel: settings
|
|||||||
name: Spoolman
|
name: Spoolman
|
||||||
icon: spoolman
|
icon: spoolman
|
||||||
panel: spoolman
|
panel: spoolman
|
||||||
enable: {{ printer.spoolman }}
|
enable: {{ moonraker.spoolman }}
|
||||||
|
|
||||||
[menu __print spoolman]
|
[menu __print spoolman]
|
||||||
name: Spoolman
|
name: Spoolman
|
||||||
icon: spoolman
|
icon: spoolman
|
||||||
panel: spoolman
|
panel: spoolman
|
||||||
enable: {{ printer.spoolman }}
|
enable: {{ moonraker.spoolman }}
|
||||||
|
@ -242,33 +242,24 @@ class Printer:
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
def get_printer_status_data(self):
|
def get_printer_status_data(self):
|
||||||
data = {
|
return {
|
||||||
|
"moonraker": {
|
||||||
|
"power_devices": {"count": len(self.get_power_devices())},
|
||||||
|
"cameras": {"count": len(self.cameras)},
|
||||||
|
"spoolman": self.spoolman,
|
||||||
|
},
|
||||||
"printer": {
|
"printer": {
|
||||||
|
"pause_resume": {"is_paused": self.state == "paused"},
|
||||||
"extruders": {"count": self.extrudercount},
|
"extruders": {"count": self.extrudercount},
|
||||||
"temperature_devices": {"count": self.tempdevcount},
|
"temperature_devices": {"count": self.tempdevcount},
|
||||||
"fans": {"count": self.fancount},
|
"fans": {"count": self.fancount},
|
||||||
"output_pins": {"count": self.output_pin_count},
|
"output_pins": {"count": self.output_pin_count},
|
||||||
"gcode_macros": {"count": len(self.get_gcode_macros()), "list": self.get_gcode_macros()},
|
"gcode_macros": {"count": len(self.get_gcode_macros()), "list": self.get_gcode_macros()},
|
||||||
"idle_timeout": self.get_stat("idle_timeout").copy(),
|
|
||||||
"pause_resume": {"is_paused": self.state == "paused"},
|
|
||||||
"power_devices": {"count": len(self.get_power_devices())},
|
|
||||||
"cameras": {"count": len(self.cameras)},
|
|
||||||
"spoolman": self.spoolman,
|
|
||||||
"leds": {"count": self.ledcount},
|
"leds": {"count": self.ledcount},
|
||||||
|
"config_sections": [section for section in self.config.keys()],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sections = ["bed_mesh", "bltouch", "probe", "quad_gantry_level", "z_tilt"]
|
|
||||||
for section in sections:
|
|
||||||
if self.config_section_exists(section):
|
|
||||||
data["printer"][section] = self.get_config_section(section).copy()
|
|
||||||
|
|
||||||
sections = ["firmware_retraction", "input_shaper", "bed_screws", "screws_tilt_adjust"]
|
|
||||||
for section in sections:
|
|
||||||
data["printer"][section] = self.config_section_exists(section)
|
|
||||||
|
|
||||||
return data
|
|
||||||
|
|
||||||
def get_leds(self):
|
def get_leds(self):
|
||||||
return [
|
return [
|
||||||
led
|
led
|
||||||
|
Loading…
x
Reference in New Issue
Block a user