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 __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 addSubmenus( menu, pluginFilename, pluginFolderPath, pluginPath ): "Add a tool plugin menu." submenu = preferences.Tkinter.Menu( menu, tearoff = 0 ) menu.add_cascade( label = pluginFilename.capitalize(), menu = submenu ) preferences.ToolDialog().addPluginToMenu( submenu, pluginPath ) submenu.add_separator() submenuFilenames = gcodec.getPluginFilenamesFromDirectoryPath( pluginFolderPath ) for submenuFilename in submenuFilenames: preferences.ToolDialog().addPluginToMenu( submenu, os.path.join( pluginFolderPath, submenuFilename ) )
def getPluginFilenames(): "Get analyze plugin fileNames." return gcodec.getPluginFilenamesFromDirectoryPath( getPluginsDirectoryPath() )
def getAnalyzePluginFilenames(): "Get analyze plugin fileNames." return gcodec.getPluginFilenamesFromDirectoryPath( gcodec.getAbsoluteFolderPath( __file__, 'analyze_plugins' ) )
def getImportPluginFilenames(): "Get analyze plugin fileNames." return gcodec.getPluginFilenamesFromDirectoryPath( gcodec.getAbsoluteFolderPath( os.path.dirname( __file__ ), 'import_plugins' ) )