Debian Codegraph @

envisage/examples/demo/plugins/tasks/attractors/attractors_plugin.py

raw
1 # (C) Copyright 2007-2025 Enthought, Inc., Austin, TX
2 # All rights reserved.
3 #
4 # This software is provided without warranty under the terms of the BSD
5 # license included in LICENSE.txt and may be redistributed only under
6 # the conditions described in the aforementioned license. The license
7 # is also available online at http://www.enthought.com/licenses/BSD.txt
8 #
9 # Thanks for using Enthought open source!
10
11 # Standard library imports.
12 import os.path
13
14 from traits.api import List
15
16 # Enthought library imports.
17 from envisage.api import Plugin
18 from envisage.ui.tasks.api import TaskFactory
19
20
21 class AttractorsPlugin(Plugin):
22 """The chaotic attractors plugin."""
23
24 # Extension point IDs.
25 PREFERENCES = "envisage.preferences"
26 PREFERENCES_PANES = "envisage.ui.tasks.preferences_panes"
27 TASKS = "envisage.ui.tasks.tasks"
28
29 #### 'IPlugin' interface ##################################################
30
31 # The plugin's unique identifier.
32 id = "example.attractors"
33
34 # The plugin's name (suitable for displaying to the user).
35 name = "Attractors"
36
37 #### Contributions to extension points made by this plugin ################
38
39 preferences = List(contributes_to=PREFERENCES)
40 preferences_panes = List(contributes_to=PREFERENCES_PANES)
41 tasks = List(contributes_to=TASKS)
42
43 ###########################################################################
44 # Protected interface.
45 ###########################################################################
46
47 def _preferences_default(self):
48 filename = os.path.join(os.path.dirname(__file__), "preferences.ini")
49 return ["file://" + filename]
50
51 def _preferences_panes_default(self):
52 from attractors.attractors_preferences import AttractorsPreferencesPane
53
54 return [AttractorsPreferencesPane]
55
56 def _tasks_default(self):
57 from attractors.visualize_2d_task import Visualize2dTask
58 from attractors.visualize_3d_task import Visualize3dTask
59
60 return [
61 TaskFactory(
62 id="example.attractors.task_2d",
63 name="2D Visualization",
64 factory=Visualize2dTask,
65 ),
66 TaskFactory(
67 id="example.attractors.task_3d",
68 name="3D Visualization",
69 factory=Visualize3dTask,
70 ),
71 ]