def __init__(self): super(Window, self).__init__() widget = QtGui.QWidget(self) layout = QtGui.QVBoxLayout(widget) self.button = QtGui.QPushButton("Send command", widget) layout.addWidget(self.button) self.textEdit = QtGui.QPlainTextEdit("Ready to send remote command...", widget) self.textEdit.setReadOnly(True) layout.addWidget(self.textEdit) self.setCentralWidget(widget) self.resize(640, 480) self.setWindowTitle("Client Application") self._remote = RpcConnection("Server", tcpaddr="127.0.0.1:40000") self.remoteCallFinished.connect(self.handleResponse) self.button.clicked.connect(self.sendRequest)
#print "Got action:", resp.result waitForAction = False def setObservations(resp, *args, **kwargs): global waitForObservationAck if(resp.result != -1): #print "Observation Set:" waitForObservationAck = False if __name__ == "__main__": WORKER_ID = 0 remote = RpcConnection("Server", workers=1) # if the server were using a TCP connection: # remote = RpcConnection("Server", tcpaddr="127.0.0.1:40000 time.sleep(1) counter = 0 while True: print "timestep: ", counter; finished = False while not finished: resp = remote.call("getAct",args=([WORKER_ID])) if(resp.result != -1): finished = True #print "I got the action, let me do some stuff" #time.sleep(0.01) #print "done, I am sending back the obs"