Replace .config rather than reconstructing plugins, drivers, and UIs.
[hooke.git] / hooke / playlist.py
index 9eb7e8b7a82a9a52e7856bd3a6a079cd336f532f..dfec6d72c28c65b3888f6b4d5265b43fee523d73 100644 (file)
@@ -88,13 +88,27 @@ class NoteIndexList (list):
     def items(self, reverse=False):
         """Iterate through `self` calling `_setup_item` on each item
         before yielding.
+
+        Notes
+        -----
+        Updates :attr:`_index` during the iteration so
+        :func:`~hooke.plugin.curve.current_curve_callback` works as
+        expected in :class:`~hooke.command.Command`\s called from
+        :class:`~hooke.plugin.playlist.ApplyCommandStack`.  After the
+        iteration completes, :attr:`_index` is restored to its
+        original value.
         """
+        index = self._index
         items = self
         if reverse == True:
-            items = reversed(self)
-        for item in items:
+            items = reversed(enumerate(self))
+        else:
+            items = enumerate(self)
+        for i,item in items:
+            self._index = i
             self._setup_item(item)
             yield item
+        self._index = index
 
     def filter(self, keeper_fn=lambda item:True, *args, **kwargs):
         c = copy.deepcopy(self)