-
Notifications
You must be signed in to change notification settings - Fork 58
/
__init__.py
45 lines (41 loc) · 1.61 KB
/
__init__.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
from defcon import Component, Glyph, registerRepresentationFactory
from trufont.representationFactories.glyphCellFactory import TFGlyphCellFactory
from trufont.representationFactories.glyphViewFactory import (
ComponentQPainterPathFactory,
FilterSelectionFactory,
SelectedComponentsQPainterPathFactory,
SelectedContoursQPainterPathFactory,
SplitLinesQPainterPathFactory,
)
# TODO: fine-tune the destructive notifications
_glyphFactories = {
"TruFont.SelectedComponentsQPainterPath": (
SelectedComponentsQPainterPathFactory,
("Glyph.Changed", "Glyph.SelectionChanged"),
),
"TruFont.SplitLinesQPainterPath": (SplitLinesQPainterPathFactory, None),
"TruFont.FilterSelection": (
FilterSelectionFactory,
("Glyph.Changed", "Glyph.SelectionChanged"),
),
"TruFont.SelectedContoursQPainterPath": (
SelectedContoursQPainterPathFactory,
("Glyph.Changed", "Glyph.SelectionChanged"),
),
"TruFont.GlyphCell": (TFGlyphCellFactory, None),
}
_componentFactories = {
"TruFont.QPainterPath": (
ComponentQPainterPathFactory,
("Component.Changed", "Component.BaseGlyphDataChanged"),
)
}
def registerAllFactories():
for name, (factory, destructiveNotifications) in _glyphFactories.items():
registerRepresentationFactory(
Glyph, name, factory, destructiveNotifications=destructiveNotifications
)
for name, (factory, destructiveNotifications) in _componentFactories.items():
registerRepresentationFactory(
Component, name, factory, destructiveNotifications=destructiveNotifications
)