Tooldata
Folder Hierarchy:
root
|-hotkeys
|-tools
|- toolName
|-settingOne.json
|SettingTwoFolder
|-setting.json
- exception RootAlreadyExistsError
Bases:
Exception
- exception RootDoesntExistError
Bases:
Exception
- exception InvalidSettingsPath
Bases:
Exception
- exception InvalidRootError
Bases:
Exception
- class ToolSet
Bases:
object# Create some roots tset = ToolSet() # the order you add roots is important tset.addRoot(os.path.expanduser("~/Documents/maya/2018/scripts/zootools_preferences"), "userPreferences") # create a settings instance, if one exists already within one of the roots that setting will be used unless you # specify the root to use, in which the associated settingsObject for the root will be returned newSetting = tset.createSetting(relative="tools/tests/helloworld", root="userPreferences", data={"someData": "hello"}) print os.path.exists(newSetting.path()) print newSetting.path() # lets open a setting foundSetting = tset.findSetting(relative="tools/tests/helloworld", root="userPreferences")
- rootNameForPath(path)
- root(name)
- addRoot(fullPath, name)
Add root
- Parameters:
fullPath
name
- Returns:
- deleteRoot(root)
Deletes the root folder location and all files.
- findSetting(relativePath, root=None, extension=None)
Finds a settings object by searching the roots in reverse order.
The first path to exist will be the one to be resolved. If a root is specified and the root+relativePath exists then that will be returned instead
- Parameters:
- Returns:
- Return type:
- settingFromRootPath(relativePath, rootPath, extension=None)
- createSetting(relative, root, data)
- open(root, relativePath, extension=None)
- class SettingObject(root, relativePath=None, **kwargs)
Bases:
dictSettings class to encapsulate the json data for a given setting
- rootPath()
- path()
- isValid()
- class DirectoryPath(path=None, id_=None, alias=None, pref=None)
Bases:
ObjectDict- Parameters:
pref
id
alias
path
- serialize()
Get the dict
- Returns: