def dataReceived(self, data): self.buffer.write(data) for message in self.message_unpacker: if message is not None: name, kw = encoder.loads(message) kw['_conn'] = self kw['reply'] = self.post if name == 'NET_RESPONSE': self.callbacks[kw['_uid']](kw) else: driver.post(name, **kw) else: break
def pump_events(): event_name = pygame.event.event_name while True: for event in pygame.event.get(): driver.post(event_name(event.type), **event.dict) yield None