X-Git-Url: http://git.tremily.us/?a=blobdiff_plain;f=hooke%2Fplugin%2F__init__.py;h=2418b69d5d3903c95b10ea781265f8678388d51a;hb=62cfb3bde4faa22da8d131571dc6f093682a0cca;hp=65835a7b5d0208be3e16a6d67f98f948a103a351;hpb=8b12d7d77256982cf9a228901e1e9ed511b43d36;p=hooke.git diff --git a/hooke/plugin/__init__.py b/hooke/plugin/__init__.py index 65835a7..2418b69 100644 --- a/hooke/plugin/__init__.py +++ b/hooke/plugin/__init__.py @@ -1,4 +1,20 @@ -# Copyright +# Copyright (C) 2010 W. Trevor King +# +# This file is part of Hooke. +# +# Hooke is free software: you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation, either +# version 3 of the License, or (at your option) any later version. +# +# Hooke is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with Hooke. If not, see +# . """The `plugin` module provides optional submodules that add new Hooke commands. @@ -18,7 +34,7 @@ PLUGIN_MODULES = [ ('cut', True), # ('fit', True), # ('flatfilts-rolf', True), -# ('flatfilts', True), + ('flatfilt', True), # ('generalclamp', True), # ('generaltccd', True), # ('generalvclamp', True), @@ -41,6 +57,7 @@ default. TODO: autodiscovery BUILTIN_MODULES = [ 'config', + 'curve', 'debug', 'note', 'playlist', @@ -66,9 +83,10 @@ class Plugin (object): self.name = name self.setting_section = '%s plugin' % self.name self.config = {} + self._commands = [] def dependencies(self): - """Return a list of :class:`Plugin`\s we require.""" + """Return a list of names of :class:`Plugin`\s we require.""" return [] def default_settings(self): @@ -81,10 +99,21 @@ class Plugin (object): """ return [] + def _setup_commands(self): + """Perform internal setup on stored commands. + + Currently: + + * Adds a `plugin` attribute to each command so they can access + the plugin configuration with `.plugin.config`. + """ + for command in self._commands: + command.plugin = self + def commands(self): """Return a list of :class:`hooke.command.Command`\s provided. """ - return [] + return list(self._commands) class Builtin (Plugin): """A required collection of Hooke commands.