--- a/eric6/QScintilla/Exporters/ExporterODT.py Fri Oct 09 17:19:29 2020 +0200 +++ b/eric6/QScintilla/Exporters/ExporterODT.py Sat Oct 10 12:20:51 2020 +0200 @@ -8,11 +8,10 @@ """ -from PyQt5.QtCore import Qt -from PyQt5.QtGui import QCursor, QTextDocument, QTextDocumentWriter -from PyQt5.QtWidgets import QApplication +from PyQt5.QtGui import QTextDocument, QTextDocumentWriter from E5Gui import E5MessageBox +from E5Gui.E5OverrideCursor import E5OverrideCursor from .ExporterBase import ExporterBase from .ExporterHTML import HTMLGenerator @@ -41,9 +40,6 @@ if not filename: return - QApplication.setOverrideCursor(QCursor(Qt.WaitCursor)) - QApplication.processEvents() - tabSize = self.editor.getEditorConfig("TabWidth") if tabSize == 0: tabSize = 4 @@ -51,23 +47,24 @@ onlyStylesUsed = Preferences.getEditorExporter("ODT/OnlyStylesUsed") tabs = Preferences.getEditorExporter("ODT/UseTabs") - # generate HTML of the source - generator = HTMLGenerator(self.editor) - html = generator.generate( - tabSize=tabSize, - useTabs=tabs, - wysiwyg=wysiwyg, - folding=False, - onlyStylesUsed=onlyStylesUsed, - titleFullPath=False - ) + with E5OverrideCursor(): + # generate HTML of the source + generator = HTMLGenerator(self.editor) + html = generator.generate( + tabSize=tabSize, + useTabs=tabs, + wysiwyg=wysiwyg, + folding=False, + onlyStylesUsed=onlyStylesUsed, + titleFullPath=False + ) + + # convert HTML to ODT + doc = QTextDocument() + doc.setHtml(html) + writer = QTextDocumentWriter(filename) + ok = writer.write(doc) - # convert HTML to ODT - doc = QTextDocument() - doc.setHtml(html) - writer = QTextDocumentWriter(filename) - ok = writer.write(doc) - QApplication.restoreOverrideCursor() if not ok: E5MessageBox.critical( self.editor,