klippy: Add access methods and avoid peeking into the printer classes

Add get_reactor(), lookup_object(), lookup_module_objects(), and
set_rollover_info() to the main Printer class so that callers do not
need to peek into the class' members.  Similarly, add get_printer()
and get_name() methods to the ConfigWrapper class.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor
2018-01-19 22:22:17 -05:00
parent f0a754e496
commit 81013ba5c8
10 changed files with 103 additions and 85 deletions

View File

@@ -234,7 +234,7 @@ def add_printer_objects(printer, config):
printer.add_object('pins', PrinterPins())
def get_printer_pins(printer):
return printer.objects['pins']
return printer.lookup_object('pins')
def setup_pin(printer, pin_type, pin_desc):
return get_printer_pins(printer).setup_pin(pin_type, pin_desc)