def load_file(self): self.is_loading = True file = open(self.filepath, 'rb') data = file.read() file.close() dg = PyDatagram(data) data = PyDatagramIterator(dg) for _ in range(data.get_uint8()): self.load_button(data) self.is_loading = False
def load_file(self): self.is_loading = True file = open(self.filepath, 'rb') data = file.read() file.close() dg = PyDatagram(data) data = PyDatagramIterator(dg) for _ in xrange(data.get_uint8()): self.load_button(data) self.is_loading = False
def _parse_msg_ntoh(self, datagram): msg = PyDatagramIterator(datagram) msgid = msg.get_uint8() data = {} if msgid == MessageTypes.update_entity: data['netid'] = msg.get_uint32() data['data'] = msg.get_string() elif msgid == MessageTypes.remove_entity: data['netid'] = msg.get_uint32() elif msgid == MessageTypes.register_player: pass elif msgid == MessageTypes.player_id: data['netid'] = msg.get_uint32() elif msgid == MessageTypes.player_input: data['netid'] = msg.get_uint32() data['movement_x'] = msg.get_int8() data['action_set'] = msg.get_string() else: RuntimeError("Unknown msgid:", msgid) return msgid, data
def _parse_msg_ntoh(self, datagram): msg = PyDatagramIterator(datagram) msgid = msg.get_uint8() data = {} if msgid == MessageTypes.update_entity: data['netid'] = msg.get_uint32() data['data'] = msg.get_string() elif msgid == MessageTypes.remove_entity: data['netid'] = msg.get_uint32() elif msgid == MessageTypes.register_player: pass elif msgid == MessageTypes.player_id: data['netid'] = msg.get_uint32() elif msgid == MessageTypes.player_input: data['netid'] = msg.get_uint32() data['movement_x'] = msg.get_int8() data['action_set'] = msg.get_string() else: RuntimeError("Unknown msgid:", msgid) return msgid, data