From 5560a9e827a46ebc09b3cb539911aef8383b00a5 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Thu, 8 Mar 2012 10:24:03 -0500 Subject: [PATCH] Make `index` argument optional and return curve in `remove curve from playlist`. --- hooke/plugin/playlist.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/hooke/plugin/playlist.py b/hooke/plugin/playlist.py index ca99339..334c133 100644 --- a/hooke/plugin/playlist.py +++ b/hooke/plugin/playlist.py @@ -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): -- 2.26.2