def _insertDefaultMeasure(self, np, preserveSectionEnd = False): mc = self._qScore.defaultCount command = InsertMeasuresCommand(self._qScore, np, 1, mc, preserveSectionEnd) self._qScore.clearDragSelection() self._qScore.addCommand(command) self._qScore.sendFsmEvent(MenuSelect())
def _deleteSection(self): score = self._qScore.score msg = "Really delete this section?" yesNo = QtGui.QMessageBox.question(self._qScore.parent(), "Delete Section?", msg, QtGui.QMessageBox.Ok, QtGui.QMessageBox.Cancel) if yesNo == QtGui.QMessageBox.Ok: np = self._np.makeMeasurePosition() startIndex = score.getSectionStartStaffIndex(np) sectionIndex = score.getSectionIndex(np) sectionName = score.getSectionTitle(sectionIndex) np.staffIndex = startIndex while (np.staffIndex < score.numStaffs() and not score.getStaff(np.staffIndex).isSectionEnd()): np.staffIndex += 1 arguments = [] for np.staffIndex in range(np.staffIndex, startIndex - 1, -1): staff = score.getStaff(np.staffIndex) for np.measureIndex in range(staff.numMeasures() - 1, -1, -1): arguments.append((np.makeCopy(),)) np.staffIndex -= 1 self._qScore.clearDragSelection() self._qScore.addRepeatedCommand("delete section: " + sectionName, DeleteMeasureCommand, arguments) self._qScore.sendFsmEvent(MenuSelect())
def _deleteEmptyMeasures(self): score = self._qScore.score msg = "This will delete all empty trailing measures.\nContinue?" yesNo = QtGui.QMessageBox.question(self._qScore.parent(), "Delete Empty Measures", msg, QtGui.QMessageBox.Ok, QtGui.QMessageBox.Cancel) if yesNo == QtGui.QMessageBox.Ok: positions = score.trailingEmptyMeasures() arguments = [(np,) for np in positions] self._qScore.clearDragSelection() self._qScore.addRepeatedCommand("delete empty measures", DeleteMeasureCommand, arguments) self._qScore.sendFsmEvent(MenuSelect())
def _insertOtherMeasures(self): np = self._np.makeMeasurePosition() counter = self._qScore.defaultCount insertDialog = QInsertMeasuresDialog(self._qScore.parent(), counter, self._props.counterRegistry) if insertDialog.exec_(): nMeasures, counter, insertBefore = insertDialog.getValues() preserve = False if not insertBefore: np.measureIndex += 1 preserve = True command = InsertMeasuresCommand(self._qScore, np, nMeasures, counter, preserve) self._qScore.clearDragSelection() self._qScore.addCommand(command) self._qScore.sendFsmEvent(MenuSelect())
def _deleteStaff(self): score = self._qScore.score msg = "Really delete this staff?" yesNo = QtGui.QMessageBox.question(self._qScore.parent(), "Delete Staff?", msg, QtGui.QMessageBox.Ok, QtGui.QMessageBox.Cancel) if yesNo == QtGui.QMessageBox.Ok: np = self._np.makeStaffPosition() staff = score.getItemAtPosition(np) arguments = [] np.measureIndex = staff.numMeasures() - 1 while np.measureIndex >= 0: arguments.append((np.makeCopy(),)) np.measureIndex -= 1 self._qScore.clearDragSelection() self._qScore.addRepeatedCommand("delete staff", DeleteMeasureCommand, arguments) self._qScore.sendFsmEvent(MenuSelect())
def _insertOneMeasure(self): self._qScore.insertMeasures(self._np) self._qScore.sendFsmEvent(MenuSelect())
def _fillPaste(self): self._qScore.pasteMeasuresOver(True) self._qScore.sendFsmEvent(MenuSelect())
def _pasteMeasuresOver(self): self._qScore.pasteMeasuresOver() self._qScore.sendFsmEvent(MenuSelect())
def _copyMeasures(self): self._qScore.copyMeasures() self._qScore.sendFsmEvent(MenuSelect())
def _deleteAlternate(self): np = self._np.makeMeasurePosition() command = SetAlternateCommand(self._qScore, np, None) self._qScore.addCommand(command) self._qScore.sendFsmEvent(MenuSelect())
def _setRepeatStart(self, onOff): command = SetRepeatStartCommand(self._qScore, self._startNotePosition, onOff) self._qScore.clearDragSelection() self._qScore.addCommand(command) self._qScore.sendFsmEvent(MenuSelect())
def _copySection(self, sectionIndex): command = InsertSectionCommand(self._qScore, self._np, sectionIndex) self._qScore.clearDragSelection() self._qScore.addCommand(command) self._qScore.sendFsmEvent(MenuSelect())
def _insertMeasureAfter(self): np = self._np.makeMeasurePosition() np.measureIndex += 1 self._insertDefaultMeasure(np, True) self._qScore.sendFsmEvent(MenuSelect())
def _insertMeasureBefore(self): self._insertDefaultMeasure(self._np) self._qScore.sendFsmEvent(MenuSelect())
def _deleteOneMeasure(self): self._qScore.deleteMeasures(self._np) self._qScore.sendFsmEvent(MenuSelect())
def _clearOneMeasure(self): self._qScore.clearMeasures(self._np) self._qScore.sendFsmEvent(MenuSelect())
def _setLineBreak(self, onOff): command = SetLineBreakCommand(self._qScore, self._endNotePosition, onOff) self._qScore.clearDragSelection() self._qScore.addCommand(command) self._qScore.sendFsmEvent(MenuSelect())