class SmoothieHost(App): #Factory.register('Comms', cls=Comms) def __init__(self, **kwargs): super(SmoothieHost, self).__init__(**kwargs) self.comms = Comms(self) if len(sys.argv) > 1: # override com port self.use_com_port = sys.argv[1] else: self.use_com_port = None def build_config(self, config): config.setdefaults( 'General', { 'last_gcode_path': os.path.expanduser("~"), 'last_print_file': '', 'serial_port': '/dev/ttyACM0' }) def on_stop(self): # The Kivy event loop is about to stop, stop the async main loop self.comms.stop() # stop the aysnc loop def build(self): return MainWindow()