From ec34d78d5e40fb8db2acb56f948b962de73e0930 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Janar=20S=C3=B6=C3=B6t?= <janar.soot@gmail.com>
Date: Sun, 30 Jun 2019 14:11:45 +0300
Subject: [PATCH] gcode_macro: add iterator to status wrapper
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

It really helps to see a snapshot of available printer variables when building menus and macros. The list of variables always depends on what printer config you have.

Signed-off-by: Janar Sööt <janar.soot@gmail.com>
---
 klippy/extras/gcode_macro.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/klippy/extras/gcode_macro.py b/klippy/extras/gcode_macro.py
index 1918b0b9f..e5e69c7ed 100644
--- a/klippy/extras/gcode_macro.py
+++ b/klippy/extras/gcode_macro.py
@@ -34,6 +34,10 @@ class GetStatusWrapper:
         except KeyError as e:
             return False
         return True
+    def __iter__(self):
+        for name, obj in self.printer.lookup_objects():
+            if self.__contains__(name):
+                yield name
 
 # Wrapper around a Jinja2 template
 class TemplateWrapper: