def getSelectedFolder( self ):
		"Get the selected folder."
		settingProfileSubfolder = settings.getSubfolderWithBasename( self.value, settings.getProfilesDirectoryPath( self.listSetting.craftTypeName ) )
		if settingProfileSubfolder != None:
			return settingProfileSubfolder
		toolProfileSubfolder = settings.getSubfolderWithBasename( self.value, settings.getProfilesDirectoryInAboveDirectory( self.listSetting.craftTypeName ) )
		return toolProfileSubfolder
Exemple #2
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
		craftTypeName = self.profileListboxSetting.listSetting.craftTypeName
		settings.deleteDirectory(archive.getProfilesPath(craftTypeName), self.profileListboxSetting.value)
		settings.deleteDirectory(settings.getProfilesDirectoryInAboveDirectory(craftTypeName), self.profileListboxSetting.value)
		self.profileListboxSetting.listSetting.setValueToFolders()
		if len(self.profileListboxSetting.listSetting.value) < 1:
			defaultSettingsDirectory = archive.getProfilesPath(os.path.join(craftTypeName, self.profileListboxSetting.defaultValue))
			archive.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()
 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
     craftTypeName = self.profileListboxSetting.listSetting.craftTypeName
     settings.deleteDirectory(archive.getProfilesPath(craftTypeName),
                              self.profileListboxSetting.value)
     settings.deleteDirectory(
         settings.getProfilesDirectoryInAboveDirectory(craftTypeName),
         self.profileListboxSetting.value)
     self.profileListboxSetting.listSetting.setValueToFolders()
     if len(self.profileListboxSetting.listSetting.value) < 1:
         defaultSettingsDirectory = archive.getProfilesPath(
             os.path.join(craftTypeName,
                          self.profileListboxSetting.defaultValue))
         archive.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()
	def getSelectedFolder(self):
		"Get the selected folder."
		settingProfileSubfolder = settings.getSubfolderWithBasename( self.value, archive.getProfilesPath( self.listSetting.craftTypeName ) )
		if settingProfileSubfolder is not None:
			return settingProfileSubfolder
		toolProfileSubfolder = settings.getSubfolderWithBasename( self.value, settings.getProfilesDirectoryInAboveDirectory( self.listSetting.craftTypeName ) )
		return toolProfileSubfolder
	def setValueToFolders( self ):
		"Set the value to the folders in the profiles directories."
		self.value = settings.getFolders( settings.getProfilesDirectoryPath( self.craftTypeName ) )
		defaultFolders = settings.getFolders( settings.getProfilesDirectoryInAboveDirectory( self.craftTypeName ) )
		for defaultFolder in defaultFolders:
			if defaultFolder not in self.value:
				self.value.append( defaultFolder )
		self.value.sort()
	def setValueToFolders(self):
		"Set the value to the folders in the profiles directories."
		self.value = settings.getFolders( archive.getProfilesPath( self.craftTypeName ) )
		defaultFolders = settings.getFolders( settings.getProfilesDirectoryInAboveDirectory( self.craftTypeName ) )
		for defaultFolder in defaultFolders:
			if defaultFolder not in self.value:
				self.value.append( defaultFolder )
		self.value.sort()