from mojo.UI import *


  • AccordionView(posSize, descriptions, backgroundColor)
    A vanilla object hosting different kinds of other vanilla objects (like vanilla.List, vanilla.TextEditor, ....) in an accordion view.
    Initiate a AccordionView
    posSize: a tuple of four, setting the size
    descriptions: list of options for each item in the accordionView (see example) 
    backgroundColor: a NSColor object used as background color
    from mojo.UI import AccordionView
    from vanilla import *
    class MyInspector:
        def __init__(self):
            self.w = FloatingWindow((200, 600))
            self.firstItem = TextEditor((10, 10, -10, -10))
            self.secondItem = List((0, 0, -0, -0), ["a", "b", "c"])
            self.thirdItem = Tabs((10, 10, -10, -10), ["1", "2", "3"])
            self.fourthItem = Group((0, 0, -0, -0))
            self.fourthItem.checkBox = CheckBox((10, 10, 100, 22), "CheckBox")
            self.fourthItem.editText = EditText((10, 40, -10, 22))
            descriptions = [
                           dict(label="first item", view=self.firstItem, size=200, collapsed=False, canResize=False),
                           dict(label="second item", view=self.secondItem, minSize=100, size=140, collapsed=True, canResize=True),
                           dict(label="third item", view=self.thirdItem, minSize=100, size=140, collapsed=True, canResize=False),
                           dict(label="fourth item", view=self.fourthItem, size=140, collapsed=False, canResize=False)
            self.w.accordionView = AccordionView((0, 0, -0, -0), descriptions)
  • HTMLView(posSize)
    Initiate a HTMLView
    posSize: a tuple of four, setting the size
    Set the url in the HTMLView
    Go forward in the history of the HTMLView
    Go forward in the history of the HTMLView
    Clear the history of the HTMLView 
  • HelpWindow(htmlPath, title="help", developer=None, developerURL=None)
    Initiate a HelpWindow
    htmlPath: html help path
    title: title of the help window
    developer: a string with the name of the developer, optionally
    developerURL: a URL link to the developer, optionally
    set a html path in the HTMLView of the HelpWindow 
    from mojo.UI import HelpWindow
  • SmartSet(smartSet=dict())
    Initiate a smart set object
    smartSet: a dictionary containing smart set data
    Set or get the smart set name. 
    Set or get the a list of glyph names used by the smart set. 
    Set or get a search query.
  • MultiLineView(posSize, pointSize=150, lineHeight=50, doubleClickCallbak=None, applyKerning=None, bordered=False, hasHorizontalScroller=False, hasVerticalScroller=True, displayOptions=None, selectionCallback=None, menuForEventCallback=None)
    A multi glyph line view vanilla object, this is the same objects that is used to build a Space Center.
    Initiate a multi line view object:
    posSize: a tuple of four, setting the size
    pointSize: the initial point size, optionally
    lineHeight: the initial lineHeight, , optionally
    doubleClickCallback: callback for a double click event
    applyKerning: enable kerning the view, optionally
    bordered: set a border around the view
    hasHorizontalScroller: set the horizontal scroller
    hasVerticalScroller: set the vertical scroller
    displayOptions: a dict with multi line view display options
    selectionCallback: callback when a glyph get selected
    menuForEventCallback: callback when a contextual menu will we used, required to return a NSMenu object

    Returns all glyphs in the line view
    Sets a list of glyphs in the line view
    The glyph line view needs a font as fallback and for font metrics
    Returns a special glyph object that acts like a new line
    Returns a special glyph object that acts like an empty glyph (use this as fallback when a glyph is not in the font)
    Sets the point size
    Sets the line height
    Sets if kerning is applied in the line view
    Returns a dict with all display options
    Sets a dict of line view display options
    Sets the reading direction of the glyph line view

    from mojo.UI import MultiLineView
    from vanilla import *
    class MyOwnSpaceCenter:
        def __init__(self, font):
            self.w = Window((600, 400), minSize=(300, 300))
            self.w.lineView = MultiLineView((0, 0, -0, -0), 
            glyphs = []
            for glyphName in font.glyphOrder:
        def lineViewSelectionCallback(self, sender):
            print sender.getSelectedGlyph()


  • GlyphViewDisplaySettings(settings)
    Set display options for the current glyphview. Input as dict. These settings will be default for the glyphview. All options are: Fill, Stroke, Metrics, On Curve Points, Off Curve Points, Point Coordinates, Anchors, Curve Length, Blues, Family Blues, Rulers
  • AllSpaceCenters()
    Get all open space centers
  • CurrentSpaceCenter()
    returns a list of glyph names in the space center
    returns a string from the input of the space center
    sets the list of glyphNames in the space center
    set a string in to the main input of the space center
    returns the tracking used
    set a tracking value between the glyphs
    returns the reading direction
    sets the reading direction
    returns the point size
    sets the points size
  • SpaceCenterToPDF(path, spaceCenter=None)
    Saves the Space Center to a pdf with vector data, if a spaceCenter is not provided the CurrentSpaceCenter() will be used.
  • AllGlyphWindows()
    Returns all open glyph windows.
  • CurrentGlyphWindow()
    Returns the current glyph window.
  • GlyphWindowToPDF(path, glyphWindow=None)
    Saves the Glyph Window to a pdf with vector data, if a Glyph Window is not provided the CurrentGlyphWindow() will be used.
  • AllFontWindows()
    Returns all open font windows. 
  • CurrentFontWindow()
    Returns the current font window. 
  • OpenGlyphWindow(glyph=None, newWindow=False)
    Opens a new glyph window
    glyph: a given glyph object
    newWindow: open a new window, even if there is already a glyph window open
  • OpenSpaceCenter(font, newWindow=False)
    Opens a new Space Center
    font: a given font object
    newWindow: open a new window, even if there is already a Space Center winow open
  • OutputWindow()
    Returns the output window
    Write a string in the output window
    Clears the output window
  • SetCurrentGlyphByName(glyphName)
    Sets a glyph name in the current glyph editor
  • SetCurrentLayerByName(layerName)
    Sets the current layer by a layerName in the current glyph editor
  • UpdateCurrentGlyphView()
    Updates the current glyph editor
  • SetCurrentLayerByName(layerName)
    Sets the current layer by layer name 
  • addSmartSet(smartSet, index=-1)
    Add a smart set object. 
    Optionally set an index to insert the smart set object. 
  • removeSmartSet(smartSetName)
    Remove a smart set. 
  • getSmartSets()
    Get all current smart sets. 
  • setSmartSets(smartSets)
    Set a list of smart sets. 
  • setDefaultCharacterSet(characterSetName)
    Set the default character set by name as defined in the preferences. 
  • getDefaultCharacterSet()
    Get the current default character set name. 
  • addCharacterSet(characterSetName, glyphNames, useAsDefault=False)
    Add a character set with a name and a list of glyph names. 
  • removeCharacterSet(characterSetName)
    Remove a character set by name. 
  • getCharacterSets()
    Get all characeter sets as a dictionairy. 
  • setCharacterSets(characterSets)
    Set a dictionary of character sets. 
  • setMaxAmountOfVisibleTools(value)
    Set the maximum amount of visible tools in the toolbar.
    Must be in integer. 
  • getMaxAmountOfVisibleTools()
    Get the maximum amount of visible tools in the toolbar. 
  • setScriptingMenuNamingShortKey()
    Get the scripting menu names and shortkey dictionary. 
  • getScriptingMenuNamingShortKey(data)
    Set a scripting menu names and shortkey dictionary. 
  • setScriptingMenuNamingShortKeyForPath(path, preferredName, shortkey=None)
    Set the scripting menu names and shortkey dictionary. 
  • exportPreferences(path)
    Export all user preferences to a path. 
  • importPreferences(path)
    Import user preferences from a path.