Example #1
0
def getSelectedPluginModule(plugins):
    "Get the selected plugin module."
    for plugin in plugins:
        if plugin.value:
            return gcodec.getModuleWithDirectoryPath(plugin.directoryPath,
                                                     plugin.name)
    return None
Example #2
0
def writeOutput( fileName = '', gcodeText = '' ):
	"Analyze a gcode file.  If no fileName is specified, comment the first gcode file in this folder that is not modified."
	gcodeText = gcodec.getTextIfEmpty( fileName, gcodeText )
	pluginFilenames = getPluginFilenames()
	for pluginFilename in pluginFilenames:
		analyzePluginsDirectoryPath = getPluginsDirectoryPath()
		pluginModule = gcodec.getModuleWithDirectoryPath( analyzePluginsDirectoryPath, pluginFilename )
		if pluginModule != None:
			pluginModule.writeOutput( fileName, gcodeText )
Example #3
0
def writeOutput( fileName, gcodeText = '' ):
	"Analyze a gcode file."
	gcodeText = gcodec.getTextIfEmpty( fileName, gcodeText )
	pluginFileNames = getPluginFileNames()
	for pluginFileName in pluginFileNames:
		analyzePluginsDirectoryPath = getPluginsDirectoryPath()
		pluginModule = gcodec.getModuleWithDirectoryPath( analyzePluginsDirectoryPath, pluginFileName )
		if pluginModule != None:
			pluginModule.writeOutput( fileName, gcodeText )
Example #4
0
def writeOutput(fileName, gcodeText=''):
    "Analyze a gcode file."
    gcodeText = gcodec.getTextIfEmpty(fileName, gcodeText)
    pluginFileNames = getPluginFileNames()
    for pluginFileName in pluginFileNames:
        analyzePluginsDirectoryPath = getPluginsDirectoryPath()
        pluginModule = gcodec.getModuleWithDirectoryPath(
            analyzePluginsDirectoryPath, pluginFileName)
        if pluginModule != None:
            pluginModule.writeOutput(fileName, gcodeText)
Example #5
0
def getCarving( fileName ):
	"Get a carving for the file using an import plugin."
	importPluginFileNames = interpret.getImportPluginFileNames()
	for importPluginFileName in importPluginFileNames:
		fileTypeDot = '.' + importPluginFileName
		if fileName[ - len( fileTypeDot ) : ].lower() == fileTypeDot:
			importPluginsDirectoryPath = gcodec.getAbsoluteFolderPath( os.path.dirname( __file__ ), 'import_plugins' )
			pluginModule = gcodec.getModuleWithDirectoryPath( importPluginsDirectoryPath, importPluginFileName )
			if pluginModule != None:
				return pluginModule.getCarving( fileName )
	print( 'Could not find plugin to handle ' + fileName )
	return None
Example #6
0
	def display( self ):
		"Display the export canvas repository dialog."
		for repositoryDialog in settings.globalRepositoryDialogListTable:
			if repositoryDialog.repository.lowerName == self.name:
				repositoryDialog.setCanvasFileNameSuffix( self.canvas, self.skein.fileName, self.suffix )
				settings.liftRepositoryDialogs( settings.globalRepositoryDialogListTable[ repositoryDialog ] )
				return
		exportCanvasPluginsFolderPath = gcodec.getAbsoluteFolderPath( os.path.dirname( __file__ ), 'export_canvas_plugins' )
		pluginModule = gcodec.getModuleWithDirectoryPath( exportCanvasPluginsFolderPath, self.name )
		if pluginModule == None:
			return None
		pluginRepository = pluginModule.getNewRepository()
		pluginRepository.setCanvasFileNameSuffix( self.canvas, self.fileName, self.suffix )
		settings.getDisplayedDialogFromConstructor( pluginRepository )
Example #7
0
def getCarving(fileName):
    "Get a carving for the file using an import plugin."
    importPluginFileNames = interpret.getImportPluginFileNames()
    for importPluginFileName in importPluginFileNames:
        fileTypeDot = '.' + importPluginFileName
        if fileName[-len(fileTypeDot):].lower() == fileTypeDot:
            importPluginsDirectoryPath = gcodec.getAbsoluteFolderPath(
                os.path.dirname(__file__), 'import_plugins')
            pluginModule = gcodec.getModuleWithDirectoryPath(
                importPluginsDirectoryPath, importPluginFileName)
            if pluginModule != None:
                return pluginModule.getCarving(fileName)
    print('Could not find plugin to handle ' + fileName)
    return None
Example #8
0
 def display(self):
     "Display the export canvas repository dialog."
     for repositoryDialog in settings.globalRepositoryDialogListTable:
         if repositoryDialog.repository.lowerName == self.name:
             repositoryDialog.setCanvasFileNameSuffix(
                 self.canvas, self.skein.fileName, self.suffix)
             settings.liftRepositoryDialogs(
                 settings.globalRepositoryDialogListTable[repositoryDialog])
             return
     exportCanvasPluginsFolderPath = gcodec.getAbsoluteFolderPath(
         os.path.dirname(__file__), 'export_canvas_plugins')
     pluginModule = gcodec.getModuleWithDirectoryPath(
         exportCanvasPluginsFolderPath, self.name)
     if pluginModule == None:
         return None
     pluginRepository = pluginModule.getNewRepository()
     pluginRepository.setCanvasFileNameSuffix(self.canvas, self.fileName,
                                              self.suffix)
     settings.getDisplayedDialogFromConstructor(pluginRepository)
Example #9
0
def getCraftModule( fileName ):
	"Get craft module."
	craftPluginsDirectoryPath = gcodec.getAbsoluteFolderPath( os.path.dirname( __file__ ), 'craft_plugins' )
	return gcodec.getModuleWithDirectoryPath( craftPluginsDirectoryPath, fileName )
Example #10
0
def getCraftTypePluginModule( craftTypeName = '' ):
	"Get the craft type plugin module."
	if craftTypeName == '':
		craftTypeName = getCraftTypeName()
	profilePluginsDirectoryPath = getPluginsDirectoryPath()
	return gcodec.getModuleWithDirectoryPath( profilePluginsDirectoryPath, craftTypeName )
Example #11
0
def getSelectedPluginModule( plugins ):
	"Get the selected plugin module."
	for plugin in plugins:
		if plugin.value:
			return gcodec.getModuleWithDirectoryPath( plugin.directoryPath, plugin.name )
	return None
Example #12
0
def getCraftModule(fileName):
    "Get craft module."
    craftPluginsDirectoryPath = gcodec.getAbsoluteFolderPath(
        os.path.dirname(__file__), 'craft_plugins')
    return gcodec.getModuleWithDirectoryPath(craftPluginsDirectoryPath,
                                             fileName)