예제 #1
0
 def slotAccepted(self):
     """Makes the score and puts it in the editor."""
     from . import build
     builder = build.Builder(self)       # get the builder
     text = builder.text()               # get the source text
     lydoc = ly.document.Document(text)  # temporarily store it in a lydoc
     cursor = ly.document.Cursor(lydoc)  # make a cursor selecting it
     indent.indenter().indent(cursor)    # indent it according to user prefs
     doc = app.openUrl(QUrl())           # get a new Frescobaldi document
     doc.setPlainText(lydoc.plaintext()) # write the text in it
     doc.setModified(False)              # make it "not modified"
     self.parent().setCurrentDocument(doc)
예제 #2
0
 def slotAccepted(self):
     """Makes the score and puts it in the editor."""
     from . import build
     builder = build.Builder(self)  # get the builder
     text = builder.text()  # get the source text
     lydoc = ly.document.Document(text)  # temporarily store it in a lydoc
     cursor = ly.document.Cursor(lydoc)  # make a cursor selecting it
     indent.indenter().indent(cursor)  # indent it according to user prefs
     doc = app.openUrl(QUrl())  # get a new Frescobaldi document
     doc.setPlainText(lydoc.plaintext())  # write the text in it
     doc.setModified(False)  # make it "not modified"
     self.parent().setCurrentDocument(doc)
예제 #3
0
 def slotAccepted(self):
     """Makes the score and puts it in the editor."""
     from . import build
     builder = build.Builder(self)  # get the builder
     doc = builder.document()  # get the ly.dom document tree
     if not self.settings.widget().generalPreferences.relpitch.isChecked():
         # remove pitches from \relative commands
         for n in doc.find(ly.dom.Relative):
             for n1 in n.find(ly.dom.Pitch, 1):
                 n.remove(n1)
     text = builder.text(doc)  # convert to LilyPond source text
     lydoc = ly.document.Document(text)  # temporarily store it in a lydoc
     cursor = ly.document.Cursor(lydoc)  # make a cursor selecting it
     indent.indenter().indent(cursor)  # indent it according to user prefs
     doc = app.openUrl(QUrl())  # get a new Frescobaldi document
     doc.setPlainText(lydoc.plaintext())  # write the text in it
     doc.setModified(False)  # make it "not modified"
     self.parent().setCurrentDocument(doc)
예제 #4
0
def reformat(cursor):
    """Reformat the selection or the whole document."""
    i = indent.indenter(cursor.document())
    c = lydocument.cursor(cursor, select_all=True)
    ly.reformat.reformat(c, i)
예제 #5
0
def reformat(cursor):
    """Reformat the selection or the whole document."""
    i = indent.indenter(cursor.document())
    c = lydocument.cursor(cursor, select_all=True)
    ly.reformat.reformat(c, i)