Пример #1
0
 def _setupDeleteSection(self, score):
     if self._qScore.hasDragSelection():
         deleteAction = self.addAction(DBIcons.getIcon("delete"),
                                       "Delete Selected Measures",
                                       self._deleteMeasures)
         deleteAction.setEnabled(score.numMeasures() >
                                 len(list(self._qScore.iterDragSelection())))
         self.addAction("Clear Selected Measures",
                        self._clearMeasures)
     else:
         deleteAction = self.addAction(DBIcons.getIcon("delete"),
                                       "Delete Measure",
                                       self._deleteOneMeasure)
         deleteAction.setEnabled(score.numMeasures() > 1)
         self.addAction("Clear Measure",
                        self._clearOneMeasure)
     deleteMenu = self.addMenu("Delete...")
     deleteStaffAction = deleteMenu.addAction("Staff", self._deleteStaff)
     deleteStaffAction.setEnabled(score.numStaffs() > 1)
     deleteSectionAction = deleteMenu.addAction("Section",
                                                self._deleteSection)
     deleteSectionAction.setEnabled(score.numSections() > 1)
     deleteEmptyAction = deleteMenu.addAction("Empty Trailing Measures",
                                              self._deleteEmptyMeasures)
     emptyPositions = score.trailingEmptyMeasures()
     deleteEmptyAction.setEnabled(score.numMeasures() > 1
                                  and len(emptyPositions) > 0)
     self.addSeparator()
Пример #2
0
 def _setupEditSection(self):
     if (self._noteText !=
         DBConstants.EMPTY_NOTE):
         actionText = "Repeat note"
         self.addAction(DBIcons.getIcon("repeat"),
                        actionText, self._repeatNote)
     self.addSeparator()
     if self._qScore.hasDragSelection():
         self.addAction(DBIcons.getIcon("copy"), "Copy Selected Measures",
                        self._copyMeasures)
         pasteAction = self.addAction(DBIcons.getIcon("paste"),
                                      "Paste Over Selected Measures",
                                      self._pasteMeasuresOver)
         fillAction = self.addAction(DBIcons.getIcon("paste"),
                                      "Fill Paste Selected Measures",
                                      self._fillPaste)
         fillAction.setEnabled(len(self._qScore.measureClipboard) > 0)
     else:
         self.addAction(DBIcons.getIcon("copy"), "Copy Measure",
                        self._copyOneMeasure)
         pasteAction = self.addAction(DBIcons.getIcon("paste"),
                                      "Insert Measures From Clipboard",
                                      self._insertOneMeasure)
     pasteAction.setEnabled(len(self._qScore.measureClipboard) > 0)
     self.addAction("Edit Measure Count", self._editMeasureCount)
     self.addSeparator()
Пример #3
0
 def updateRecentFiles(self):
     self.menuRecentScores.clear()
     for fname in self.recentFiles:
         if fname != self.filename and os.path.exists(fname):
             def openRecentFile(bool_, filename = fname):
                 if not self.okToContinue():
                     return
                 if self.scoreScene.loadScore(filename):
                     self.filename = filename
                     self.updateStatus("Successfully loaded %s" % filename)
                     self.addToRecentFiles()
                     self.updateRecentFiles()
             action = self.menuRecentScores.addAction(fname)
             action.setIcon(DBIcons.getIcon("score"))
             action.triggered.connect(openRecentFile)
Пример #4
0
    def updateRecentFiles(self):
        self.menuRecentScores.clear()
        for fname in self.recentFiles:
            if fname != self.filename and os.path.exists(fname):

                def openRecentFile(bool_, filename=fname):
                    if not self.okToContinue():
                        return
                    if self.scoreScene.loadScore(filename):
                        self.filename = filename
                        self.updateStatus("Successfully loaded %s" % filename)
                        self.addToRecentFiles()
                        self.updateRecentFiles()

                action = self.menuRecentScores.addAction(fname)
                action.setIcon(DBIcons.getIcon("score"))
                action.triggered.connect(openRecentFile)