Salome HOME
Remove linking to GeomValidators.
[modules/shaper.git] / src / PythonAddons / addons_Features.py
1 """Registration of all user-defined Python features
2 """
3
4 import ModelAPI
5 from macros.box.feature      import BoxFeature
6
7
8 class PythonFeaturesPlugin(ModelAPI.ModelAPI_Plugin):
9 """Implementation of features plugin"""
10
11     def __init__(self):
12         """Constructor"""
13         ModelAPI.ModelAPI_Plugin.__init__(self)
14         aSession = ModelAPI.ModelAPI_Session.get()
15         aSession.registerPlugin(self)
16         pass
17
18     def createFeature(self, theFeatureID):
19         """Create a feature by its Id"""
20         aFeature = None
21
22         if theFeatureID == BoxFeature.ID():
23             aFeature = BoxFeature().__disown__()
24
25         else:
26             raise StandardError("No such feature %s" % theFeatureID)
27
28         return aFeature
29
30 ### The plugin object
31 plugin = PythonFeaturesPlugin()
32 plugin.__disown__()