def export_source_code(self, acting_client): if self.state_id != EditorState.STATE_LOADED: return ERRMSG_TODO_BAD_STATE_FUNCTIONALITY line_count = disassembly.get_file_line_count(self.disassembly_data) # Prompt for save file name. save_file = acting_client.request_code_save_file() if save_file is not None: for i in xrange(line_count): label_text = disassembly.get_file_line(self.disassembly_data, i, disassembly.LI_LABEL) instruction_text = disassembly.get_file_line(self.disassembly_data, i, disassembly.LI_INSTRUCTION) operands_text = disassembly.get_file_line(self.disassembly_data, i, disassembly.LI_OPERANDS) if label_text: save_file.write(label_text) if instruction_text or operands_text: save_file.write("\t") save_file.write(instruction_text) if operands_text: save_file.write("\t") save_file.write(operands_text) save_file.write("\n") save_file.close()
def get_line_count(self, acting_client): if self.disassembly_data is None: return 0 return disassembly.get_file_line_count(self.disassembly_data)