Esempio n. 1
0
def slot_file_new_from_template_action(action):
    name = action.objectName()
    d = app.openUrl(QUrl())
    win = mainwindow()
    win.setCurrentDocument(d)
    from snippet import insert, snippets
    view = win.currentView()
    view.setFocus()
    insert.insert(name, view)
    d.setUndoRedoEnabled(False)
    d.setUndoRedoEnabled(True) # d.clearUndoRedoStacks() only in Qt >= 4.7
    d.setModified(False)
    if 'template-run' in snippets.get(name).variables:
        import engrave
        engrave.engraver(win).engrave('preview', d)
Esempio n. 2
0
 def newDocument(self):
     """ Creates a new, empty document. """
     d = document.Document()
     self.setCurrentDocument(d)
     s = QSettings()
     ndoc = s.value("new_document", "empty", type(""))
     template = s.value("new_document_template", "", type(""))
     if ndoc == "template" and template:
         from snippet import snippets, insert
         if snippets.text(template):
             insert.insert(template, self.currentView())
             d.setUndoRedoEnabled(False)
             d.setUndoRedoEnabled(True) # d.clearUndoRedoStacks() only in Qt >= 4.7
             d.setModified(False)
     elif ndoc == "version":
         import lilypondinfo
         d.setPlainText('\\version "{0}"\n\n'.format(lilypondinfo.preferred().versionString()))
         d.setModified(False)
Esempio n. 3
0
 def newDocument(self):
     """ Creates a new, empty document. """
     d = document.Document()
     self.setCurrentDocument(d)
     s = QSettings()
     ndoc = s.value("new_document", "empty", str)
     template = s.value("new_document_template", "", str)
     if ndoc == "template" and template:
         from snippet import snippets, insert
         if snippets.text(template):
             insert.insert(template, self.currentView())
             d.setUndoRedoEnabled(False)
             d.setUndoRedoEnabled(True) # d.clearUndoRedoStacks() only in Qt >= 4.7
             d.setModified(False)
     elif ndoc == "version":
         import lilypondinfo
         d.setPlainText('\\version "{0}"\n\n'.format(lilypondinfo.preferred().versionString()))
         d.setModified(False)