def main(): def cleanup_exit(*args, **kwargs): print("\nBye!") Program.stop() s.disable() w.disable() m.disable() WebSocketBase.stop_reactor() exit() signal.signal(signal.SIGINT, cleanup_exit) w = WriterProxy(items=writer) s = SwitchProxy(items=switches, switch_programs_file=switch_programs_file) m = ManagerProxy(items=manager) # Start first program in circle w.enable() s.enable() WebSocketBase.start_reactor() s.next() # is blocking if urwid enabled # urwid has to be run in the main thread m.enable() if not m.is_urwid_enabled(): signal.pause() cleanup_exit()
def cleanup_exit(*args, **kwargs): print("\nBye!") Program.stop() s.disable() w.disable() m.disable() WebSocketBase.stop_reactor() exit()
def __init__(self, port=8003, bind_address='localhost'): Manager.__init__(self) WebSocketBase.__init__(self, port, bind_address)
def __init__(self, port=8002, bind_address='localhost'): Writer.__init__(self) WebSocketBase.__init__(self, port, bind_address)