Exemple #1
0
 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())
Exemple #2
0
 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())
Exemple #3
0
 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())
Exemple #4
0
 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())
Exemple #5
0
 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())
Exemple #6
0
 def _insertOneMeasure(self):
     self._qScore.insertMeasures(self._np)
     self._qScore.sendFsmEvent(MenuSelect())
Exemple #7
0
 def _fillPaste(self):
     self._qScore.pasteMeasuresOver(True)
     self._qScore.sendFsmEvent(MenuSelect())
Exemple #8
0
 def _pasteMeasuresOver(self):
     self._qScore.pasteMeasuresOver()
     self._qScore.sendFsmEvent(MenuSelect())
Exemple #9
0
 def _copyMeasures(self):
     self._qScore.copyMeasures()
     self._qScore.sendFsmEvent(MenuSelect())
Exemple #10
0
 def _deleteAlternate(self):
     np = self._np.makeMeasurePosition()
     command = SetAlternateCommand(self._qScore, np,
                                   None)
     self._qScore.addCommand(command)
     self._qScore.sendFsmEvent(MenuSelect())
Exemple #11
0
 def _setRepeatStart(self, onOff):
     command = SetRepeatStartCommand(self._qScore, self._startNotePosition,
                                     onOff)
     self._qScore.clearDragSelection()
     self._qScore.addCommand(command)
     self._qScore.sendFsmEvent(MenuSelect())
Exemple #12
0
 def _copySection(self, sectionIndex):
     command = InsertSectionCommand(self._qScore, self._np, sectionIndex)
     self._qScore.clearDragSelection()
     self._qScore.addCommand(command)
     self._qScore.sendFsmEvent(MenuSelect())
Exemple #13
0
 def _insertMeasureAfter(self):
     np = self._np.makeMeasurePosition()
     np.measureIndex += 1
     self._insertDefaultMeasure(np, True)
     self._qScore.sendFsmEvent(MenuSelect())
Exemple #14
0
 def _insertMeasureBefore(self):
     self._insertDefaultMeasure(self._np)
     self._qScore.sendFsmEvent(MenuSelect())
Exemple #15
0
 def _deleteOneMeasure(self):
     self._qScore.deleteMeasures(self._np)
     self._qScore.sendFsmEvent(MenuSelect())
Exemple #16
0
 def _clearOneMeasure(self):
     self._qScore.clearMeasures(self._np)
     self._qScore.sendFsmEvent(MenuSelect())
Exemple #17
0
 def _setLineBreak(self, onOff):
     command = SetLineBreakCommand(self._qScore, self._endNotePosition,
                                   onOff)
     self._qScore.clearDragSelection()
     self._qScore.addCommand(command)
     self._qScore.sendFsmEvent(MenuSelect())