Example #1
0
 def __init__(self, fileName):
     "Add empty lists."
     self.maximumZ = -999999999.0
     self.minimumZ = 999999999.0
     self.layerThickness = None
     self.rotatedBoundaryLayers = []
     self.untilDotName = gcodec.getUntilDot(fileName)
Example #2
0
def processXMLElement( xmlElement, xmlProcessor ):
	"Process the xml element."
	fileName = evaluate.getEvaluatedValue('file', xmlElement )
	if fileName == None:
		return
	parserFileName = xmlElement.getRoot().parser.fileName
	absoluteFileName = gcodec.getAbsoluteFolderPath( parserFileName, fileName )
	xmlText = ''
	if fileName.endswith('.xml'):
		xmlText = gcodec.getFileText( absoluteFileName )
	else:
		xmlText = getXMLFromCarvingFileName( absoluteFileName )
	if xmlText == '':
		print('The file %s could not be found in the folder which the fabmetheus xml file is in.' % fileName )
		return
	if '_importname' in xmlElement.attributeDictionary:
		xmlElement.importName = xmlElement.attributeDictionary['_importname']
	else:
		xmlElement.importName = gcodec.getUntilDot( fileName )
		xmlElement.attributeDictionary['_importname'] = xmlElement.importName
	XMLSimpleReader( parserFileName, xmlElement, xmlText )
	originalChildren = xmlElement.children[ : ]
	xmlElement.children = []
	for child in originalChildren:
		for subchild in child.children:
			subchild.setParentAddToChildren(xmlElement)
		for attributeDictionaryKey in child.attributeDictionary.keys():
			if attributeDictionaryKey != 'version':
				xmlElement.attributeDictionary[ attributeDictionaryKey ] = child.attributeDictionary[ attributeDictionaryKey ]
	group.processShape( group.Group, xmlElement, xmlProcessor )
	root = xmlElement.getRoot()
	root.idDictionary[ xmlElement.importName ] = evaluate.ElementID(xmlElement)
	root.nameDictionary[ xmlElement.importName ] = evaluate.ElementName(xmlElement)
Example #3
0
def processXMLElement(xmlElement):
    "Process the xml element."
    fileName = evaluate.getEvaluatedValue("file", xmlElement)
    if fileName == None:
        return
    parserFileName = xmlElement.getRoot().parser.fileName
    absoluteFileName = gcodec.getAbsoluteFolderPath(parserFileName, fileName)
    xmlText = ""
    if fileName.endswith(".xml"):
        xmlText = gcodec.getFileText(absoluteFileName)
    else:
        xmlText = getXMLFromCarvingFileName(absoluteFileName)
    if xmlText == "":
        print("The file %s could not be found in the folder which the fabmetheus xml file is in." % fileName)
        return
    if "_importname" in xmlElement.attributeDictionary:
        xmlElement.importName = xmlElement.attributeDictionary["_importname"]
    else:
        xmlElement.importName = gcodec.getUntilDot(fileName)
        xmlElement.attributeDictionary["_importname"] = xmlElement.importName
    XMLSimpleReader(parserFileName, xmlElement, xmlText)
    originalChildren = xmlElement.children[:]
    xmlElement.children = []
    for child in originalChildren:
        for subchild in child.children:
            subchild.setParentAddToChildren(xmlElement)
        for attributeDictionaryKey in child.attributeDictionary.keys():
            if attributeDictionaryKey != "version":
                xmlElement.attributeDictionary[attributeDictionaryKey] = child.attributeDictionary[
                    attributeDictionaryKey
                ]
    group.processShape(group.Group, xmlElement)
Example #4
0
def processXMLElement(xmlElement):
    "Process the xml element."
    fileName = evaluate.getEvaluatedValue('file', xmlElement)
    if fileName == None:
        return
    parserFileName = xmlElement.getRoot().parser.fileName
    absoluteFileName = gcodec.getAbsoluteFolderPath(parserFileName, fileName)
    xmlText = ''
    if fileName.endswith('.xml'):
        xmlText = gcodec.getFileText(absoluteFileName)
    else:
        xmlText = getXMLFromCarvingFileName(absoluteFileName)
    if xmlText == '':
        print(
            'The file %s could not be found in the folder which the fabmetheus xml file is in.'
            % fileName)
        return
    if '_importname' in xmlElement.attributeDictionary:
        xmlElement.importName = xmlElement.attributeDictionary['_importname']
    else:
        xmlElement.importName = gcodec.getUntilDot(fileName)
        xmlElement.attributeDictionary['_importname'] = xmlElement.importName
    XMLSimpleReader(parserFileName, xmlElement, xmlText)
    originalChildren = xmlElement.children[:]
    xmlElement.children = []
    for child in originalChildren:
        for subchild in child.children:
            subchild.setParentAddToChildren(xmlElement)
        for attributeDictionaryKey in child.attributeDictionary.keys():
            if attributeDictionaryKey != 'version':
                xmlElement.attributeDictionary[
                    attributeDictionaryKey] = child.attributeDictionary[
                        attributeDictionaryKey]
    group.processShape(group.Group, xmlElement)
Example #5
0
	def __init__( self, fileName ):
		"Add empty lists."
		self.maximumZ = - 999999999.0
		self.minimumZ = 999999999.0
		self.layerThickness = None
		self.rotatedBoundaryLayers = []
		self.untilDotName = gcodec.getUntilDot( fileName )
