def _undo(self): if self._oldHead == DBConstants.EMPTY_NOTE: self._score.deleteNote(self._np) else: self._score.addNote(self._np, self._oldHead) DBMidi.playNote(self._np.drumIndex, self._oldHead) measure = self._score.getMeasureByPosition(self._np) measure.belowText = self._oldBelow measure.aboveText = self._oldAbove
def _redo(self): self._score.toggleNote(self._np, self._head) newHead = self._measure.getNote(self._np) if newHead != DBConstants.EMPTY_NOTE: DBMidi.playNote(self._np.drumIndex, self._head) elif (self._oldAbove[self._np.noteTime] != " " or self._oldBelow[self._np.noteTime] != " "): measure = self._score.getMeasureByPosition(self._np) if not measure.hasAnyNoteAt(self._np.noteTime): measure.setAbove(self._np.noteTime, " ") measure.setBelow(self._np.noteTime, " ")
def _redo(self): self._score.addNote(self._np, self._head) if self._head != DBConstants.EMPTY_NOTE: DBMidi.playNote(self._np.drumIndex, self._head)