def protocol_const(code_path, mess_name_ids): file_name = code_path + 'msg.py' _str_msg_head = '#!/usr/bin/env python\n# coding:utf-8\n\n\n' _str_msg = '' for mess_name_id in mess_name_ids: mess_name = mess_name_id['mess_name'] mess_id = mess_name_id['mess_id'] mess_note = mess_name_id['mess_note'] _str_msg += '# ' + mess_note + '\n' + tool.python_proto_name_msg(mess_name).ljust(40, chr(32)) + ' = ' + str(mess_id) + '\n\n' _str_msg = _str_msg_head + _str_msg[:-1] with open(file_name, 'w+') as fd: fd.write(_str_msg)
def protocol_const(code_path, mess_name_ids): file_name = code_path + 'msg.py' _str_msg_head = '#!/usr/bin/env python\n# coding:utf-8\n\n\n' _str_msg = '' for mess_name_id in mess_name_ids: mess_name = mess_name_id['mess_name'] mess_id = mess_name_id['mess_id'] mess_note = mess_name_id['mess_note'] _str_msg += '# ' + mess_note + '\n' + tool.python_proto_name_msg( mess_name).ljust(40, chr(32)) + ' = ' + str(mess_id) + '\n\n' _str_msg = _str_msg_head + _str_msg[:-1] with open(file_name, 'w+') as fd: fd.write(_str_msg)
def _set_class_name(self): self._str_msg_name = tool.python_proto_name_msg(self._mess_name) self._str_class_name = tool.python_class_name(self._mess_name)
def _set_class_name(self): self._str_msg_name = tool.python_proto_name_msg(self._mess_name) self._str_class_name= tool.python_class_name(self._mess_name)