def addListsSetCraftProfile(craftSequence, defaultProfile, repository,
                            fileNameHelp):
    "Set the craft profile repository."
    settings.addListsToRepository(fileNameHelp, '', repository)
    repository.craftSequenceLabel = settings.LabelDisplay().getFromName(
        'Craft Sequence: ', repository)
    craftToolStrings = []
    for craftTool in craftSequence[:-1]:
        craftToolStrings.append(
            settings.getEachWordCapitalized(craftTool) + '->')
    craftToolStrings.append(settings.getEachWordCapitalized(craftSequence[-1]))
    for craftToolStringIndex in xrange(0, len(craftToolStrings), 5):
        craftLine = ' '.join(
            craftToolStrings[craftToolStringIndex:craftToolStringIndex + 5])
        settings.LabelDisplay().getFromName(craftLine, repository)
    settings.LabelDisplay().getFromName('', repository)
    repository.profileList = ProfileList().getFromName('Profile List:',
                                                       repository)
    repository.profileListbox = ProfileListboxSetting().getFromListSetting(
        repository.profileList, 'Profile Selection:', repository,
        defaultProfile)
    repository.addListboxSelection = AddProfile(
    ).getFromProfileListboxSettingRepository(repository.profileListbox,
                                             repository)
    repository.deleteListboxSelection = DeleteProfile(
    ).getFromProfileListboxSettingRepository(repository.profileListbox,
                                             repository)
    directoryName = archive.getProfilesPath()
    gcodec.makeDirectory(directoryName)
    repository.windowPosition.value = '0+400'
Ejemplo n.º 2
0
def writeXMLElement(fileNames, target, xmlElement):
    "Write target."
    object = target.object
    if object == None:
        print('Warning, writeTarget in write could not get object for:')
        print(xmlElement)
        return
    fileNameRoot = evaluate.getEvaluatedStringDefault('', 'name', target)
    fileNameRoot = evaluate.getEvaluatedStringDefault(fileNameRoot, 'id',
                                                      target)
    fileNameRoot = evaluate.getEvaluatedStringDefault(fileNameRoot, 'file',
                                                      xmlElement)
    fileNameRoot += evaluate.getEvaluatedStringDefault('', 'suffix',
                                                       xmlElement)
    extension = evaluate.getEvaluatedStringDefault(
        object.getFabricationExtension(), 'extension', xmlElement)
    fileName = '%s.%s' % (fileNameRoot, extension)
    suffixIndex = 1
    while fileName in fileNames:
        fileName = '%s_%s.%s' % (fileNameRoot, suffixIndex, extension)
        suffixIndex += 1
    fileNames.append(fileName)
    folderName = evaluate.getEvaluatedStringDefault('', 'folder', xmlElement)
    absoluteFolderDirectory = os.path.join(
        os.path.dirname(xmlElement.getRoot().parser.fileName), folderName)
    gcodec.makeDirectory(absoluteFolderDirectory)
    gcodec.writeFileText(os.path.join(absoluteFolderDirectory, fileName),
                         object.getFabricationText())
Ejemplo n.º 3
0
	def __init__(self):
		"Set the default entities, execute title & repository fileName."
		settings.addListsToRepository('skeinforge_application.skeinforge_utilities.skeinforge_profile.html', '', self )
		importantFileNames = ['extrusion']
		self.craftRadios = settings.getRadioPluginsAddPluginFrame( getPluginsDirectoryPath(), importantFileNames, getPluginFileNames(), self )
		ProfilePluginRadioButtonsSaveListener().getFromRadioPlugins( self.craftRadios, self )
		for craftRadio in self.craftRadios:
			craftRadio.updateFunction = self.updateRelay
		directoryName = archive.getProfilesPath()
		gcodec.makeDirectory(directoryName)
		self.windowPosition.value = '0+200'
 def __init__(self):
     "Set the default entities, execute title & repository fileName."
     settings.addListsToRepository(
         'skeinforge_application.skeinforge_utilities.skeinforge_profile.html',
         '', self)
     importantFileNames = ['extrusion']
     self.craftRadios = settings.getRadioPluginsAddPluginFrame(
         getPluginsDirectoryPath(), importantFileNames,
         getPluginFileNames(), self)
     ProfilePluginRadioButtonsSaveListener().getFromRadioPlugins(
         self.craftRadios, self)
     for craftRadio in self.craftRadios:
         craftRadio.updateFunction = self.updateRelay
     directoryName = archive.getProfilesPath()
     gcodec.makeDirectory(directoryName)
     self.windowPosition.value = '0+200'
Ejemplo n.º 5
0
def addListsSetCraftProfile( craftSequence, defaultProfile, repository, fileNameHelp ):
	"Set the craft profile repository."
	settings.addListsToRepository( fileNameHelp, '', repository )
	repository.craftSequenceLabel = settings.LabelDisplay().getFromName('Craft Sequence: ', repository )
	craftToolStrings = []
	for craftTool in craftSequence[ : - 1 ]:
		craftToolStrings.append( settings.getEachWordCapitalized( craftTool ) + '->')
	craftToolStrings.append( settings.getEachWordCapitalized( craftSequence[-1] ) )
	for craftToolStringIndex in xrange( 0, len( craftToolStrings ), 5 ):
		craftLine = ' '.join( craftToolStrings[ craftToolStringIndex : craftToolStringIndex + 5 ] )
		settings.LabelDisplay().getFromName( craftLine, repository )
	settings.LabelDisplay().getFromName('', repository )
	repository.profileList = ProfileList().getFromName('Profile List:', repository )
	repository.profileListbox = ProfileListboxSetting().getFromListSetting( repository.profileList, 'Profile Selection:', repository, defaultProfile )
	repository.addListboxSelection = AddProfile().getFromProfileListboxSettingRepository( repository.profileListbox, repository )
	repository.deleteListboxSelection = DeleteProfile().getFromProfileListboxSettingRepository( repository.profileListbox, repository )
	directoryName = archive.getProfilesPath()
	gcodec.makeDirectory(directoryName)
	repository.windowPosition.value = '0+400'
