Observers

from mojo.events import addObserver, removeObserver
addObserver(observer, method, event)
Adds an observer for an event to the observer method.
removeObserver(observer, event)
Removes the observer for an event.

Events

Any observer can subscribe to these events. The callback receives a dictionary with additional objects related to the sent event.

All notification dictionaries contain the following keys:

glyph
the current/edited/active glyph
tool
the current tool
view
the current glyph view

acceptMenuEditCallbacks

Called by the glyph view when a menu item is validated. Should return a bool.

Extra notification keys: item

applicationDidBecomeActive

Called when a RoboFont became active event is posted.

applicationDidFinishLaunching

Called when a RoboFont finished launching event is posted.

applicationOpenFile

Extra notification keys: ext, fileHandler, path

applicationScreenChanged

Called when a RoboFont detects a change in screens event is posted.

applicationWillResignActive

Called when a RoboFont will resign active event is posted.

applicationWillTerminate

binaryFontWillOpen

Called when a new binary font will open event is posted.

Extra notification keys: font, format, source

com.robofont.demo.mojoEvent

Extra notification keys: 1, information, number

copy

Called when a copy event is posted.

copyAsComponent

Called when a copy as component event is posted.

currentGlyphChanged

Called when the current glyph changed event is posted.

Extra notification keys: sender

cut

Called when a cut event is posted.

delete

Called when a delete event is posted.

deselectAll

Called when a deselect all event is posted.

extensionDidGenerate

Extra notification keys: path

externalLaunchEvent

Extra notification keys: data

fontBecameCurrent

Called when a font became current event is posted.

Extra notification keys: font

fontDidAutoSave

Called when a font did auto save event is posted.

Extra notification keys: font

fontDidChangeExternally

Extra notification keys: font

fontDidClose

fontDidGenerate

Called when a font did generate a binary event is posted.

Extra notification keys: font, format, layerName, path

fontDidOpen

Called when a font did open event is posted.

Extra notification keys: font

fontDidSave

Called when a font did save event is posted.

Extra notification keys: font, path

fontDidTestDeinstall

Extra notification keys: font

fontDidTestInstall

Extra notification keys: font, format, report, succes

fontOverviewDidOpen

Extra notification keys: font, fontOverview

fontOverviewWillClose

Extra notification keys: font, fontOverview

fontOverviewWillOpen

Extra notification keys: font, fontOverview

fontResignCurrent

Called when a font resign current event is posted.

Extra notification keys: font

fontWillAutoSave

Called when a font will auto save event is posted.

Extra notification keys: font

fontWillClose

Called when a font will close event is posted.

Extra notification keys: font

fontWillGenerate

Called when a font will generate a binary event is posted.

Extra notification keys: font, format, layerName, path, testInstall

fontWillOpen

Called when a font will open event is posted.

Extra notification keys: font

fontWillSave

Called when a font will save event is posted.

Extra notification keys: font, path

fontWillTestDeinstall

Extra notification keys: font

fontWillTestInstall

Extra notification keys: font, format

fontWindowDidOpen

Extra notification keys: window

fontWindowWillOpen

Extra notification keys: window

fontWindowWillShowToolbarItems

Extra notification keys: singleMode, toolbarItems

glyphAdditionContextualMenuItems

Extra notification keys: additionContextualMenuItems

glyphCollectionDraw

Extra notification keys: view

glyphViewShowItemsDidChange

Extra notification keys: displaySettings, view

glyphWindowDidOpen

Called when a Glyph Window did open event is posted.

Extra notification keys: view, window

glyphWindowWillClose

Called when a Glyph Window will close event is posted.

Extra notification keys: view, window

glyphWindowWillOpen

Called when a Glyph Window will open event is posted.

Extra notification keys: view, window

glyphWindowWillShowToolbarItems

Extra notification keys: toolbarItems

imageAdditionContextualMenuItems

Extra notification keys: additionContextualMenuItems

inspectorWindowWillShowDescriptions

Extra notification keys: descriptions

keyDown

Called when a key down event is posted.

Extra notification keys: event

keyUp

Called when a key up event is posted.

Extra notification keys: event

modifiersChanged

Called when a modifier changed event is posted.

Extra notification keys: event

mouseDown

Called when a mouse down event is posted.

Extra notification keys: clickCount, point

mouseDragged

Called when a mouse dragged event is posted.

Extra notification keys: delta, event, offset, point

mouseMoved

Called when a mouse moved event is posted.

Extra notification keys: offset, point

mouseUp

Called when a mouse up event is posted.

Extra notification keys: offset, point

namespaceCallbacks

Extra notification keys: namespace

newFontDidOpen

Called when a new font did open event is posted.

Extra notification keys: font

newFontWillOpen

Called when a new font will open event is posted.

Extra notification keys: font

paste

Called when a paste event is posted.

pasteSpecial

Called when a paste event is posted.

pointAdditionContextualMenuItems

Extra notification keys: additionContextualMenuItems

rightMouseDown

Called when a right mouse down event is posted.

Extra notification keys: event, point

rightMouseDragged

Called when a right mouse dragged event is posted.

Extra notification keys: delta, event, offset, point

rightMouseUp

Called when a right mouse up event is posted.

Extra notification keys: offset, point

scriptingWindowDidOpen

Extra notification keys: window

scriptingWindowWillClose

Extra notification keys: window

scriptingWindowWillOpen

Extra notification keys: window

scriptsMenuChanged

selectAll

Called when a select all event is posted.

selectAllAlternate

Called when a select all alternate event is posted.

selectAllControl

Called when a select control event is posted.

spaceCenterAdditionContextualMenuItems

Extra notification keys: additionContextualMenuItems

spaceCenterDidOpen

Called when a Space Center did open event is posted.

Extra notification keys: font, window

spaceCenterInputChanged

Extra notification keys: spaceCenter

spaceCenterSelectionChanged

Extra notification keys: spaceCenter

spaceCenterWillClose

Called when a Space Center will close event is posted.

Extra notification keys: font, window

spaceCenterWillOpen

Called when a Space Center will open event is posted.

Extra notification keys: font, window

toggleTransformMode

Toggle the transform mode.

transformChanged

Called when a transform matrix changed event is posted.

Extra notification keys: transformInfo

viewDidChangeGlyph

Called when a glyph view did change event is posted.

Extra notification keys: glyph, view

viewDidChangeScale

Extra notification keys: scale, view

viewWillChangeGlyph

Called when a glyph view will change event is posted.

Extra notification keys: glyph, view

viewWillChangeScale

Extra notification keys: scale, view

viewWillHidePreview

Extra notification keys: view

viewWillShowPreview

Extra notification keys: view

Last edited on 01/09/2021