# Path: skeinforge_application/skeinforge_utilities/skeinforge_craft.py
# def getChainText( fileName, procedure ):
# def getChainTextFromProcedures(fileName, procedures, text):
# def getCraftModule(pluginName):
# def getCraftPreferences(pluginName):
# def getCraftValue(preferenceName, preferences):
# def getLastModule():
# def getNewRepository():
# def getPluginFileNames():
# def getPluginsDirectoryPath():
# def getProcedures(procedure, text):
# def getReadCraftSequence():
# def writeChainTextWithNounMessage(fileName, procedure, shouldAnalyze=True):
# def writeOutput(fileName, shouldAnalyze=True):
# def writeSVGTextWithNounMessage(fileName, repository, shouldAnalyze=True):
# 	def addToDialog( self, gridPosition ):
# 	def getFromRadioPlugins( self, radioPlugins, repository ):
# 	def save(self):
# 	def setRadioButtons(self):
# 	def __init__(self):
# 	def execute(self):
# def main():
# class CraftRadioButtonsSaveListener:
# class CraftRepository:


import __init__
import os
import sys
from datetime import date, datetime
from fabmetheus_utilities.fabmetheus_tools import fabmetheus_interpret
from fabmetheus_utilities.svg_reader import SVGReader
from fabmetheus_utilities import archive
from fabmetheus_utilities import euclidean
from fabmetheus_utilities import gcodec
from fabmetheus_utilities import intercircle
from fabmetheus_utilities import settings
from fabmetheus_utilities import svg_writer
from skeinforge_application.skeinforge_utilities import skeinforge_craft
from skeinforge_application.skeinforge_utilities import skeinforge_polyfile
from skeinforge_application.skeinforge_utilities import skeinforge_profile
from time import strftime
		self.distanceFeedRate.addTagRoundedLine('perimeterWidth', edgeWidth)
		self.distanceFeedRate.addTagBracketedLine('profileName', skeinforge_profile.getProfileName(craftTypeName))
		self.distanceFeedRate.addLine('(<settings>)')
		pluginFileNames = skeinforge_craft.getPluginFileNames()
		for pluginFileName in pluginFileNames:
			self.addToolSettingLines(pluginFileName)
		self.distanceFeedRate.addLine('(</settings>)')
		self.distanceFeedRate.addTagBracketedLine('timeStampPreface', strftime('%Y%m%d_%H%M%S'))
		procedureNames = self.svgReader.sliceDictionary['procedureName'].replace(',', ' ').split()
		for procedureName in procedureNames:
			self.distanceFeedRate.addTagBracketedProcedure(procedureName)
		self.distanceFeedRate.addTagBracketedProcedure('preface')
		self.distanceFeedRate.addLine('(</extruderInitialization>)') # Initialization is finished, extrusion is starting.
		self.distanceFeedRate.addLine('(<crafting>)') # Initialization is finished, crafting is starting.

	def addPreface( self, loopLayer ):
		"Add preface to the carve layer."
		self.distanceFeedRate.addLine('(<layer> %s )' % loopLayer.z ) # Indicate that a new layer is starting.
		for loop in loopLayer.loops:
			self.distanceFeedRate.addGcodeFromLoop(loop, loopLayer.z)
		self.distanceFeedRate.addLine('(</layer>)')

	def addShutdownToOutput(self):
		"Add shutdown gcode to the output."
		self.distanceFeedRate.addLine('(</crafting>)') # GCode formatted comment
		if self.repository.turnExtruderOffAtShutDown.value:
			self.distanceFeedRate.addLine('M103') # Turn extruder motor off.

	def addToolSettingLines(self, pluginName):
		"Add tool setting lines."

# Path: skeinforge_application/skeinforge_utilities/skeinforge_craft.py
# def getChainText( fileName, procedure ):
# def getChainTextFromProcedures(fileName, procedures, text):
# def getCraftModule(pluginName):
# def getCraftPreferences(pluginName):
# def getCraftValue(preferenceName, preferences):
# def getLastModule():
# def getNewRepository():
# def getPluginFileNames():
# def getPluginsDirectoryPath():
# def getProcedures(procedure, text):
# def getReadCraftSequence():
# def writeChainTextWithNounMessage(fileName, procedure, shouldAnalyze=True):
# def writeOutput(fileName, shouldAnalyze=True):
# def writeSVGTextWithNounMessage(fileName, repository, shouldAnalyze=True):
# 	def addToDialog( self, gridPosition ):
# 	def getFromRadioPlugins( self, radioPlugins, repository ):
# 	def save(self):
# 	def setRadioButtons(self):
# 	def __init__(self):
# 	def execute(self):
# def main():
# class CraftRadioButtonsSaveListener:
# class CraftRepository:


# Path: skeinforge_application/skeinforge_plugins/craft_plugins/preface.py
import __init__
import os
import sys
from datetime import date, datetime
from fabmetheus_utilities.fabmetheus_tools import fabmetheus_interpret
from fabmetheus_utilities.svg_reader import SVGReader
from fabmetheus_utilities import archive
from fabmetheus_utilities import euclidean
from fabmetheus_utilities import gcodec
from fabmetheus_utilities import intercircle
from fabmetheus_utilities import settings
from fabmetheus_utilities import svg_writer
from skeinforge_application.skeinforge_utilities import skeinforge_craft
from skeinforge_application.skeinforge_utilities import skeinforge_polyfile
from skeinforge_application.skeinforge_utilities import skeinforge_profile
from time import strftime

		self.distanceFeedRate.addTagRoundedLine('perimeterWidth', edgeWidth)
		self.distanceFeedRate.addTagBracketedLine('profileName', skeinforge_profile.getProfileName(craftTypeName))
		self.distanceFeedRate.addLine('(<settings>)')
		pluginFileNames = skeinforge_craft.getPluginFileNames()
		for pluginFileName in pluginFileNames:
			self.addToolSettingLines(pluginFileName)
		self.distanceFeedRate.addLine('(</settings>)')
		self.distanceFeedRate.addTagBracketedLine('timeStampPreface', strftime('%Y%m%d_%H%M%S'))
		procedureNames = self.svgReader.sliceDictionary['procedureName'].replace(',', ' ').split()
		for procedureName in procedureNames:
			self.distanceFeedRate.addTagBracketedProcedure(procedureName)
		self.distanceFeedRate.addTagBracketedProcedure('preface')
		self.distanceFeedRate.addLine('(</extruderInitialization>)') # Initialization is finished, extrusion is starting.
		self.distanceFeedRate.addLine('(<crafting>)') # Initialization is finished, crafting is starting.

	def addPreface( self, loopLayer ):
		"Add preface to the carve layer."
		self.distanceFeedRate.addLine('(<layer> %s )' % loopLayer.z ) # Indicate that a new layer is starting.
		for loop in loopLayer.loops:
			self.distanceFeedRate.addGcodeFromLoop(loop, loopLayer.z)
		self.distanceFeedRate.addLine('(</layer>)')

	def addShutdownToOutput(self):
		"Add shutdown gcode to the output."
		self.distanceFeedRate.addLine('(</crafting>)') # GCode formatted comment
		if self.repository.turnExtruderOffAtShutDown.value:
			self.distanceFeedRate.addLine('M103') # Turn extruder motor off.

	def addToolSettingLines(self, pluginName):
		"Add tool setting lines."

		preferences = skeinforge_craft.getCraftPreferences(pluginName)