コード例 #1
0
ファイル: dialog.py プロジェクト: 19joho66/frescobaldi
 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
ファイル: dialog.py プロジェクト: zsalch/frescobaldi
 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
ファイル: dialog.py プロジェクト: sicotfre/frescobaldi
 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
ファイル: reformat.py プロジェクト: AlexSchr/frescobaldi
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
ファイル: reformat.py プロジェクト: ryanakca/frescobaldi
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)