aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2019-05-28 10:59:12 -0400
committerKevinOConnor <kevin@koconnor.net>2019-06-04 09:50:30 -0400
commitac8f6dfe20cbd59d6c6f5a187e430e16afaee9a8 (patch)
tree360052f2a908b647f82463700d7b10a57b259337
parenta238ec6f98e78af9d398c68b74d73f3254e0cbf3 (diff)
downloadkutter-ac8f6dfe20cbd59d6c6f5a187e430e16afaee9a8.tar.gz
kutter-ac8f6dfe20cbd59d6c6f5a187e430e16afaee9a8.tar.xz
kutter-ac8f6dfe20cbd59d6c6f5a187e430e16afaee9a8.zip
gcode_macro: Rename "status" helper to "printer"
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
-rw-r--r--docs/Config_Changes.md3
-rw-r--r--klippy/extras/gcode_macro.py10
2 files changed, 8 insertions, 5 deletions
diff --git a/docs/Config_Changes.md b/docs/Config_Changes.md
index 7ce25a1b..f317db5d 100644
--- a/docs/Config_Changes.md
+++ b/docs/Config_Changes.md
@@ -6,6 +6,9 @@ All dates in this document are approximate.
# Changes
+20190528: The magic "status" variable in gcode_macro template
+evaluation has been renamed to "printer".
+
20190520: The SET_GCODE_OFFSET command has changed; update any g-code
macros accordingly. The command will no longer apply the requested
offset to the next G1 command. The old behavior may be approximated by
diff --git a/klippy/extras/gcode_macro.py b/klippy/extras/gcode_macro.py
index ee28ccbd..57b2153d 100644
--- a/klippy/extras/gcode_macro.py
+++ b/klippy/extras/gcode_macro.py
@@ -11,8 +11,8 @@ import jinja2
# Template handling
######################################################################
-# Wrapper for "status" access to printer object get_status() methods
-class StatusWrapper:
+# Wrapper for access to printer object get_status() methods
+class GetStatusWrapper:
def __init__(self, printer, eventtime=None):
self.printer = printer
self.eventtime = eventtime
@@ -43,10 +43,10 @@ class TemplateWrapper:
logging.exception(msg)
raise printer.config_error(msg)
def create_status_wrapper(self, eventtime=None):
- return StatusWrapper(self.printer, eventtime)
+ return GetStatusWrapper(self.printer, eventtime)
def render(self, context=None):
if context is None:
- context = {'status': self.create_status_wrapper()}
+ context = {'printer': self.create_status_wrapper()}
try:
return str(self.template.render(context))
except Exception as e:
@@ -95,7 +95,7 @@ class GCodeMacro:
"Macro %s called recursively" % (self.alias,))
kwparams = dict(self.kwparams)
kwparams.update(params)
- kwparams['status'] = self.template.create_status_wrapper()
+ kwparams['printer'] = self.template.create_status_wrapper()
kwparams['params'] = params
self.in_script = True
try: