From 1370b28ea16c2033226c35ba399506a5a1323aa2 Mon Sep 17 00:00:00 2001 From: Nils <> Date: Sun, 30 Jun 2019 20:57:45 +0200 Subject: [PATCH] Prevent Fraction type to get saved to json for standard durations --- engine/items.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/engine/items.py b/engine/items.py index 8b7b931..ce53e93 100644 --- a/engine/items.py +++ b/engine/items.py @@ -366,6 +366,9 @@ class Duration(object): else: #the highest value in datalist was smaller return None + if completeDuration == int(completeDuration): + completeDuration = int(completeDuration) + durList = [D1024, D512, D256, D128, D64, D32, D16, D8, D4, D2, D1, DB, DL, DM] guessedBase = _closest(completeDuration, durList) @@ -1341,8 +1344,10 @@ class Chord(Item): for note in self.notelist: oldValues.append(note.duration.copy()) #we don't actually need a copy since we create a new one. But better safe than sorry. This matches also the behaviour of the other duration change functions. complDur = note.duration.completeDuration() - #newTicks = complDur / newparts + + #newTicks = complDur / newparts note.duration = Duration.createByGuessing(Fraction(complDur, newparts)) + #Now we have one note with the duration the user wants to have. Make n-1 copies- spawnedNotes = []