def getReplaceableExportGcode(nameOfReplaceFile, replaceableExportGcode): 'Get text with strings replaced according to replace.csv file.' replaceLines = settings.getAlterationLines(nameOfReplaceFile) if len(replaceLines) < 1: return replaceableExportGcode for replaceLine in replaceLines: splitLine = replaceLine.replace('\\n', '\t').split('\t') if len(splitLine) > 0: replaceableExportGcode = replaceableExportGcode.replace(splitLine[0], '\n'.join(splitLine[1 :])) output = cStringIO.StringIO() gcodec.addLinesToCString(output, archive.getTextLines(replaceableExportGcode)) return output.getvalue()
def getReplaceableExportGcode(nameOfReplaceFile, replaceableExportGcode): 'Get text with strings replaced according to replace.csv file.' replaceLines = settings.getAlterationLines(nameOfReplaceFile) if len(replaceLines) < 1: return replaceableExportGcode for replaceLine in replaceLines: splitLine = replaceLine.replace('\n', '\t').split('\t') if len(splitLine) > 0: replaceableExportGcode = replaceableExportGcode.replace(splitLine[0], '\n'.join(splitLine[1 :])) output = cStringIO.StringIO() gcodec.addLinesToCString(output, archive.getTextLines(replaceableExportGcode)) return output.getvalue()