def insertMeasureByPosition(self, width, position = None, counter = None): if position is None: if self.numStaffs() == 0: self._addStaff() position = NotePosition(self.numStaffs() - 1) staff = self.getStaff(self.numStaffs() - 1) position.measureIndex = staff.numMeasures() self._checkStaffIndex(position.staffIndex) newMeasure = Measure(width) newMeasure.counter = counter staff = self.getStaff(position.staffIndex) staff.insertMeasure(position, newMeasure) return newMeasure
def insertMeasureByPosition(self, width, position=None, counter=None): if position is None: if self.numStaffs() == 0: self._addStaff() position = NotePosition(self.numStaffs() - 1) staff = self.getStaff(self.numStaffs() - 1) position.measureIndex = staff.numMeasures() self._checkStaffIndex(position.staffIndex) newMeasure = Measure(width) newMeasure.counter = counter staff = self.getStaff(position.staffIndex) staff.insertMeasure(position, newMeasure) return newMeasure
def insertMeasureByIndex(self, width, index=None, counter=None): if index is None: index = self.numMeasures() if self.numStaffs() == 0: self._addStaff() staff = self.getStaff(0) elif index == self.numMeasures(): staff = self.getStaff(-1) index = staff.numMeasures() else: staff, index = self._staffContainingMeasure(index) newMeasure = Measure(width) newMeasure.counter = counter staff.insertMeasure(NotePosition(measureIndex=index), newMeasure) return newMeasure
def insertMeasureByIndex(self, width, index = None, counter = None): if index is None: index = self.numMeasures() if self.numStaffs() == 0: self._addStaff() staff = self.getStaff(0) elif index == self.numMeasures(): staff = self.getStaff(-1) index = staff.numMeasures() else: staff, index = self._staffContainingMeasure(index) newMeasure = Measure(width) newMeasure.counter = counter staff.insertMeasure(NotePosition(measureIndex = index), newMeasure) return newMeasure