Example #1
0
sourcePath = os.path.join(basePath, "source")
libPath = os.path.join(sourcePath, "code")
licensePath = os.path.join(basePath, "license.txt")
requirementsPath = os.path.join(basePath, "requirements.txt")
extensionFile = "%s.roboFontExt" % name
buildPath = os.path.join(basePath, "build")
extensionPath = os.path.join(buildPath, extensionFile)

B = ExtensionBundle()
B.name = name
B.developer = developer
B.developerURL = developerURL
B.version = version
B.launchAtStartUp = False
B.mainScript = "main.py"
B.html = os.path.exists(os.path.join(sourcePath, "documentation",
                                     "index.html"))
B.requiresVersionMajor = roboFontVersion.split(".")[0]
B.requiresVersionMinor = roboFontVersion.split(".")[1]
B.addToMenu = menuItems
if os.path.exists(licensePath):
    with open(licensePath) as license:
        B.license = license.read()
if os.path.exists(requirementsPath):
    with open(requirementsPath) as requirements:
        B.requirements = requirements.read()

print("building extension...", end=" ")
v = B.save(extensionPath, libPath=libPath, pycOnly=pycOnly)
print("done!")
print()
print(B.validationErrors())
# extension icon (file path or NSImage)
imagePath = os.path.join(resourcesPath, 'icon.png')
B.icon = imagePath

# version of the extension
B.version = '0.2.6'

# should the extension be launched at start-up?
B.launchAtStartUp = True

# script to be executed when RF starts
B.mainScript = 'hello.py'

# does the extension contain html help files?
B.html = True

# minimum RoboFont version required for this extension
B.requiresVersionMajor = '4'
B.requiresVersionMinor = '0'

# scripts which should appear in Extensions menu
B.addToMenu = [{
    'path': 'doSomething.py',
    'preferredName': 'do something',
    'shortKey': (NSCommandKeyMask | NSShiftKeyMask, 'b'),
}, {
    'path': 'doSomethingElse.py',
    'preferredName': 'do something else',
    'shortKey': (NSAlternateKeyMask, 'o'),
}]
Example #3
0
B = ExtensionBundle()
B.name = name
B.developer = developer
B.developerURL = developerURL
B.version = version
B.launchAtStartUp = launchAtStartUp
B.mainScript = mainScript
docPath = os.path.join(sourcePath, "documentation")
haveDocumentation = False
if os.path.exists(os.path.join(docPath, "index.html")):
    haveDocumentation = True
elif os.path.exists(os.path.join(docPath, "index.md")):
    haveDocumentation = True
if not haveDocumentation:
    docPath = None
B.html = haveDocumentation
B.requiresVersionMajor = roboFontVersion.split(".")[0]
B.requiresVersionMinor = roboFontVersion.split(".")[1]
B.addToMenu = menuItems
with open(licensePath) as license:
    B.license = license.read()
with open(requirementsPath) as requirements:
    B.requirements = requirements.read()
print("Building extension...", end=" ")
v = B.save(extensionPath,
           libPath=libPath,
           pycOnly=pycOnly,
           htmlPath=docPath,
           resourcesPath=resourcesPath)
print("done!")
errors = B.validationErrors()
if resourcesPath:
    # extension icon (file path or NSImage)
    imagePath = os.path.join(resourcesPath, 'icon.png')
    B.icon = imagePath

# version of the extension
B.version = '0.3'

# should the extension be launched at start-up?
B.launchAtStartUp = True

# script to be executed when RF starts
B.mainScript = 'angleRatioTool.py'

# does the extension contain html help files?
B.html = htmlPath is not None

# minimum RoboFont version required for this extension
B.requiresVersionMajor = '4'
B.requiresVersionMinor = '0'

# scripts which should appear in Extensions menu
B.addToMenu = [
    {
        'path': 'angleRatioTool.py',
        'preferredName': 'Angle Ratio Tool',
        'shortKey': '',
    },
]

if licensePath:
htmlFile = codecs.open(htmlIndexPath, mode="w", encoding="utf-8")
htmlFile.write(html)
htmlFile.close()

# ----------------
# create extension
# ----------------

B = ExtensionBundle()
B.name = "Glyph Construction"
B.developer = 'Frederk Berlaen'
B.developerURL = 'http://typemytype.com/'
B.version = '0.4'
B.launchAtStartUp = 0
B.mainScript = ''
B.html = True
B.requiresVersionMajor = '1'
B.requiresVersionMinor = '5'
B.addToMenu = [
    {
        'path'         : 'glyphConstructionUI.py',
        'preferredName': 'Glyph Builder',
        'shortKey'     : '',
    },
]

with codecs.open(licensePath, mode="r", encoding="utf-8") as f:
    B.license = f.read()
B.repositoryURL = 'http://github.com/typemytype/GlyphConstruction/'
B.summary = 'A simple, human-readable, powerful language for describing how shapes are constructed.'
Example #6
0
from mojo.extensions import ExtensionBundle

# data

extension_file = 'hTools2.roboFontExt'
lib_path = os.path.dirname(os.path.dirname(hTools2.__file__))
base_path = os.path.dirname(lib_path)
extension_path = os.path.join(base_path, extension_file)
html_path = os.path.join(base_path, "Documentation/build/html")

# create bundle

B = ExtensionBundle()
# meta
B.name = "hTools2"
B.developer = 'Gustavo Ferreira'
B.developerURL = 'http://hipertipo.com/'
B.version = "1.6"
B.mainScript = "add-RF-menu.py"
B.launchAtStartUp = True
B.addToMenu = []
# lib
B.requiresVersionMajor = '1'
B.requiresVersionMinor = '5'
B.infoDictionary["repository"] = 'gferreira/hTools2'
# html
B.html = 1
# save bundle
B.save(extension_path, libPath=lib_path, htmlPath=html_path, resourcesPath=None, pycOnly=False)
Example #7
0
licensePath = os.path.join(basePath, 'LICENSE')
pycOnly = False
extensionFile = 'tempEdit.roboFontExt'
extensionPath = os.path.join(basePath, extensionFile)

# extension settings

B = ExtensionBundle()
B.name = "tempEdit"
B.developer = 'Gustavo Ferreira'
B.developerURL = 'http://hipertipo.com'
B.icon = None  # os.path.join(basePath, 'tempEditMechanicIcon.png')
B.version = '0.3'
B.launchAtStartUp = False
B.mainScript = ''
B.html = False
B.requiresVersionMajor = '3'
B.requiresVersionMinor = '2'
B.addToMenu = [
    {
        'path': 'tempEdit.py',
        'preferredName': 'tempEdit',
        'shortKey': '',
    },
]

with open(licensePath) as license:
    B.license = license.read()

# copy README & imgs to extension docs