def setName(self, name): """ Set the name of the library. :type name: str """ if self.name() == name: return studiolibrary.validateName(name) if self._name in self._instances: self._instances[name] = self._instances.pop(self.name()) oldLocalPath = self.localPath() self._name = name # Make sure that the local path is renamed to the new name. if os.path.exists(oldLocalPath): newLocalPath = self.localPath() os.rename(oldLocalPath, newLocalPath) if self.libraryWidget(): self.libraryWidget().updateWindowTitle()
def validator(): name = settingsDialog.name() path = settingsDialog.path() valid = [self.name()] studiolibrary.validateName(name, valid=valid) studiolibrary.validatePath(path)
def __init__(self, name): """Create a new library instance.""" super(Library, self).__init__() studiolibrary.validateName(name) self._name = name self._theme = None self._settings = {} self._isDefault = False self._libraryWidget = None self.loadSettings()
def validator(): name = settingsDialog.name() path = settingsDialog.path() studiolibrary.validateName(name, validNames) studiolibrary.validatePath(path)