aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2020-08-04 16:00:23 -0400
committerKevin O'Connor <kevin@koconnor.net>2020-08-06 14:21:08 -0400
commit4346d37c0662d7d0cae08968e0a5737afcd49c52 (patch)
tree463cc84e1e014152d518588a0fe339c29e9f74e0
parent8c8b9b18120ddba92551f8f07e2407f9d190c9db (diff)
downloadkutter-4346d37c0662d7d0cae08968e0a5737afcd49c52.tar.gz
kutter-4346d37c0662d7d0cae08968e0a5737afcd49c52.tar.xz
kutter-4346d37c0662d7d0cae08968e0a5737afcd49c52.zip
webhooks: Introduce add_early_printer_objects()
Create the initial gcode class via new module level add_early_printer_objects() function. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
-rw-r--r--klippy/klippy.py5
-rw-r--r--klippy/webhooks.py3
2 files changed, 6 insertions, 2 deletions
diff --git a/klippy/klippy.py b/klippy/klippy.py
index 678c0980..6a24d4a3 100644
--- a/klippy/klippy.py
+++ b/klippy/klippy.py
@@ -58,8 +58,9 @@ class Printer:
self.run_result = None
self.event_handlers = {}
self.objects = collections.OrderedDict()
- self.objects['webhooks'] = webhooks.WebHooks(self)
- gcode.add_early_printer_objects(self)
+ # Init printer components that must be setup prior to config
+ for m in [webhooks, gcode]:
+ m.add_early_printer_objects(self)
def get_start_args(self):
return self.start_args
def get_reactor(self):
diff --git a/klippy/webhooks.py b/klippy/webhooks.py
index 8be225a4..1c3645be 100644
--- a/klippy/webhooks.py
+++ b/klippy/webhooks.py
@@ -268,3 +268,6 @@ class WebHooks:
logging.info(msg)
raise WebRequestError(msg)
return cb
+
+def add_early_printer_objects(printer):
+ printer.add_object('webhooks', WebHooks(printer))