def slot_session_action(action): name = action.objectName() import sessions doc = sessions.loadSession(name) or app.openUrl(QUrl()) w = mainwindow() w.setCurrentDocument(doc)
def main(): app = QApplication(sys.argv) mw = mainwindow() mw.show() # adw = addWindow() # adw.show() sys.exit(app.exec_())
def edit_preferences(): import preferences # TODO: make it possible to run Preferences without a Main Window. # Currently the Keyboard Shortcuts section needs the mainwindow to get # the current shortcuts. w = mainwindow() w.newDocument() preferences.PreferencesDialog(w).exec_()
def file_open(): filetypes = app.filetypes('.ly') caption = app.caption(_("dialog title", "Open File")) directory = app.basedir() files = QFileDialog.getOpenFileNames(None, caption, directory, filetypes)[0] if files: w = mainwindow() w.openUrls([QUrl.fromLocalFile(f) for f in files]) if not app.documents: w.cleanStart()
def file_open(): filetypes = app.filetypes('.ly') caption = app.caption(_("dialog title", "Open File")) directory = app.basedir() files = QFileDialog.getOpenFileNames(None, caption, directory, filetypes) if files: w = mainwindow() docs = [w.openUrl(QUrl.fromLocalFile(f)) for f in files] if docs: w.setCurrentDocument(docs[-1])
def file_open(): filetypes = app.filetypes(".ly") caption = app.caption(_("dialog title", "Open File")) directory = app.basedir() files = QFileDialog.getOpenFileNames(None, caption, directory, filetypes) if files: w = mainwindow() docs = [w.openUrl(QUrl.fromLocalFile(f)) for f in files] if docs: w.setCurrentDocument(docs[-1])
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)
def file_import_musicxml(): w = mainwindow() w.newDocument() import file_import file_import.FileImport.instance(w).importMusicXML()
def slot_file_open_recent_action(action): w = mainwindow() d = w.openUrl(action.url) if d: w.setCurrentDocument(d)
def file_new_with_wizard(): w = mainwindow() w.newDocument() import scorewiz scorewiz.ScoreWizard.instance(w).showDialog()
def file_new(): mainwindow().newDocument()
def start_window(): app = QtWidgets.QApplication(sys.argv) window = mainwindow() window.show() sys.exit(app.exec_())
def __init__(self): QtWidgets.QMainWindow.__init__(self) self.setupUi(self) self.openFileLogin.clicked.connect(self.loginOpenFile) self.mainWindow = mainwindow() self.newFileLogin.clicked.connect(self.loginNewFile)
def slot_file_open_recent_action(action): url = action.url w = mainwindow() w.setCurrentDocument(w.openUrl(url))
self.saveData(data) self.textEdit.append(data) self.saveData(data) def saveFile(self): fileName = QFileDialog.getSaveFileName(self, self, "Save Data", "./", "Text(*.txt);;All(*.*)") file = open(fileName, 'w') file.write(self.textEdit_new.toPlainText()) file.close() def formatData(self, getDepth=True): text = self.textEdit.toPlainText() dataList = text.split("<DateTime/>") for data in dataList: result = data[0, 32] elementList = data.split(",") if len(elementList) > 0: if getDepth == True: posM = elementList.index("M") if posM > 1: depth = elementList[posM - 1] result = result + "\n Depth : " + depth self.textEdit_new.append(result) if __name__ == '__main__': app = QApplication(sys.argv) form = mainwindow() form.show() app.exec_()
#!/usr/bin/python3 import sys from mainwindow import * argCount = len(sys.argv) mainwindow = MainWindow if argCount != 2: print("Please provide a filename: 'vymthon filename.ext'") elif argCount == 2: filepath = str(sys.argv[1]) mainwindow = mainwindow(filepath)