コード例 #1
0
ファイル: MainControl.py プロジェクト: Ebolon/pynal
 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)
コード例 #2
0
ファイル: MainControl.py プロジェクト: Ebolon/pynal
    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()