From 4639f6fecd0de4d5dbff75a2d9cc8d10f4d13aaa Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Sat, 21 Aug 2010 15:05:41 -0400 Subject: [PATCH] Clear NoteIndexList in .__setstate__ to avoid doubling items during engine->UI passing. --- hooke/playlist.py | 5 +++++ 1 file changed, 5 insertions(+) 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`. -- 2.26.2