Rework Plugin.commands() to include _setup_commands().
[hooke.git] / hooke / plugin / playlist.py
index 33ff5e61576534dd910c1aed5db86133298918c1..47975f4a468b5409f065f0e66cc60cb0ae6ee4f7 100644 (file)
@@ -1,7 +1,23 @@
-# Copyright
-
-"""The `playlist` module provides :class:`PlaylistPlugin` several
-associated :class:`hooke.command.Command`\s for handling
+# Copyright (C) 2010 W. Trevor King <wking@drexel.edu>
+#
+# 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
+# <http://www.gnu.org/licenses/>.
+
+"""The ``playlist`` module provides :class:`PlaylistPlugin` and
+several associated :class:`hooke.command.Command`\s for handling
 :mod:`hooke.playlist` classes.
 """
 
@@ -15,13 +31,13 @@ from ..plugin import Builtin
 class PlaylistPlugin (Builtin):
     def __init__(self):
         super(PlaylistPlugin, self).__init__(name='playlist')
-
-    def commands(self):
-        return [NextCommand(), PreviousCommand(), JumpCommand(),
-                IndexCommand(), CurveListCommand(),
-                SaveCommand(), LoadCommand(),
-                AddCommand(), AddGlobCommand(),
-                RemoveCommand(), FilterCommand(), NoteFilterCommand()]
+        self._commands = [
+            NextCommand(), PreviousCommand(), JumpCommand(),
+            IndexCommand(), CurveListCommand(),
+            SaveCommand(), LoadCommand(),
+            AddCommand(), AddGlobCommand(),
+            RemoveCommand(), FilterCommand(), NoteFilterCommand()]
+        self._setup_commands()
 
 
 # Define common or complicated arguments
@@ -37,8 +53,8 @@ def current_playlist_callback(hooke, command, argument, value):
 PlaylistArgument = Argument(
     name='playlist', type='playlist', callback=current_playlist_callback,
     help="""
-:class:`hooke.plugin.playlist.Playlist` to act on.  Defaults to the
-current playlist.
+:class:`hooke.playlist.Playlist` to act on.  Defaults to the current
+playlist.
 """.strip())
 
 def playlist_name_callback(hooke, command, argument, value):