diff options
| author | Adrien Tétar | 2015-10-30 13:33:41 +0100 | 
|---|---|---|
| committer | Adrien Tétar | 2015-10-30 13:49:48 +0100 | 
| commit | ef9a3e050e0565021c7449cc19cccdf26f52cced (patch) | |
| tree | 7b7a86142ffc21d625d5d41eacb70a32b7727aa4 /Lib/defconQt | |
| parent | 0786b86dff97981fdff4dd094185b0adb200181f (diff) | |
| download | trufont-ef9a3e050e0565021c7449cc19cccdf26f52cced.tar.bz2 | |
representationFactories: use the new register mechanism
Diffstat (limited to 'Lib/defconQt')
| -rw-r--r-- | Lib/defconQt/representationFactories/__init__.py | 24 | 
1 files changed, 16 insertions, 8 deletions
diff --git a/Lib/defconQt/representationFactories/__init__.py b/Lib/defconQt/representationFactories/__init__.py index 86b8b06..507102f 100644 --- a/Lib/defconQt/representationFactories/__init__.py +++ b/Lib/defconQt/representationFactories/__init__.py @@ -1,19 +1,27 @@ -from defcon.objects.glyph import addRepresentationFactory
 +from defcon import Glyph, registerRepresentationFactory
  from defconQt.representationFactories.qPainterPathFactory import (
      QPainterPathFactory)
  from defconQt.representationFactories.glyphViewFactory import (
      NoComponentsQPainterPathFactory, OnlyComponentsQPainterPathFactory,
      OutlineInformationFactory, StartPointsInformationFactory)
 +# TODO: add a glyph pixmap factory parametrized on glyph size
 +# TODO: fine-tune the destructive notifications
  _factories = {
 -    "defconQt.QPainterPath": QPainterPathFactory,
 -    "defconQt.OnlyComponentsQPainterPath": OnlyComponentsQPainterPathFactory,
 -    "defconQt.NoComponentsQPainterPath": NoComponentsQPainterPathFactory,
 -    "defconQt.OutlineInformation": OutlineInformationFactory,
 -    "defconQt.StartPointsInformation": StartPointsInformationFactory,
 +    "defconQt.QPainterPath": (QPainterPathFactory, None),
 +    "defconQt.OnlyComponentsQPainterPath": (
 +        OnlyComponentsQPainterPathFactory, None),
 +    "defconQt.NoComponentsQPainterPath": (
 +        NoComponentsQPainterPathFactory, None),
 +    "defconQt.OutlineInformation": (
 +        OutlineInformationFactory, None),
 +    "defconQt.StartPointsInformation": (
 +        StartPointsInformationFactory, None),
  }
  def registerAllFactories():
 -    for name, factory in _factories.items():
 -        addRepresentationFactory(name, factory)
 +    for name, (factory, destructiveNotifications) in _factories.items():
 +        registerRepresentationFactory(
 +            Glyph, name, factory,
 +            destructiveNotifications=destructiveNotifications)
  | 
