Make `index` argument optional and return curve in `remove curve from playlist`.
authorW. Trevor King <wking@drexel.edu>
Thu, 8 Mar 2012 15:24:03 +0000 (10:24 -0500)
committerW. Trevor King <wking@drexel.edu>
Thu, 8 Mar 2012 15:24:03 +0000 (10:24 -0500)
hooke/plugin/playlist.py

index ca99339a498e78c2d255c1c0c58977d5eb075b07..334c133e0e0b1a78220de34f8b8e88a7d2b16aaf 100644 (file)
@@ -337,7 +337,7 @@ class RemoveCommand (PlaylistCommand):
         super(RemoveCommand, self).__init__(
             name='remove curve from playlist',
             arguments=[
-                Argument(name='index', type='int', optional=False, help="""
+                Argument(name='index', type='int', optional=True, help="""
 Index of target curve.
 """.strip()),
                 ],
@@ -345,8 +345,11 @@ Index of target curve.
 
     def _run(self, hooke, inqueue, outqueue, params):
         playlist = self._playlist(hooke, params)
-        playlist.pop(params['index'])
+        if params['index'] is None:
+            params['index'] = playlist.index()
+        curve = playlist.pop(params['index'])
         playlist.jump(playlist.index())
+        outqueue.put(curve)
 
 
 class ApplyCommand (PlaylistCommand):