Exemple #1
0
def getAlterationFile(fileName, allowMagicPrefix = True):
	"Get the file from the fileName or the lowercase fileName in the alterations directories."
	#print ('getAlterationFile:', fileName)
	prefix = ''
	if allowMagicPrefix:
		if fileName == 'start.gcode':
			#For the start code, hack the temperature and the steps per E value into it. So the temperature is reached before the start code extrusion.
			#We also set our steps per E here, if configured.
			eSteps = float(getPreference('steps_per_e', '0'))
			if eSteps > 0:
				prefix += 'M92 E'+str(eSteps)+'\n'
			temp = float(getProfileSetting('print_temperature', '0'))
			if temp > 0:
				prefix += 'M109 S'+str(temp)+'\n'
		elif fileName == 'replace.csv':
			prefix = 'M101\nM103\n'
	alterationsDirectory = archive.getSkeinforgePath('alterations')
	fullFilename = os.path.join(alterationsDirectory, fileName)
	if os.path.isfile(fullFilename):
		return prefix + archive.getFileText( fullFilename )
	return prefix
Exemple #2
0
	def OnFocusLost(self, e):
		if self.currentFile == self.list.GetSelection():
			filename = os.path.join(archive.getSkeinforgePath('alterations'), self.alterationFileList[self.list.GetSelection()])
			f = open(filename, "wb")
			f.write(self.textArea.GetValue().encode("utf-8"))
			f.close()