From 7289af65609726b21d41f59de436a3ac7865e8b0 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Tue, 11 Aug 2020 16:43:39 -0400 Subject: [PATCH] webhooks: Create StatusHandler class in add_early_printer_objects() Signed-off-by: Kevin O'Connor --- klippy/webhooks.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/klippy/webhooks.py b/klippy/webhooks.py index 30807db8..dbe67cf2 100644 --- a/klippy/webhooks.py +++ b/klippy/webhooks.py @@ -258,7 +258,6 @@ class WebHooks: self.register_endpoint("info", self._handle_info_request) self.register_endpoint("emergency_stop", self._handle_estop_request) self.sconn = ServerSocket(self, printer) - StatusHandler(self) # Register Events printer.register_event_handler( @@ -330,9 +329,9 @@ class WebHooks: SUBSCRIPTION_REFRESH_TIME = .25 class StatusHandler: - def __init__(self, webhooks): - self.printer = webhooks.printer - self.webhooks = webhooks + def __init__(self, printer): + self.printer = printer + self.webhooks = webhooks = printer.lookup_object('webhooks') self.ready = self.timer_started = False self.reactor = self.printer.get_reactor() self.available_objects = {} @@ -462,3 +461,4 @@ class StatusHandler: def add_early_printer_objects(printer): printer.add_object('webhooks', WebHooks(printer)) + StatusHandler(printer)