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.

removeExtensionDefault(key)

Remove a key from the extension’s 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)

addToMenu

Get and set scripts to be added to the extension menu.

developer

Get and set the name of the extension developer.

developerURL

Get and set the developer URL.

expireDate

Get and set the extension expiration date.

expireDateFormat

fileExtension

html

Get and set a bool indicating if the extension has HTML help.

icon

Get and set the extension icon.

infoDictionary

Returns the info.plist as a dictionary.

launchAtStartUp

Get and set a script to be launched when RoboFont starts up.

license

Get and set the license for the extension.

mainScript

Get and set the main script.

name

Get and set the name of the extension.

requirements

Get and set the requirements (dependencies) for the bundle.

requiresVersionMajor

Get and set the minor required RoboFont version.

requiresVersionMinor

Get and set the major required RoboFont version.

resourcesNamesMap

Get a dictionary mapping resources file names to paths.

timeStamp

Get and set the extension time stamp.

uninstallScript

Get and set the uninstall script.

version

Get and set the extension version.

HTMLIndexPath()

Get the path to the index.html HTML help file.

HTMLPath()

Get the path to the HTML folder.

addScriptToMenu(path, preferredName, shortKey='')

Add a script to the extension menu.

  • path : path to a Python file
  • preferredName : name to be displayed in the menu
  • shortKey : shortcut key to access the menu item (optional)

bundleExists()

Returns a bool indicating if the extension bundle exists.

bundlePath()

Get the path of the extension bundle.

convertMarkdown()

Convert documentation sources from Markdown to HTML.

deinstall(update=True)

Uninstall the extension.

extensionHash(passphrase='')

fileName()

Get the file name of the extension bundle.

getDeveloperNSURL()

Get the developer URL as a NSURL object.

getInfo(key, fallback=None)

Get info with a key.

Optionally a fallback value can be provided.

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.

hasHTML()

Returns a bool indicating if the extension has HTML help.

infoDictionaryPath()

Get the path of the info.plist file.

install(showMessages=True)

Install the extension.

Optionally, use showMessages to disable messages.

iterParseRequirements(requirements)

libPath()

Get the path to the lib folder.

licensePath()

Get the path of license file.

loadRequirements(done)

Load the extension requirements (dependencies) from the requirements file.

mainScriptPath()

Get the path of the main script.

menuScriptPaths()

Returns the scripts which are set in the extension menu.

openHelp()

Open a help window for the extension.

requirementsPath()

Get the path of the requirements file.

resolveRequirements()

resourcesPath()

Get the path to the resources folder.

setInfo(key, value)

Set info with a key and value.

uninstallScriptPath()

Get the path to the script that uninstalls the extension.

validate()

Validate the extension according to the Extension File Specification.

validateHTML()

Validate the HTML files if present.

validateInfo()

Validate the info.plist file.

validateLib()

Validate the lib where all Python files are stored.

validateLicense()

Validate the license text or HTML.

validateRequirements()

Validate the requirements text.

validateResources()

Validate all resources.

validationErrors()

Returns the validation errors as a string.

allExtensions()

Get a list of all installed extensions.

buildExtensionMenu(menu)

Build the menu for the extension.

currentBundle(filePath=None)

Return the current bundle.

Optionally provide a filePath inside the host extension bundle.

loadAllExtensions()

Loads all installed extensions. This is used by RoboFont during startup.

setAllExtensions(value)

Set all extensions. This does nothing, use install instead.

updatePreferenceWindow()

Update the Preferences window.

updateScriptingMenu()

Update the scripting menu.

Last edited on 18/03/2024