def krpc_connect(self): logger.info('Connecting to KSP...') try: Core.client().connect(ip=self.ip_input.text, rpc_port=int(self.rpc_port_input.text), stream_port=int(self.stream_port_input.text)) except (KrappErrorOSConnection, KrappErrorConnection): ErrorPopup().open()
def initialize(self, dt): Core.client().add_observer(self)
"""Run example application.""" import sys import logging from containers import Core, Application if __name__ == '__main__': # Configure platform: Core.config.update({ 'database': { 'dsn': ':memory:' }, 'aws': { 'access_key_id': 'KEY', 'secret_access_key': 'SECRET' }, 'auth': { 'token_ttl': 3600 } }) Core.logger().addHandler(logging.StreamHandler(sys.stdout)) # Run application: Application.main(uid=sys.argv[1], password=sys.argv[2], photo=sys.argv[3])
def initialize(self, dt): Core.client().add_observer(self) # Register as observer
from bluetoothscanner import BluetoothTinySineScanner import dependency_injector.providers as providers Core.config.override( dict(target='id1', max_disconnect_pings=5, period=5, presence={'filename': 'blueping.txt'}, bluetoothtinysinescanner={ 'port': 'com14', 'baudrate': 115200, 'serial_timeout_seconds': 30 })) # configure logger Core.logger().setLevel(logging.DEBUG) logFormatter = logging.Formatter("%(asctime)s %(message)s") consoleHandler = logging.StreamHandler() consoleHandler.setFormatter(logFormatter) Core.logger().addHandler(consoleHandler) dateTag = datetime.datetime.now().strftime("%Y-%b-%d_%H-%M-%S") fileHandler = logging.FileHandler("{0}-{1}.txt".format("log", dateTag)) fileHandler.setFormatter(logFormatter) Core.logger().addHandler(fileHandler) # configure presence logger Core.presence_logger().setLevel(logging.INFO) presenceFileHandler = logging.FileHandler(Core.config.presence.filename()) presenceFileHandler.setFormatter(logFormatter) Core.presence_logger().addHandler(presenceFileHandler)
def stage(self): Core.client().stage()
def on_enter(self, *args): Screen.on_enter(self, *args) Core.client().add_altitude_callback(self.update_altitude)