def save_file(self): """ Save the current document. """ tabwidget = self.window.tabWidget document = tabwidget.currentWidget() if(document is not None): filename = KFileDialog.getSaveFileName(KUrl(), "*.xoj | *.xoj - Xournal File") xournal = Xournal() xournal.save(filename, document)
def open_file(self): """ Open a dialog to let the user choose pdf files and open them in tabs. """ files = KFileDialog.getOpenFileNames(KUrl(), "*.pyn | *.pyn - Pynal File\n *.xoj | *.xoj - Xournal File\n *.pdf| *.pdf - PDF files\n * | All Files") if not files: return QtGui.QApplication.setOverrideCursor(QtCore.Qt.WaitCursor) for file in files: filename = os.path.basename(str(file)) (shortname, extension) = os.path.splitext(filename) if (extension == ".pdf"): self.open_document(PynalDocument(file), filename) elif (extension == ".xoj"): document = PynalDocument() self.open_document(document, shortname) xournal = Xournal() xournal.load(file, document) QtGui.QApplication.restoreOverrideCursor()