def open_file(self): """ Open a dialog to let the user choose pdf files and open them in tabs. """ #TODO: Move filter to a better place :D files = KFileDialog.getOpenFileNames(KUrl(), "*.pdf| PDF files") if not files: return QtGui.QApplication.setOverrideCursor(QtCore.Qt.WaitCursor) for file in files: filename = os.path.basename(str(file)) self.open_document(PynalDocument(file), filename) QtGui.QApplication.restoreOverrideCursor()
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()