diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2019-06-04 12:41:28 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2019-06-04 12:41:28 -0400 |
commit | d065787afcc312fd5bee709a9b8cb15647f0ab08 (patch) | |
tree | 7ffdca92809eab84f89dc534c70b7b2a9290e96c /klippy/extras | |
parent | 1c09a0935fdd233d617bd6cf9d14db97b38e1553 (diff) | |
download | kutter-d065787afcc312fd5bee709a9b8cb15647f0ab08.tar.gz kutter-d065787afcc312fd5bee709a9b8cb15647f0ab08.tar.xz kutter-d065787afcc312fd5bee709a9b8cb15647f0ab08.zip |
gcode_macro: Add support "x in printer" to templates
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/extras')
-rw-r--r-- | klippy/extras/gcode_macro.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/klippy/extras/gcode_macro.py b/klippy/extras/gcode_macro.py index a29e1248..0ad695b6 100644 --- a/klippy/extras/gcode_macro.py +++ b/klippy/extras/gcode_macro.py @@ -28,6 +28,12 @@ class GetStatusWrapper: self.eventtime = self.printer.get_reactor().monotonic() self.cache[sval] = res = dict(po.get_status(self.eventtime)) return res + def __contains__(self, val): + try: + self.__getitem__(val) + except KeyError as e: + return False + return True # Wrapper around a Jinja2 template class TemplateWrapper: |