Moved note handling commands to hooke.plugin.note.
[hooke.git] / hooke / plugin / __init__.py
index 5c4ca51572945e3b948e0c7f5b85ea5835d6ad16..440c3bfa785f2f5fedbcb8508aa0111f8fb0ef9f 100644 (file)
@@ -14,7 +14,6 @@ PLUGIN_MODULES = [
 #    ('autopeak', True),
 #    ('curvetools', True),
     ('cut', True),
-    ('debug', True),
 #    ('fit', True),
 #    ('flatfilts-rolf', True),
 #    ('flatfilts', True),
@@ -27,24 +26,30 @@ PLUGIN_MODULES = [
 #    ('multidistance', True),
 #    ('multifit', True),
 #    ('pcluster', True),
+#    ('peakspot', True),
 #    ('procplots', True),
 #    ('review', True),
 #    ('showconvoluted', True),
 #    ('superimpose', True),
-    ('system', True),
 #    ('tutorial', True),
-#    ('viewer', True),
     ]
 """List of plugin modules and whether they should be included by
 default.  TODO: autodiscovery
 """
 
 BUILTIN_MODULES = [
+    'debug',
+    'note',
     'playlist',
+    'system',
     ]
 """List of builtin modules.  TODO: autodiscovery
 """
 
+PLUGIN_SETTING_SECTION = 'plugins'
+"""Name of the config section which controls plugin selection.
+"""
+
 
 # Plugins and settings
 
@@ -118,9 +123,12 @@ def construct_graph(this_modname, submodnames, class_selector,
                         'Instance name %s does not match module name %s'
                         % (instance.name, submodname))
                 instances[instance.name] = instance
-    graph = Graph([Node([instances[name] for name in i.dependencies()],
-                        data=i)
-                   for i in instances.values()])
+    nodes = {}
+    for i in instances.values():     # make nodes for each instance
+        nodes[i.name] = Node(data=i)
+    for n in nodes.values():         # fill in dependencies for each node
+        n.extend([nodes[name] for name in n.data.dependencies()])
+    graph = Graph(nodes.values())
     graph.topological_sort()
     return graph
 
@@ -169,8 +177,8 @@ PLUGIN_GRAPH = construct_graph(
 """
 
 def default_settings():
-    settings = [Setting(
-            'plugins', help='Enable/disable default plugins.')]
+    settings = [Setting(PLUGIN_SETTING_SECTION,
+                        help='Enable/disable default plugins.')]
     for pnode in PLUGIN_GRAPH:
         if pnode.data.name in BUILTIN_MODULES:
             continue # builtin inclusion is not optional
@@ -179,7 +187,7 @@ def default_settings():
                            if mod_name == plugin.name][0]
         help = 'Commands: ' + ', '.join([c.name for c in plugin.commands()])
         settings.append(Setting(
-                section='plugins',
+                section=PLUGIN_SETTING_SECTION,
                 option=plugin.name,
                 value=str(default_include),
                 help=help,