Example #6
0
	def addPhotoImage( self, fileName, gridPosition ):
		"Get a PhotoImage button, grid the button and increment the grid position."
		photoImage = None
		try:
			photoImage = settings.Tkinter.PhotoImage( file = os.path.join( self.imagesDirectoryPath, fileName ), master = gridPosition.master )
		except:
			print('Image %s was not found in the images directory, so a text button will be substituted.' % fileName )
		untilDotFileName = gcodec.getUntilDot(fileName)
		self.photoImages[ untilDotFileName ] = photoImage
		return untilDotFileName
Example #7
0
def addToCraftMenu( menu ):
	"Add a craft plugin menu."
	settings.ToolDialog().addPluginToMenu( menu, gcodec.getUntilDot( os.path.abspath( __file__ ) ) )
	menu.add_separator()
	directoryPath = skeinforge_craft.getPluginsDirectoryPath()
	directoryFolders = settings.getFolders( directoryPath )
	pluginFileNames = skeinforge_craft.getPluginFileNames()
	for pluginFileName in pluginFileNames:
		pluginFolderName = pluginFileName + '_plugins'
		pluginPath = os.path.join( directoryPath, pluginFileName )
		if pluginFolderName in directoryFolders:
			addSubmenus( menu, pluginFileName, os.path.join( directoryPath, pluginFolderName ), pluginPath )
		else:
			settings.ToolDialog().addPluginToMenu( menu, pluginPath )
Example #8
0
 def addPhotoImage(self, fileName, gridPosition):
     "Get a PhotoImage button, grid the button and increment the grid position."
     photoImage = None
     try:
         photoImage = settings.Tkinter.PhotoImage(
             file=os.path.join(self.imagesDirectoryPath, fileName),
             master=gridPosition.master)
     except:
         print(
             'Image %s was not found in the images directory, so a text button will be substituted.'
             % fileName)
     untilDotFileName = gcodec.getUntilDot(fileName)
     self.photoImages[untilDotFileName] = photoImage
     return untilDotFileName
Example #9
0
def addToCraftMenu(menu):
    "Add a craft plugin menu."
    settings.ToolDialog().addPluginToMenu(
        menu, gcodec.getUntilDot(os.path.abspath(__file__)))
    menu.add_separator()
    directoryPath = skeinforge_craft.getPluginsDirectoryPath()
    directoryFolders = settings.getFolders(directoryPath)
    pluginFileNames = skeinforge_craft.getPluginFileNames()
    for pluginFileName in pluginFileNames:
        pluginFolderName = pluginFileName + '_plugins'
        pluginPath = os.path.join(directoryPath, pluginFileName)
        if pluginFolderName in directoryFolders:
            addSubmenus(menu, pluginFileName,
                        os.path.join(directoryPath, pluginFolderName),
                        pluginPath)
        else:
            settings.ToolDialog().addPluginToMenu(menu, pluginPath)
Example #10
0
def processXMLElement( xmlElement, xmlProcessor ):
	"Process the xml element."
	fileName = evaluate.getEvaluatedValue( 'file', xmlElement )
	if fileName == None:
		return
	parserFileName = xmlElement.getRoot().parser.fileName
	absoluteFileName = gcodec.getAbsoluteFolderPath( parserFileName, fileName )
	xmlText = getXMLFromFileName( absoluteFileName )
	if xmlText == '':
		print( 'The file %s could not be found in the folder which the fabmetheus xml file is in.' % fileName )
		return
	if '_importname' in xmlElement.attributeDictionary:
		xmlElement.importName = xmlElement.attributeDictionary[ '_importname' ]
	else:
		xmlElement.importName = gcodec.getUntilDot( fileName )
		xmlElement.attributeDictionary[ '_importname' ] = xmlElement.importName
	XMLSimpleParser( parserFileName, xmlElement, xmlText )
	group.processShape( group.Group, xmlElement, xmlProcessor )
	root = xmlElement.getRoot()
	root.idDictionary[ xmlElement.importName ] = evaluate.ElementID( xmlElement )
	root.nameDictionary[ xmlElement.importName ] = evaluate.ElementName( xmlElement )
Example #11
0
def processXMLElement(xmlElement, xmlProcessor):
    "Process the xml element."
    fileName = evaluate.getEvaluatedValue('file', xmlElement)
    if fileName == None:
        return
    parserFileName = xmlElement.getRoot().parser.fileName
    absoluteFileName = gcodec.getAbsoluteFolderPath(parserFileName, fileName)
    xmlText = getXMLFromFileName(absoluteFileName)
    if xmlText == '':
        print(
            'The file %s could not be found in the folder which the fabmetheus xml file is in.'
            % fileName)
        return
    if '_importname' in xmlElement.attributeDictionary:
        xmlElement.importName = xmlElement.attributeDictionary['_importname']
    else:
        xmlElement.importName = gcodec.getUntilDot(fileName)
        xmlElement.attributeDictionary['_importname'] = xmlElement.importName
    XMLSimpleParser(parserFileName, xmlElement, xmlText)
    group.processShape(group.Group, xmlElement, xmlProcessor)
    root = xmlElement.getRoot()
    root.idDictionary[xmlElement.importName] = evaluate.ElementID(xmlElement)
    root.nameDictionary[xmlElement.importName] = evaluate.ElementName(
        xmlElement)