Clear NoteIndexList in .__setstate__ to avoid doubling items during engine->UI passing.
authorW. Trevor King <wking@drexel.edu>
Sat, 21 Aug 2010 19:05:41 +0000 (15:05 -0400)
committerW. Trevor King <wking@drexel.edu>
Sat, 21 Aug 2010 19:05:41 +0000 (15:05 -0400)
hooke/playlist.py

index 3380bfc..6e8f232 100644 (file)
@@ -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`.