mojo.extensions
getExtensionDefault(key, fallback=None)
Get a default value for a key, with a fallback value if the key is not present in the defaults.
setExtensionDefault(key, value, validate=False)
Set a default value for a key.
Optionally validate
the key and the value.
getExtensionDefaultColor(key, fallback=None)
Get a default color object for a key, with a fallback value if the key is not present in the defaults.
The fallback must be a NSColor
object.
setExtensionDefaultColor(key, value, validate=False)
Set a default color for a key.
Optionally validate
the key and the color.
registerExtensionDefaults(defaults, validate=False)
Register a default dictionary. This will not overwrite existing defaults.
class ExtensionBundle()
An object to read, write and install extensions.
Extension Bundle Specification, version 3
.roboFontExt
lib folder
lib.x.y folder (not required, optional folder supporting a specific python version, fe lib.3.7, v3)
html folder (not required, unless html is True in the info.plist, must contain index.html or index.md, optionally style.css)
resources folder (not required)
info.plist plist xml
{
name str
developer str
developerURL str
html bool (not required, if True html folder is required)
launchAtStartUp bool
mainScript str
uninstallScript str (not required, v2)
addToMenu list of dicts
[
* {
path str
preferredName str
shortKey str or tuple
nestInSubmenus bool (not required, v2)
}
]
timeStamp float
version str
requiresVersionMajor str (not required)
requiresVersionMinor str (not required)
expireDate str (not required, if set use the format YYYY-MM-DD)
}
license txt / html (not required)
requirements.txt txt (not required)
addScriptToMenu(path, preferredName, shortKey='')
Add a script to the extension menu.
path
: path to a Python filepreferredName
: name to be displayed in the menushortKey
: shortcut key to access the menu item (optional)
getResourceFilePath(name, ext='*')
Get the path to a resource file by name
.
Optionally an extension ext
can be provided.
getResourceImage(imageName, ext='*')
Get an image resource by imageName
.
Optionally an extension ext
can be provided.
validate()
Validate the extension according to the Extension File Specification.