def getCraftTypePluginModule(craftTypeName=''): "Get the craft type plugin module." if craftTypeName == '': craftTypeName = getCraftTypeName() profilePluginsDirectoryPath = getPluginsDirectoryPath() return archive.getModuleWithDirectoryPath(profilePluginsDirectoryPath, craftTypeName)
def writeOutput(fileName, fileNamePenultimate, fileNameSuffix, filePenultimateWritten, gcodeText=''): "Analyze a gcode file." gcodeText = archive.getTextIfEmpty(fileName, gcodeText) pluginFileNames = getPluginFileNames() window = None for pluginFileName in pluginFileNames: analyzePluginsDirectoryPath = getPluginsDirectoryPath() pluginModule = archive.getModuleWithDirectoryPath( analyzePluginsDirectoryPath, pluginFileName) if pluginModule != None: try: newWindow = pluginModule.writeOutput(fileName, fileNamePenultimate, fileNameSuffix, filePenultimateWritten, gcodeText) if newWindow != None: window = newWindow except: print('Warning, the tool %s could not analyze the output.' % pluginFileName) print( 'Exception traceback in writeOutput in skeinforge_analyze:' ) traceback.print_exc(file=sys.stdout) return window
def getSelectedPluginModule(plugins): 'Get the selected plugin module.' for plugin in plugins: if plugin.value: return archive.getModuleWithDirectoryPath(plugin.directoryPath, plugin.name) return None
def getCarving(fileName=''): "Get the carving for the xml file." xmlText = archive.getFileText(fileName) if xmlText == '': return None xmlParser = DocumentNode(fileName, xmlText) lowerLocalName = xmlParser.getDocumentElement().getNodeName().lower() pluginModule = archive.getModuleWithDirectoryPath( getPluginsDirectoryPath(), lowerLocalName ) if pluginModule == None: return None return pluginModule.getCarvingFromParser( xmlParser )
def getCarving(fileName=''): "Get the carving for the xml file." xmlText = archive.getFileText(fileName) if xmlText == '': return None xmlParser = XMLSimpleReader( fileName, None, xmlText ) lowerClassName = xmlParser.getRoot().className.lower() pluginModule = archive.getModuleWithDirectoryPath( getPluginsDirectoryPath(), lowerClassName ) if pluginModule == None: return None return pluginModule.getCarvingFromParser( xmlParser )
def getCarving(fileName=""): "Get the carving for the csv file." csvText = archive.getFileText(fileName) if csvText == "": return None csvParser = CSVSimpleParser(fileName, None, csvText) lowerLocalName = csvParser.getDocumentElement().getNodeName().lower() pluginModule = archive.getModuleWithDirectoryPath(getPluginsDirectoryPath(), lowerLocalName) if pluginModule == None: return None return pluginModule.getCarvingFromParser(csvParser)
def getCarving(fileName=''): "Get the carving for the csv file." csvText = archive.getFileText(fileName) if csvText == '': return None csvParser = CSVSimpleParser( fileName, None, csvText ) lowerClassName = csvParser.getRoot().className.lower() pluginModule = archive.getModuleWithDirectoryPath( getPluginsDirectoryPath(), lowerClassName ) if pluginModule == None: return None return pluginModule.getCarvingFromParser( csvParser )
def getCarving(fileName=''): "Get the carving for the csv file." csvText = archive.getFileText(fileName) if csvText == '': return None csvParser = CSVSimpleParser(fileName, None, csvText) lowerLocalName = csvParser.getDocumentElement().getNodeName().lower() pluginModule = archive.getModuleWithDirectoryPath( getPluginsDirectoryPath(), lowerLocalName) if pluginModule is None: return None return pluginModule.getCarvingFromParser(csvParser)
def getInterpretPlugin(fileName): "Get the interpret plugin for the file." importPluginFileNames = getImportPluginFileNames() for importPluginFileName in importPluginFileNames: fileTypeDot = '.' + importPluginFileName if fileName[ - len(fileTypeDot) : ].lower() == fileTypeDot: importPluginsDirectoryPath = getPluginsDirectoryPath() pluginModule = archive.getModuleWithDirectoryPath( importPluginsDirectoryPath, importPluginFileName ) if pluginModule is not None: return pluginModule print('Could not find plugin to handle ' + fileName ) return None
def getInterpretPlugin(fileName): "Get the interpret plugin for the file." importPluginFileNames = getImportPluginFileNames() for importPluginFileName in importPluginFileNames: fileTypeDot = '.' + importPluginFileName if fileName[ - len(fileTypeDot) : ].lower() == fileTypeDot: importPluginsDirectoryPath = getPluginsDirectoryPath() pluginModule = archive.getModuleWithDirectoryPath( importPluginsDirectoryPath, importPluginFileName ) if pluginModule != None: return pluginModule print('Could not find plugin to handle ' + fileName ) return None
def writeOutput( fileName, fileNameSuffix, gcodeText = ''): "Analyze a gcode file." gcodeText = archive.getTextIfEmpty(fileName, gcodeText) pluginFileNames = getPluginFileNames() for pluginFileName in pluginFileNames: analyzePluginsDirectoryPath = getPluginsDirectoryPath() pluginModule = archive.getModuleWithDirectoryPath( analyzePluginsDirectoryPath, pluginFileName ) if pluginModule != None: try: pluginModule.writeOutput( fileName, fileNameSuffix, gcodeText ) except: print('Warning, the tool %s could not analyze the output.' % pluginFileName )
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 pluginModule = archive.getModuleWithDirectoryPath(getPluginsDirectoryPath(), self.name) if pluginModule is None: return None pluginRepository = pluginModule.getNewRepository() pluginRepository.setCanvasFileNameSuffix(self.canvas, self.fileName, self.suffix) settings.getDisplayedDialogFromConstructor(pluginRepository)
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 pluginModule = archive.getModuleWithDirectoryPath(getPluginsDirectoryPath(), self.name) if pluginModule == None: return None pluginRepository = pluginModule.getNewRepository() pluginRepository.setCanvasFileNameSuffix(self.canvas, self.fileName, self.suffix) settings.getDisplayedDialogFromConstructor(pluginRepository)
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 = archive.getAbsoluteFolderPath( os.path.dirname(__file__), 'export_canvas_plugins') pluginModule = archive.getModuleWithDirectoryPath( exportCanvasPluginsFolderPath, self.name ) if pluginModule == None: return None pluginRepository = pluginModule.getNewRepository() pluginRepository.setCanvasFileNameSuffix( self.canvas, self.fileName, self.suffix ) settings.getDisplayedDialogFromConstructor( pluginRepository )
def writeOutput(fileName, fileNameSuffix, gcodeText=''): "Analyze a gcode file." gcodeText = archive.getTextIfEmpty(fileName, gcodeText) pluginFileNames = getPluginFileNames() for pluginFileName in pluginFileNames: analyzePluginsDirectoryPath = getPluginsDirectoryPath() pluginModule = archive.getModuleWithDirectoryPath( analyzePluginsDirectoryPath, pluginFileName) if pluginModule != None: try: pluginModule.writeOutput(fileName, fileNameSuffix, gcodeText) except: print('Warning, the tool %s could not analyze the output.' % pluginFileName)
def writeOutput( fileName, fileNameSuffix, gcodeText = ''): "Analyze a gcode file." gcodeText = archive.getTextIfEmpty(fileName, gcodeText) pluginFileNames = getPluginFileNames() window = None for pluginFileName in pluginFileNames: analyzePluginsDirectoryPath = getPluginsDirectoryPath() pluginModule = archive.getModuleWithDirectoryPath( analyzePluginsDirectoryPath, pluginFileName ) if pluginModule != None: try: newWindow = pluginModule.writeOutput( fileName, fileNameSuffix, gcodeText ) if newWindow != None: window = newWindow except: print('Warning, the tool %s could not analyze the output.' % pluginFileName ) print('Exception traceback in writeOutput in skeinforge_analyze:') traceback.print_exc(file=sys.stdout) return window
def getCraftTypePluginModule( craftTypeName = ''): "Get the craft type plugin module" if craftTypeName == '': craftTypeName = getCraftTypeName() profilePluginsDirectoryPath = getPluginsDirectoryPath() return archive.getModuleWithDirectoryPath( profilePluginsDirectoryPath, craftTypeName )
def getSelectedPluginModule( plugins ): 'Get the selected plugin module.' for plugin in plugins: if plugin.value: return archive.getModuleWithDirectoryPath( plugin.directoryPath, plugin.name ) return None
def getCraftModule(fileName): "Get craft module." return archive.getModuleWithDirectoryPath( getPluginsDirectoryPath(), fileName )
def getCraftModule(pluginName): 'Get craft module.' return archive.getModuleWithDirectoryPath(getPluginsDirectoryPath(), pluginName)
def getCraftModule(fileName): "Get craft module." return archive.getModuleWithDirectoryPath(getPluginsDirectoryPath(), fileName)