def connect(self): while True: try: c = Client('127.0.0.1', 65448) return c except: pass print('Connecting...') sleep(1)
dashrpc = DashRPC(mainnet=MAINNET) vend = Vend() dataQueue = queue.PriorityQueue() #init GUI listener = GuiListener(65448, dataQueue) #DONE listener.setDaemon(True) listener.start() while True: try: c = Client('127.0.0.1', 65449) break except: pass print('Connecting...') time.sleep(1) # End init GUI info("connecting to dashd, waiting for masternode and budget sync") dashrpc.connect() while (not dashrpc.ready()): time.sleep(10) rpcaddress = RPCAddress(mainnet=MAINNET, dashrpc=dashrpc) vend.set_address_chain(rpcaddress) # attach address
from gui.guilistener import GuiListener from coffe_machine import PiHatListener from config import DRINK_IDS from config import DRINK_UUIDS if __name__ == "__main__": start_time = 0 dataQueue = queue.PriorityQueue() listener = GuiListener(port=65448, dataQueue=dataQueue) listener.setDaemon(True) listener.start() while True: try: c = Client('127.0.0.1', 65449) break except: pass print('Connecting') time.sleep(1) parser = Parser(dataQueue=dataQueue) parser.setDaemon(True) parser.start() ph1 = PiHatListener(dataQueue=dataQueue) ph1.setDaemon(True) ph1.start() ph1.subscribeToVMC()