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>
This commit is contained in:
Kevin O'Connor 2020-08-04 16:00:23 -04:00
parent 8c8b9b1812
commit 4346d37c06
2 changed files with 6 additions and 2 deletions

View File

@ -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):

View File

@ -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))