From: W. Trevor King Date: Sat, 21 Aug 2010 19:05:41 +0000 (-0400) Subject: Clear NoteIndexList in .__setstate__ to avoid doubling items during engine->UI passing. X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=4639f6fecd0de4d5dbff75a2d9cc8d10f4d13aaa;p=hooke.git Clear NoteIndexList in .__setstate__ to avoid doubling items during engine->UI passing. --- diff --git a/hooke/playlist.py b/hooke/playlist.py index 3380bfc..6e8f232 100644 --- a/hooke/playlist.py +++ b/hooke/playlist.py @@ -82,6 +82,7 @@ class NoteIndexList (list): def __setstate__(self, state): self._set_ignored_attrs() + self.clear() for key,value in self._default_attrs.items(): setattr(self, key, value) for key,value in state.items(): @@ -113,6 +114,10 @@ class NoteIndexList (list): """ pass + def clear(self): + while len(self) > 0: + self.pop() + def index(self, value=None, *args, **kwargs): """Extend `list.index`, returning the current index if `value` is `None`.