From 226c1eeae314e3148c4d25074794c86d947129fd Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Sun, 15 Aug 2010 18:17:40 -0400 Subject: [PATCH] Move NoteFilterCommand from plugin.playlist to plugin.note. --- hooke/plugin/note.py | 17 +++++++++++++++-- hooke/plugin/playlist.py | 13 +------------ 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/hooke/plugin/note.py b/hooke/plugin/note.py index fa699be..b982075 100644 --- a/hooke/plugin/note.py +++ b/hooke/plugin/note.py @@ -24,13 +24,15 @@ from ..command import Command, Argument, Failure from . import Builtin from .curve import current_curve_callback - +from .playlist import FilterCommand class NotePlugin (Builtin): def __init__(self): super(NotePlugin, self).__init__(name='note') self._commands = [ - SetNoteCommand(self), GetNoteCommand(self)] + SetNoteCommand(self), GetNoteCommand(self), + NoteFilterCommand(self), + ] class SetNoteCommand (Command): @@ -76,3 +78,14 @@ Target object for the note. Defaults to the current curve. def _run(self, hooke, inqueue, outqueue, params): outqueue.put(params['target'].info['note']) + + +class NoteFilterCommand (FilterCommand): + """Create a subset playlist of curves with `.info['note'] != None`. + """ + def __init__(self, plugin): + super(NoteFilterCommand, self).__init__( + plugin, name='note filter playlist') + + def filter(self, curve, hooke, inqueue, outqueue, params): + return 'note' in curve.info and curve.info['note'] != None diff --git a/hooke/plugin/playlist.py b/hooke/plugin/playlist.py index afd2ef9..2b9caa8 100644 --- a/hooke/plugin/playlist.py +++ b/hooke/plugin/playlist.py @@ -40,7 +40,7 @@ class PlaylistPlugin (Builtin): SaveCommand(self), LoadCommand(self), AddCommand(self), AddGlobCommand(self), RemoveCommand(self), ApplyCommandStack(self), - FilterCommand(self), NoteFilterCommand(self), + FilterCommand(self), ] @@ -406,14 +406,3 @@ Function returning `True` for "good" curves. p.set_path(os.path.join(os.path.dirname(p.path), p.name)) self._set_playlist(hooke, params, p) outqueue.put(p) - - -class NoteFilterCommand (FilterCommand): - """Create a subset playlist of curves with `.info['note'] != None`. - """ - def __init__(self, plugin): - super(NoteFilterCommand, self).__init__( - plugin, name='note filter playlist') - - def filter(self, curve, hooke, inqueue, outqueue, params): - return 'note' in curve.info and curve.info['note'] != None -- 2.26.2