Ejemplo n.º 6
0
def writeXMLElement(fileNames, target, xmlElement):
	"Write target."
	object = target.object
	if object == None:
		print('Warning, writeTarget in write could not get object for:')
		print(xmlElement)
		return
	fileNameRoot = evaluate.getEvaluatedStringDefault('', 'name', target)
	fileNameRoot = evaluate.getEvaluatedStringDefault(fileNameRoot, 'id', target)
	fileNameRoot = evaluate.getEvaluatedStringDefault(fileNameRoot, 'file', xmlElement)
	fileNameRoot += evaluate.getEvaluatedStringDefault('', 'suffix', xmlElement)
	extension = evaluate.getEvaluatedStringDefault(object.getFabricationExtension(), 'extension', xmlElement)
	fileName = '%s.%s' % (fileNameRoot, extension)
	suffixIndex = 1
	while fileName in fileNames:
		fileName = '%s_%s.%s' % (fileNameRoot, suffixIndex, extension)
		suffixIndex += 1
	fileNames.append(fileName)
	folderName = evaluate.getEvaluatedStringDefault('', 'folder', xmlElement)
	absoluteFolderDirectory = os.path.join(os.path.dirname(xmlElement.getRoot().parser.fileName), folderName)
	gcodec.makeDirectory(absoluteFolderDirectory)
	gcodec.writeFileText(os.path.join(absoluteFolderDirectory, fileName), object.getFabricationText())
 def delete(self):
     "Delete the selection of a listbox setting."
     self.profileListboxSetting.setToDisplay()
     self.profileListboxSetting.listSetting.setValueToFolders()
     if self.profileListboxSetting.value not in self.profileListboxSetting.listSetting.value:
         return
     lastSelectionIndex = 0
     currentSelectionTuple = self.profileListboxSetting.listbox.curselection(
     )
     if len(currentSelectionTuple) > 0:
         lastSelectionIndex = int(currentSelectionTuple[0])
     else:
         print('No profile is selected, so no profile will be deleted.')
         return
     settings.deleteDirectory(
         archive.getProfilesPath(
             self.profileListboxSetting.listSetting.craftTypeName),
         self.profileListboxSetting.value)
     settings.deleteDirectory(
         getProfilesDirectoryInAboveDirectory(
             self.profileListboxSetting.listSetting.craftTypeName),
         self.profileListboxSetting.value)
     self.profileListboxSetting.listSetting.setValueToFolders()
     if len(self.profileListboxSetting.listSetting.value) < 1:
         defaultSettingsDirectory = archive.getProfilesPath(
             os.path.join(
                 self.profileListboxSetting.listSetting.craftTypeName,
                 self.profileListboxSetting.defaultValue))
         gcodec.makeDirectory(defaultSettingsDirectory)
         self.profileListboxSetting.listSetting.setValueToFolders()
     lastSelectionIndex = min(
         lastSelectionIndex,
         len(self.profileListboxSetting.listSetting.value) - 1)
     self.profileListboxSetting.value = self.profileListboxSetting.listSetting.value[
         lastSelectionIndex]
     self.profileListboxSetting.setStateToValue()
     self.no()
Ejemplo n.º 8
0
	def delete(self):
		"Delete the selection of a listbox setting."
		self.profileListboxSetting.setToDisplay()
		self.profileListboxSetting.listSetting.setValueToFolders()
		if self.profileListboxSetting.value not in self.profileListboxSetting.listSetting.value:
			return
		lastSelectionIndex = 0
		currentSelectionTuple = self.profileListboxSetting.listbox.curselection()
		if len( currentSelectionTuple ) > 0:
			lastSelectionIndex = int( currentSelectionTuple[0] )
		else:
			print('No profile is selected, so no profile will be deleted.')
			return
		settings.deleteDirectory( archive.getProfilesPath( self.profileListboxSetting.listSetting.craftTypeName ), self.profileListboxSetting.value )
		settings.deleteDirectory( getProfilesDirectoryInAboveDirectory( self.profileListboxSetting.listSetting.craftTypeName ), self.profileListboxSetting.value )
		self.profileListboxSetting.listSetting.setValueToFolders()
		if len( self.profileListboxSetting.listSetting.value ) < 1:
			defaultSettingsDirectory = archive.getProfilesPath( os.path.join( self.profileListboxSetting.listSetting.craftTypeName, self.profileListboxSetting.defaultValue ) )
			gcodec.makeDirectory( defaultSettingsDirectory )
			self.profileListboxSetting.listSetting.setValueToFolders()
		lastSelectionIndex = min( lastSelectionIndex, len( self.profileListboxSetting.listSetting.value ) - 1 )
		self.profileListboxSetting.value = self.profileListboxSetting.listSetting.value[ lastSelectionIndex ]
		self.profileListboxSetting.setStateToValue()
		self.no()