An observer is subscribed to a specific event. When the event happens, the observer gets a notification.

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 contains the following keys:

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

acceptMenuEditCallbacks

Will be called by the glyph view when a menu item will be validated. Should return a bool.

Extra notification keys: item

anchorAdditionContextualMenuItems

Extra notification keys: additionContextualMenuItems

applicationDidBecomeActive

Called when RoboFont did become active event is posted.

applicationDidFinishLaunching

Called when RoboFont did finish launching event is posted.

applicationOpenFile

Extra notification keys: ext, fileHandler, path

applicationScreenChanged

applicationWillResignActive

Called when RoboFont will resign active event is posted.

applicationWillTerminate

binaryFontWillOpen

Called when new binary font will open.

Extra notification keys: font, format, source

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.

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.

didTestInstallFont

draw

Called when a draw event is posted.

Extra notification keys: scale

drawBackground

Called when a drawBackground event is posted.

Extra notification keys: scale

drawBackgroundInactive

Extra notification keys: scale

drawInactive

Called when a draw preview event is posted.

Extra notification keys: scale

drawPreview

Called when a draw preview event is posted.

Extra notification keys: scale

extensionDidGenerate

Extra notification keys: path

externalLaunchEvent

Extra notification keys: data

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.

Extra notification keys: font, format, layerName, path

fontDidOpen

Called when 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

fontOverViewRedo

fontOverViewUndo

fontOverviewAdditionContextualMenuItems

Extra notification keys: additionContextualMenuItems

fontOverviewCopy

Extra notification keys: glyphs

fontWillAutoSave

Called when a font will auto save event is posted.

Extra notification keys: font

fontWillClose

Called when font will close event is posted.

Extra notification keys: font

fontWillGenerate

Called when a font will generate a binary.

Extra notification keys: font, format, layerName, path

fontWillOpen

Called when 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

fontWindowWillShowToolbarItems

Extra notification keys: singleMode, toolbarItems

glyphAdditionContextualMenuItems

Extra notification keys: additionContextualMenuItems

glyphCellDraw

Extra notification keys: glyph, glyphCell, rect

glyphCellDrawBackground

Extra notification keys: cell, glyph, rect

glyphCollectionDraw

Extra notification keys: view

glyphWindowDidOpen

Called when a glyph window did open event is posted.

Extra notification keys: window

glyphWindowWillClose

Called when a glyph window will close event is posted.

Extra notification keys: window

glyphWindowWillOpen

Called when a glyph window will open event is posted.

Extra notification keys: window

glyphWindowWillShowToolbarItems

Extra notification keys: toolbarItems

guideAdditionContextualMenuItems

Extra notification keys: additionContextualMenuItems

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: point

mouseDragged

Called when a mouse dragged event is posted.

Extra notification keys: point

mouseMoved

Called when a mouse moved event is posted.

Extra notification keys: point

mouseUp

Called when a mouse up event is posted.

Extra notification keys: point

namespaceCallbacks

Extra notification keys: namespace

newFontDidOpen

Called when new font did open event is posted.

Extra notification keys: font

newFontWillOpen

Called when new font will open event is posted.

Extra notification keys: font

paste

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: point

rightMouseDragged

Called when a right mouse dragged event is posted.

Extra notification keys: point

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 window did open event is posted.

Extra notification keys: font, window

spaceCenterDraw

Called when a space center window draw event is posted.

Extra notification keys: glyph

spaceCenterInputChanged

Extra notification keys: spaceCenter

spaceCenterKeyUp

alled when a space center window key up event is posted.

Extra notification keys: glyph

spaceCenterSelectionChanged

Extra notification keys: spaceCenter

spaceCenterWillClose

Called when a space center window will close event is posted.

Extra notification keys: font, window

spaceCenterWillOpen

Called when a space center window will open event is posted.

Extra notification keys: font, window

toggleTransformMode

Toggle to transform mode. Overwrite if you want to change this the default behavior. Don’t call it externally.

transformChanged

Called when a transform matrix changed event is posted.

Extra notification keys: transformInfo

viewDidChangeGlyph

Called when a glyph view changed the glyph event is posted.

Extra notification keys: glyph, view

viewWillChangeGlyph

Called when a glyph view changed the glyph event is posted.

Extra notification keys: glyph, view

zoomInWithCommandSpace

Last edited on 17/10/2017