API Reference for Enthought Tool Suite 3.0.1
A trait type used to declare and access extension points.
Exception message template.
INVALID_TRAIT_TYPE = 'extension points must be "List"s e.g. List, List(Int) but a value of %s was specified.'
A factory for extension point decorators!
As an alternative to making contributions via traits, you can use this decorator to mark any method on a 'Plugin' as contributing to an extension point (note this is only used on 'Plugin' instances!).
e.g. Using a trait you might have something like:
class MyPlugin(Plugin):
messages = List(contributes_to='acme.messages')
def _messages_default(self):
return ['Hello', 'Hola']
whereas, using the decorator, it would be:
class MyPlugin(Plugin):
@contributes_to('acme.messages')
def _get_messages(self):
return ['Hello', 'Hola']
There is not much in it really, but the decorator version looks a little less like 'magic' since it doesn't require the developer to know about Traits default initializers. However, if you know that you will want to dynamically change your contributions then use the trait version because all you have to do is change the value of the trait and the framework will react accordingly.
| Local name | Refers to |
|---|---|
| IExtensionPoint | enthought.envisage.i_extension_point.IExtensionPoint |
| implements | enthought.traits.has_traits.implements |
| inspect | inspect |
| List | enthought.traits.trait_types.List |
| TraitType | enthought.traits.trait_handlers.TraitType |
| Undefined | enthought.traits.trait_base.Undefined |
| weakref | weakref |
© Copyright 2002-2008 Enthought, Inc.