Fixed the gcode start/end editor (was modified by the M92 and temperature insertion hacks)

This commit is contained in:
daid 2012-02-29 16:36:14 +01:00
parent 5481b6e636
commit a73c1c1ca2
2 changed files with 14 additions and 13 deletions

View File

@ -442,21 +442,22 @@ def getAlterationFileLines(fileName):
def getAlterationLines(fileName):
return archive.getTextLines(getAlterationFile(fileName))
def getAlterationFile(fileName):
def getAlterationFile(fileName, allowMagicPrefix = True):
"Get the file from the fileName or the lowercase fileName in the alterations directories."
#print ('getAlterationFile:', fileName)
prefix = ''
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(getSetting('steps_per_e_unit', '0'))
if eSteps > 0:
prefix += 'M92 E'+str(eSteps)+'\n'
temp = float(getSetting('print_temperature', '0'))
if temp > 0:
prefix += 'M109 S'+str(temp)+'\n'
elif fileName == 'replace.csv':
prefix = 'M101\nM103\n'
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(getSetting('steps_per_e_unit', '0'))
if eSteps > 0:
prefix += 'M92 E'+str(eSteps)+'\n'
temp = float(getSetting('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):

View File

@ -30,7 +30,7 @@ class alterationPanel(wx.Panel):
self.loadFile(self.alterationFileList[self.list.GetSelection()])
def loadFile(self, filename):
self.textArea.SetValue(settings.getAlterationFile(filename))
self.textArea.SetValue(settings.getAlterationFile(filename, False))
def OnFocusLost(self, e):
filename = os.path.join(archive.getSkeinforgePath('alterations'), self.alterationFileList[self.list.GetSelection()])