def __init__( self ): "Set the default settings, execute title & settings fileName." settings.addListsToRepository( 'skeinforge_tools.craft_plugins.export.html', '', self ) self.fileNameInput = settings.FileNameInput().getFromFileName( interpret.getGNUTranslatorGcodeFileTypeTuples(), 'Open File for Export', self, '' ) self.openWikiManualHelpPage = settings.HelpPage().getOpenFromAbsolute( 'http://www.bitsfrombytes.com/wiki/index.php?title=Skeinforge_Export' ) self.activateExport = settings.BooleanSetting().getFromValue( 'Activate Export', self, True ) self.alsoSendOutputTo = settings.StringSetting().getFromValue( 'Also Send Output To:', self, '' ) self.deleteComments = settings.BooleanSetting().getFromValue( 'Delete Comments', self, True ) exportPluginsFolderPath = gcodec.getAbsoluteFolderPath( __file__, 'export_plugins' ) exportStaticDirectoryPath = os.path.join( exportPluginsFolderPath, 'static_plugins' ) exportPluginFileNames = gcodec.getPluginFileNamesFromDirectoryPath( exportPluginsFolderPath ) exportStaticPluginFileNames = gcodec.getPluginFileNamesFromDirectoryPath( exportStaticDirectoryPath ) self.exportLabel = settings.LabelDisplay().getFromName( 'Export Operations: ', self ) self.exportPlugins = [] exportLatentStringVar = settings.LatentStringVar() self.doNotChangeOutput = settings.RadioCapitalized().getFromRadio( exportLatentStringVar, 'Do Not Change Output', self, True ) self.doNotChangeOutput.directoryPath = None allExportPluginFileNames = exportPluginFileNames + exportStaticPluginFileNames for exportPluginFileName in allExportPluginFileNames: exportPlugin = None if exportPluginFileName in exportPluginFileNames: path = os.path.join( exportPluginsFolderPath, exportPluginFileName ) exportPlugin = settings.RadioCapitalizedButton().getFromPath( exportLatentStringVar, exportPluginFileName, path, self, False ) exportPlugin.directoryPath = exportPluginsFolderPath else: exportPlugin = settings.RadioCapitalized().getFromRadio( exportLatentStringVar, exportPluginFileName, self, False ) exportPlugin.directoryPath = exportStaticDirectoryPath self.exportPlugins.append( exportPlugin ) self.fileExtension = settings.StringSetting().getFromValue( 'File Extension:', self, 'gcode' ) self.savePenultimateGcode = settings.BooleanSetting().getFromValue( 'Save Penultimate Gcode', self, False ) self.executeTitle = 'Export'
def __init__( self ): "Set the default preferences, execute title & preferences fileName." #Set the default preferences. preferences.addListsToRepository( self ) self.fileNameInput = preferences.Filename().getFromFilename( interpret.getGNUTranslatorGcodeFileTypeTuples(), 'Open File to be Exported', self, '' ) self.activateExport = preferences.BooleanPreference().getFromValue( 'Activate Export', self, True ) self.alsoSendOutputTo = preferences.StringPreference().getFromValue( 'Also Send Output To:', self, '' ) self.deleteComments = preferences.BooleanPreference().getFromValue( 'Delete Comments', self, True ) exportPluginsFolderPath = gcodec.getAbsoluteFolderPath( __file__, 'export_plugins' ) exportStaticDirectoryPath = os.path.join( exportPluginsFolderPath, 'static_plugins' ) exportPluginFilenames = gcodec.getPluginFilenamesFromDirectoryPath( exportPluginsFolderPath ) exportStaticPluginFilenames = gcodec.getPluginFilenamesFromDirectoryPath( exportStaticDirectoryPath ) self.exportLabel = preferences.LabelDisplay().getFromName( 'Export Operations: ', self ) self.exportPlugins = [] exportRadio = [] self.doNotChangeOutput = preferences.RadioCapitalized().getFromRadio( 'Do Not Change Output', exportRadio, self, True ) self.doNotChangeOutput.directoryPath = None allExportPluginFilenames = exportPluginFilenames + exportStaticPluginFilenames for exportPluginFilename in allExportPluginFilenames: exportPlugin = None if exportPluginFilename in exportPluginFilenames: path = os.path.join( exportPluginsFolderPath, exportPluginFilename ) exportPlugin = preferences.RadioCapitalizedButton().getFromPath( exportPluginFilename, path, exportRadio, self, False ) exportPlugin.directoryPath = exportPluginsFolderPath else: exportPlugin = preferences.RadioCapitalized().getFromRadio( exportPluginFilename, exportRadio, self, False ) exportPlugin.directoryPath = exportStaticDirectoryPath self.exportPlugins.append( exportPlugin ) self.fileExtension = preferences.StringPreference().getFromValue( 'File Extension:', self, 'gcode' ) #Create the archive, title of the execute button, title of the dialog & preferences fileName. self.executeTitle = 'Export' preferences.setHelpPreferencesFileNameTitleWindowPosition( self, 'skeinforge_tools.craft_plugins.export.html' )
def writeHypertext(): "Run pydoc, then read, write and delete each of the files." shellCommand = 'pydoc -w ./' commandResult = os.system( shellCommand ) if commandResult != 0: print( 'Failed to execute the following command in writeHypertext in docwrap.' ) print( shellCommand ) hypertextFiles = gcodec.getFilesWithFileTypeWithoutWords( 'html' ) if len( hypertextFiles ) <= 0: print( 'Failed to find any help files in writeHypertext in docwrap.' ) return documentDirectoryPath = gcodec.getAbsoluteFolderPath( hypertextFiles[ 0 ], 'documentation' ) removeFilesInDirectory( documentDirectoryPath ) sortedReplaceFiles = [] for hypertextFile in hypertextFiles: sortedReplaceFiles.append( hypertextFile.replace( '.html', '. html' ) ) sortedReplaceFiles.sort() hypertextFiles = [] for sortedReplaceFile in sortedReplaceFiles: hypertextFiles.append( sortedReplaceFile.replace( '. html', '.html' ) ) transferredFileNames = [] for hypertextFileIndex in xrange( len( hypertextFiles ) ): readWriteDeleteHypertextHelp( documentDirectoryPath, hypertextFileIndex, hypertextFiles, transferredFileNames ) for transferredFileNameIndex in xrange( len( transferredFileNames ) ): readWriteNavigationHelp( documentDirectoryPath, transferredFileNameIndex, transferredFileNames ) writeContentsFile( documentDirectoryPath, transferredFileNames ) print( '%s files were wrapped.' % len( transferredFileNames ) )
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 ) analyzePluginFilenames = getAnalyzePluginFilenames() for analyzePluginFilename in analyzePluginFilenames: analyzePluginsDirectoryPath = gcodec.getAbsoluteFolderPath( __file__, 'analyze_plugins' ) pluginModule = gcodec.getModuleWithDirectoryPath( analyzePluginsDirectoryPath, analyzePluginFilename ) if pluginModule != None: pluginModule.writeOutput( fileName, gcodeText )
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
def __init__(self): "Set the default preferences, execute title & preferences fileName." # Set the default preferences. self.archive = [] self.activateExport = preferences.BooleanPreference().getFromValue("Activate Export", True) self.archive.append(self.activateExport) self.alsoSendOutputTo = preferences.StringPreference().getFromValue("Also Send Output To:", "") self.archive.append(self.alsoSendOutputTo) self.deleteComments = preferences.BooleanPreference().getFromValue("Delete Comments", True) self.archive.append(self.deleteComments) exportPluginsFolderPath = gcodec.getAbsoluteFolderPath(__file__, "export_plugins") exportStaticDirectoryPath = os.path.join(exportPluginsFolderPath, "static_plugins") exportPluginFilenames = gcodec.getPluginFilenamesFromDirectoryPath(exportPluginsFolderPath) exportStaticPluginFilenames = gcodec.getPluginFilenamesFromDirectoryPath(exportStaticDirectoryPath) self.exportLabel = preferences.LabelDisplay().getFromName("Export Operations: ") self.archive.append(self.exportLabel) self.exportOperations = [] self.exportPlugins = [] exportRadio = [] self.doNotChangeOutput = preferences.RadioCapitalized().getFromRadio("Do Not Change Output", exportRadio, True) self.doNotChangeOutput.directoryPath = None allExportPluginFilenames = exportPluginFilenames + exportStaticPluginFilenames for exportPluginFilename in exportPluginFilenames: exportPlugin = preferences.RadioCapitalized().getFromRadio(exportPluginFilename, exportRadio, False) exportPlugin.directoryPath = exportPluginsFolderPath self.exportPlugins.append(exportPlugin) for exportStaticPluginFilename in exportStaticPluginFilenames: exportPlugin = preferences.RadioCapitalized().getFromRadio(exportStaticPluginFilename, exportRadio, False) exportPlugin.directoryPath = exportStaticDirectoryPath self.exportPlugins.append(exportPlugin) self.exportOperations = [self.doNotChangeOutput] self.exportOperations += self.exportPlugins self.exportOperations.sort(key=preferences.RadioCapitalized.getLowerName) self.exportOperationsButtons = [] for exportOperation in self.exportOperations: self.exportOperationsButtons.append(exportOperation) if exportOperation.directoryPath == exportPluginsFolderPath: displayToolButtonBesidePrevious = preferences.DisplayToolButtonBesidePrevious().getFromFolderPath( exportPluginsFolderPath, False, exportOperation.name, False ) self.exportOperationsButtons.append(displayToolButtonBesidePrevious) self.archive += self.exportOperationsButtons self.fileExtension = preferences.StringPreference().getFromValue("File Extension:", "gcode") self.archive.append(self.fileExtension) self.fileNameInput = preferences.Filename().getFromFilename( interpret.getGNUTranslatorGcodeFileTypeTuples(), "Open File to be Exported", "" ) self.archive.append(self.fileNameInput) # Create the archive, title of the execute button, title of the dialog & preferences fileName. self.executeTitle = "Export" self.saveCloseTitle = "Save and Close" preferences.setHelpPreferencesFileNameTitleWindowPosition(self, "skeinforge_tools.craft_plugins.export.html")
def __init__(self): "Set the default settings, execute title & settings fileName." settings.addListsToRepository( 'skeinforge_tools.craft_plugins.export.html', '', self) self.fileNameInput = settings.FileNameInput().getFromFileName( interpret.getGNUTranslatorGcodeFileTypeTuples(), 'Open File for Export', self, '') self.openWikiManualHelpPage = settings.HelpPage().getOpenFromAbsolute( 'http://www.bitsfrombytes.com/wiki/index.php?title=Skeinforge_Export' ) self.activateExport = settings.BooleanSetting().getFromValue( 'Activate Export', self, True) self.alsoSendOutputTo = settings.StringSetting().getFromValue( 'Also Send Output To:', self, '') self.deleteComments = settings.BooleanSetting().getFromValue( 'Delete Comments', self, True) exportPluginsFolderPath = gcodec.getAbsoluteFolderPath( __file__, 'export_plugins') exportStaticDirectoryPath = os.path.join(exportPluginsFolderPath, 'static_plugins') exportPluginFileNames = gcodec.getPluginFileNamesFromDirectoryPath( exportPluginsFolderPath) exportStaticPluginFileNames = gcodec.getPluginFileNamesFromDirectoryPath( exportStaticDirectoryPath) self.exportLabel = settings.LabelDisplay().getFromName( 'Export Operations: ', self) self.exportPlugins = [] exportLatentStringVar = settings.LatentStringVar() self.doNotChangeOutput = settings.RadioCapitalized().getFromRadio( exportLatentStringVar, 'Do Not Change Output', self, True) self.doNotChangeOutput.directoryPath = None allExportPluginFileNames = exportPluginFileNames + exportStaticPluginFileNames for exportPluginFileName in allExportPluginFileNames: exportPlugin = None if exportPluginFileName in exportPluginFileNames: path = os.path.join(exportPluginsFolderPath, exportPluginFileName) exportPlugin = settings.RadioCapitalizedButton().getFromPath( exportLatentStringVar, exportPluginFileName, path, self, False) exportPlugin.directoryPath = exportPluginsFolderPath else: exportPlugin = settings.RadioCapitalized().getFromRadio( exportLatentStringVar, exportPluginFileName, self, False) exportPlugin.directoryPath = exportStaticDirectoryPath self.exportPlugins.append(exportPlugin) self.fileExtension = settings.StringSetting().getFromValue( 'File Extension:', self, 'gcode') self.savePenultimateGcode = settings.BooleanSetting().getFromValue( 'Save Penultimate Gcode', self, False) self.executeTitle = 'Export'
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
def __init__( self ): "Set the default preferences, execute title & preferences fileName." #Set the default preferences. self.archive = [] self.craftLabel = preferences.LabelDisplay().getFromName( 'Open Preferences: ' ) self.archive.append( self.craftLabel ) importantFilenames = [ 'carve', 'chop', 'feed', 'flow', 'lift', 'raft', 'speed' ] self.archive += preferences.getDisplayToolButtons( gcodec.getAbsoluteFolderPath( __file__, 'craft_plugins' ), importantFilenames, getCraftPluginFilenames(), [] ) self.fileNameInput = preferences.Filename().getFromFilename( interpret.getGNUTranslatorGcodeFileTypeTuples(), 'Open File to be Crafted', '' ) self.archive.append( self.fileNameInput ) #Create the archive, title of the execute button, title of the dialog & preferences fileName. self.executeTitle = 'Craft' self.saveCloseTitle = 'Save and Close' preferences.setHelpPreferencesFileNameTitleWindowPosition( self, 'skeinforge_tools.craft.html' )
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 )
def __init__( self ): "Set the default settings, execute title & settings fileName." settings.addListsToRepository( 'skeinforge.html', '', self ) self.fileNameInput = settings.FileNameInput().getFromFileName( interpret.getGNUTranslatorGcodeFileTypeTuples(), 'Open File for Skeinforge', self, '' ) versionText = gcodec.getFileText( gcodec.getVersionFileName() ) self.createdOnLabel = settings.LabelDisplay().getFromName( 'Created On: ' + versionText, self ) self.profileType = settings.MenuButtonDisplay().getFromName( 'Profile Type: ', self ) self.profileSelection = settings.MenuButtonDisplay().getFromName( 'Profile Selection: ', self ) addToProfileMenu( self.profileSelection, self.profileType, self ) settings.LabelDisplay().getFromName( '', self ) self.skeinforgeLabel = settings.LabelDisplay().getFromName( 'Open Settings: ', self ) importantFileNames = [ 'craft', 'profile' ] settings.getDisplayToolButtonsRepository( gcodec.getAbsoluteFolderPath( __file__, 'skeinforge_tools' ), importantFileNames, getPluginFileNames(), self ) self.executeTitle = 'Skeinforge'
def addCanvasMenuRootScrollSkein( self, repository, skein, suffix, title ): "Add the canvas, menu bar, scroll bar, skein panes, tableau repository, root and skein." self.imagesDirectoryPath = os.path.join( settings.getSkeinforgeDirectoryPath(), 'images' ) self.movementTextID = None self.mouseInstantButtons = [] self.photoImages = {} self.repository = repository self.root = settings.Tkinter.Tk() self.gridPosition = settings.GridVertical( 0, 1 ) self.gridPosition.master = self.root self.root.title( os.path.basename( skein.fileName ) + ' - ' + title ) self.rulingExtent = 24 self.rulingTargetSeparation = 150.0 self.screenSize = skein.screenSize self.skein = skein self.skeinPanes = skein.skeinPanes self.suffix = suffix self.timerID = None repository.animationSlideShowRate.value = max( repository.animationSlideShowRate.value, 0.01 ) repository.animationSlideShowRate.value = min( repository.animationSlideShowRate.value, 85.0 ) repository.drawArrows.setUpdateFunction( self.setWindowToDisplaySaveUpdate ) repository.goAroundExtruderOffTravel.setUpdateFunction( self.setWindowToDisplaySavePhoenixUpdate ) repository.layerExtraSpan.setUpdateFunction( self.setWindowToDisplaySaveUpdate ) repository.widthOfSelectionThread.setUpdateFunction( self.setWindowToDisplaySaveUpdate ) repository.widthOfTravelThread.setUpdateFunction( self.setWindowToDisplaySaveUpdate ) repository.window = self for menuRadio in repository.mouseMode.menuRadios: fileName = menuRadio.name.lower() fileName = fileName.replace( ' ', '_' ) + '.ppm' menuRadio.mouseButton = self.getPhotoButtonGridIncrement( menuRadio.invoke, fileName, self.gridPosition ) self.gridPosition = settings.GridHorizontal( 1, 99 ) self.gridPosition.master = self.root self.xScrollbar = settings.HiddenScrollbar( self.root, orient = settings.Tkinter.HORIZONTAL ) self.xScrollbar.grid( row = 98, column = 2, columnspan = 96, sticky = settings.Tkinter.E + settings.Tkinter.W ) self.yScrollbar = settings.HiddenScrollbar( self.root ) self.yScrollbar.grid( row = 1, rowspan = 97, column = 99, sticky = settings.Tkinter.N + settings.Tkinter.S ) self.canvasHeight = min( int( skein.screenSize.imag ), self.root.winfo_screenheight() - repository.screenVerticalInset.value ) self.canvasWidth = min( int( skein.screenSize.real ), self.root.winfo_screenwidth() - repository.screenHorizontalInset.value ) scrollRegionBoundingBox = ( 0, 0, int( skein.screenSize.real ), int( skein.screenSize.imag ) ) self.canvas = settings.Tkinter.Canvas( self.root, highlightthickness = 3, width = self.canvasWidth, height = self.canvasHeight, scrollregion = scrollRegionBoundingBox ) self.canvas.grid( row = 1, rowspan = 97, column = 2, columnspan = 96, sticky = settings.Tkinter.E + settings.Tkinter.W + settings.Tkinter.N + settings.Tkinter.S ) self.fileHelpMenuBar = settings.FileHelpMenuBar( self.root ) self.exportMenu = settings.Tkinter.Menu( self.fileHelpMenuBar.fileMenu, tearoff = 0 ) self.fileHelpMenuBar.fileMenu.add_cascade( label = "Export", menu = self.exportMenu, underline = 0 ) exportCanvasPluginsFolderPath = gcodec.getAbsoluteFolderPath( os.path.dirname( __file__ ), 'export_canvas_plugins' ) exportCanvasPluginFileNames = gcodec.getPluginFileNamesFromDirectoryPath( exportCanvasPluginsFolderPath ) for exportCanvasPluginFileName in exportCanvasPluginFileNames: ExportCanvasDialog().addPluginToMenu( self.canvas, skein.fileName, self.exportMenu, exportCanvasPluginFileName, suffix ) self.fileHelpMenuBar.fileMenu.add_separator() self.fileHelpMenuBar.completeMenu( self.close, repository, self.save, self )
def __init__( self ): "Set the default preferences, execute title & preferences fileName." #Set the default preferences. self.archive = [] self.analyzeLabel = preferences.LabelDisplay().getFromName( 'Open Preferences: ' ) self.archive.append( self.analyzeLabel ) importantFilenames = [ 'behold', 'skeinview', 'statistic' ] self.archive += preferences.getDisplayToolButtons( gcodec.getAbsoluteFolderPath( __file__, 'analyze_plugins' ), importantFilenames, getAnalyzePluginFilenames(), [] ) self.fileNameInput = preferences.Filename().getFromFilename( [ ( 'Gcode text files', '*.gcode' ) ], 'Open File to be Analyzed', '' ) self.archive.append( self.fileNameInput ) #Create the archive, title of the execute button, title of the dialog & preferences fileName. self.executeTitle = 'Analyze' self.saveCloseTitle = 'Save and Close' preferences.setHelpPreferencesFileNameTitleWindowPosition( self, 'skeinforge_tools.analyze.html' )
def __init__( self ): "Set the default preferences, execute title & preferences fileName." #Set the default preferences. preferences.addListsToRepository( self ) self.fileNameInput = preferences.Filename().getFromFilename( interpret.getGNUTranslatorGcodeFileTypeTuples(), 'Open File for Skeinforge', self, '' ) versionText = gcodec.getFileText( gcodec.getVersionFileName() ) self.createdOnLabel = preferences.LabelDisplay().getFromName( 'Created On: ' + versionText, self ) self.profileSelection = preferences.MenuButtonDisplay().getFromName( 'Profile Selection: ', self ) self.profileType = preferences.MenuButtonDisplay().getFromName( 'Profile Type: ', self ) addToProfileMenu( self.profileSelection, self.profileType, self ) preferences.LabelDisplay().getFromName( '', self ) self.skeinforgeLabel = preferences.LabelDisplay().getFromName( 'Open Preferences: ', self ) importantFilenames = [ 'craft', 'profile' ] preferences.getDisplayToolButtonsRepository( gcodec.getAbsoluteFolderPath( __file__, 'skeinforge_tools' ), importantFilenames, getPluginFilenames(), self ) #Create the archive, title of the execute button, title of the dialog & preferences fileName. self.executeTitle = 'Skeinforge' preferences.setHelpPreferencesFileNameTitleWindowPosition( self, 'skeinforge.html' )
def writeHypertext(): "Run pydoc, then read, write and delete each of the files." shellCommand = 'pydoc -w ./' commandResult = os.system( shellCommand ) if commandResult != 0: print( 'Failed to execute the following command in writeHypertext in docwrap.' ) print( shellCommand ) hypertextFiles = gcodec.getFilesWithFileTypeWithoutWords( 'html' ) if len( hypertextFiles ) <= 0: print( 'Failed to find any help files in writeHypertext in docwrap.' ) return documentDirectoryPath = gcodec.getAbsoluteFolderPath( hypertextFiles[ 0 ], 'documentation' ) removeFilesInDirectory( documentDirectoryPath ) # for hypertextFile in hypertextFiles[ : 1 ]: for hypertextFile in hypertextFiles: readWriteDeleteHypertextHelp( documentDirectoryPath, hypertextFile ) print( '%s files were wrapped.' % len( hypertextFiles ) )
def __init__(self): "Set the default settings, execute title & settings fileName." settings.addListsToRepository("skeinforge.html", "", self) self.fileNameInput = settings.FileNameInput().getFromFileName( interpret.getGNUTranslatorGcodeFileTypeTuples(), "Open File for Skeinforge", self, "" ) versionText = gcodec.getFileText(gcodec.getVersionFileName()) self.createdOnLabel = settings.LabelDisplay().getFromName("Created On: " + versionText, self) self.profileType = settings.MenuButtonDisplay().getFromName("Profile Type: ", self) self.profileSelection = settings.MenuButtonDisplay().getFromName("Profile Selection: ", self) addToProfileMenu(self.profileSelection, self.profileType, self) settings.LabelDisplay().getFromName("", self) self.skeinforgeLabel = settings.LabelDisplay().getFromName("Open Settings: ", self) importantFileNames = ["craft", "profile"] settings.getDisplayToolButtonsRepository( gcodec.getAbsoluteFolderPath(__file__, "skeinforge_tools"), importantFileNames, getPluginFileNames(), self ) self.executeTitle = "Skeinforge"
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)
def __init__(self): "Set the default settings, execute title & settings fileName." settings.addListsToRepository('skeinforge.html', '', self) self.fileNameInput = settings.FileNameInput().getFromFileName( interpret.getGNUTranslatorGcodeFileTypeTuples(), 'Open File for Skeinforge', self, '') versionText = gcodec.getFileText(gcodec.getVersionFileName()) self.createdOnLabel = settings.LabelDisplay().getFromName( 'Created On: ' + versionText, self) self.profileType = settings.MenuButtonDisplay().getFromName( 'Profile Type: ', self) self.profileSelection = settings.MenuButtonDisplay().getFromName( 'Profile Selection: ', self) addToProfileMenu(self.profileSelection, self.profileType, self) settings.LabelDisplay().getFromName('', self) self.skeinforgeLabel = settings.LabelDisplay().getFromName( 'Open Settings: ', self) importantFileNames = ['craft', 'profile'] settings.getDisplayToolButtonsRepository( gcodec.getAbsoluteFolderPath(__file__, 'skeinforge_tools'), importantFileNames, getPluginFileNames(), self) self.executeTitle = 'Skeinforge'
def addCanvasMenuRootScrollSkein(self, repository, skein, suffix, title): "Add the canvas, menu bar, scroll bar, skein panes, tableau repository, root and skein." self.imagesDirectoryPath = os.path.join( settings.getSkeinforgeDirectoryPath(), 'images') self.movementTextID = None self.mouseInstantButtons = [] self.photoImages = {} self.repository = repository self.root = settings.Tkinter.Tk() self.gridPosition = settings.GridVertical(0, 1) self.gridPosition.master = self.root self.root.title(os.path.basename(skein.fileName) + ' - ' + title) self.rulingExtent = 24 self.rulingTargetSeparation = 150.0 self.screenSize = skein.screenSize self.skein = skein self.skeinPanes = skein.skeinPanes self.suffix = suffix self.timerID = None repository.animationSlideShowRate.value = max( repository.animationSlideShowRate.value, 0.01) repository.animationSlideShowRate.value = min( repository.animationSlideShowRate.value, 85.0) repository.drawArrows.setUpdateFunction( self.setWindowToDisplaySaveUpdate) repository.goAroundExtruderOffTravel.setUpdateFunction( self.setWindowToDisplaySavePhoenixUpdate) repository.layerExtraSpan.setUpdateFunction( self.setWindowToDisplaySaveUpdate) repository.widthOfSelectionThread.setUpdateFunction( self.setWindowToDisplaySaveUpdate) repository.widthOfTravelThread.setUpdateFunction( self.setWindowToDisplaySaveUpdate) repository.window = self for menuRadio in repository.mouseMode.menuRadios: fileName = menuRadio.name.lower() fileName = fileName.replace(' ', '_') + '.ppm' menuRadio.mouseButton = self.getPhotoButtonGridIncrement( menuRadio.invoke, fileName, self.gridPosition) self.gridPosition = settings.GridHorizontal(1, 99) self.gridPosition.master = self.root self.xScrollbar = settings.HiddenScrollbar( self.root, orient=settings.Tkinter.HORIZONTAL) self.xScrollbar.grid(row=98, column=2, columnspan=96, sticky=settings.Tkinter.E + settings.Tkinter.W) self.yScrollbar = settings.HiddenScrollbar(self.root) self.yScrollbar.grid(row=1, rowspan=97, column=99, sticky=settings.Tkinter.N + settings.Tkinter.S) self.canvasHeight = min( int(skein.screenSize.imag), self.root.winfo_screenheight() - repository.screenVerticalInset.value) self.canvasWidth = min( int(skein.screenSize.real), self.root.winfo_screenwidth() - repository.screenHorizontalInset.value) scrollRegionBoundingBox = (0, 0, int(skein.screenSize.real), int(skein.screenSize.imag)) self.canvas = settings.Tkinter.Canvas( self.root, highlightthickness=3, width=self.canvasWidth, height=self.canvasHeight, scrollregion=scrollRegionBoundingBox) self.canvas.grid(row=1, rowspan=97, column=2, columnspan=96, sticky=settings.Tkinter.E + settings.Tkinter.W + settings.Tkinter.N + settings.Tkinter.S) self.fileHelpMenuBar = settings.FileHelpMenuBar(self.root) self.exportMenu = settings.Tkinter.Menu(self.fileHelpMenuBar.fileMenu, tearoff=0) self.fileHelpMenuBar.fileMenu.add_cascade(label="Export", menu=self.exportMenu, underline=0) exportCanvasPluginsFolderPath = gcodec.getAbsoluteFolderPath( os.path.dirname(__file__), 'export_canvas_plugins') exportCanvasPluginFileNames = gcodec.getPluginFileNamesFromDirectoryPath( exportCanvasPluginsFolderPath) for exportCanvasPluginFileName in exportCanvasPluginFileNames: ExportCanvasDialog().addPluginToMenu(self.canvas, skein.fileName, self.exportMenu, exportCanvasPluginFileName, suffix) self.fileHelpMenuBar.fileMenu.add_separator() self.fileHelpMenuBar.completeMenu(self.close, repository, self.save, self)
def getPluginsDirectoryPath(): "Get the plugins directory path." return gcodec.getAbsoluteFolderPath( __file__, 'analyze_plugins' )
def getPluginsDirectoryPath(): "Get the plugins directory path." return gcodec.getAbsoluteFolderPath( __file__, 'profile_plugins' )
def getImportPluginFileNames(): "Get analyze plugin fileNames." return gcodec.getPluginFileNamesFromDirectoryPath( gcodec.getAbsoluteFolderPath(os.path.dirname(__file__), 'import_plugins'))
def getImportPluginFileNames(): "Get analyze plugin fileNames." return gcodec.getPluginFileNamesFromDirectoryPath( gcodec.getAbsoluteFolderPath( os.path.dirname( __file__ ), 'import_plugins' ) )
def getPluginsDirectoryPath(): "Get the plugins directory path." return gcodec.getAbsoluteFolderPath(__file__, 'skeinforge_tools')
def getPluginsDirectoryPath(): "Get the plugins directory path." return gcodec.getAbsoluteFolderPath( __file__, 'skeinforge_tools' )
def getAnalyzePluginFilenames(): "Get analyze plugin fileNames." return gcodec.getPluginFilenamesFromDirectoryPath( gcodec.getAbsoluteFolderPath( __file__, 'analyze_plugins' ) )
def getCraftModule( fileName ): "Get craft module." craftPluginsDirectoryPath = gcodec.getAbsoluteFolderPath( os.path.dirname( __file__ ), 'craft_plugins' ) return gcodec.getModuleWithDirectoryPath( craftPluginsDirectoryPath, fileName )
def getCraftModule(fileName): "Get craft module." craftPluginsDirectoryPath = gcodec.getAbsoluteFolderPath( os.path.dirname(__file__), 'craft_plugins') return gcodec.getModuleWithDirectoryPath(craftPluginsDirectoryPath, fileName)