From 33064ec057eedd05aaba90276a14143a976b5be0 Mon Sep 17 00:00:00 2001 From: Nils <> Date: Wed, 6 Jan 2021 18:58:44 +0100 Subject: [PATCH] shadow support for differently sized patterns --- qtgui/pattern_grid.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/qtgui/pattern_grid.py b/qtgui/pattern_grid.py index e88fe5b..63d4272 100644 --- a/qtgui/pattern_grid.py +++ b/qtgui/pattern_grid.py @@ -425,10 +425,17 @@ class PatternGrid(QtWidgets.QGraphicsScene): def createShadow(self, exportDict): """Receives steps from another track and display them as shadoy steps in the current one as a reference. Creating a new shadow does not delete the old one. + + It is possible that the source pattern is longer (multiplicator) than our own. We ignore + all shadows beyond our own length. + + Same is true if the source has more notes (pitches) than ours. We do naive x/y mapping. + Making sense of that is up to the user :) """ for x, y in ((s["index"], s["pitch"]) for s in exportDict["pattern"]): - self._steps[(x,y)].shadow = True # (x,y):Step() - self._steps[(x,y)].setApperance() + if (x,y) in self._steps: + self._steps[(x,y)].shadow = True # (x,y):Step() + self._steps[(x,y)].setApperance() def removeShadows(self): for step in self._steps.values():