From 3a4a1d678e47a54714ee56b393a7ac04ea612679 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Janar=20S=C3=B6=C3=B6t?= Date: Thu, 20 Dec 2018 21:37:31 +0200 Subject: [PATCH] menu: allow empty command gcode if action is present MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Janar Sööt --- klippy/extras/display/menu.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/klippy/extras/display/menu.py b/klippy/extras/display/menu.py index c4db2baf..1fc41fbf 100644 --- a/klippy/extras/display/menu.py +++ b/klippy/extras/display/menu.py @@ -474,8 +474,10 @@ class MenuItem(MenuElement): class MenuCommand(MenuItem): def __init__(self, manager, config, namespace=''): super(MenuCommand, self).__init__(manager, config, namespace) - self._gcode = config.get('gcode') + self._gcode = config.get('gcode', '') self._action = config.get('action', None) + if self._action is None and not self._gcode: + raise error("Missing or empty 'gcode' option") def is_readonly(self): return False