From: W. Trevor King Date: Fri, 27 Aug 2010 20:14:25 +0000 (-0400) Subject: Keep Playlist._loaded up to date on Curve.unload() calls. X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=e57e6aa9b86351398b3af9a24513169395a71522;p=hooke.git Keep Playlist._loaded up to date on Curve.unload() calls. --- diff --git a/hooke/playlist.py b/hooke/playlist.py index 63d1843..69442da 100644 --- a/hooke/playlist.py +++ b/hooke/playlist.py @@ -160,14 +160,13 @@ class Playlist (NoteIndexList): def __init__(self, drivers, name=None): super(Playlist, self).__init__(name=name) self.drivers = drivers - self._max_loaded = 100 # curves to hold in memory simultaneously. def _set_default_attrs(self): super(Playlist, self)._set_default_attrs() self._default_attrs['drivers'] = [] # List of loaded curves, see :meth:`._setup_item`. self._default_attrs['_loaded'] = [] - self._default_attrs['_max_loaded'] = 100 + self._default_attrs['_max_loaded'] = 100 # curves to hold in memory simultaneously. def __setstate__(self, state): super(Playlist, self).__setstate__(state) @@ -201,6 +200,12 @@ class Playlist (NoteIndexList): oldest = self._loaded.pop(0) oldest.unload() + def unload(self, curve): + "Inverse of .`_setup_item`." + curve.unload() + self._loaded.remove(curve) + + def playlist_path(path): """Normalize playlist path extensions. diff --git a/hooke/plugin/playlist.py b/hooke/plugin/playlist.py index ed904c6..43978b5 100644 --- a/hooke/plugin/playlist.py +++ b/hooke/plugin/playlist.py @@ -385,7 +385,7 @@ Evaluate the applied command stack immediately. for command in params['commands']: curve.command_stack.append(command) curve.set_hooke(hooke) - curve.unload() + p.unload(curve) def __setup_params(self, hooke, params): if params['commands'] == None: