diff --git a/novelwriter/__init__.py b/novelwriter/__init__.py index a5117eb3..336634eb 100644 --- a/novelwriter/__init__.py +++ b/novelwriter/__init__.py @@ -187,7 +187,7 @@ def main(sysArgs: list | None = None): )) for errLine in errorData: logger.critical(errLine) - errApp.exec_() + errApp.exec() sys.exit(errorCode) # Finish initialising config @@ -237,6 +237,6 @@ def main(sysArgs: list | None = None): nwGUI = GuiMain() nwGUI.postLaunchTasks(cmdOpen) - sys.exit(nwApp.exec_()) + sys.exit(nwApp.exec()) # END Function main diff --git a/novelwriter/dialogs/editlabel.py b/novelwriter/dialogs/editlabel.py index 154dd390..7c08d637 100644 --- a/novelwriter/dialogs/editlabel.py +++ b/novelwriter/dialogs/editlabel.py @@ -88,7 +88,7 @@ class GuiEditLabel(QDialog): def getLabel(cls, parent: QWidget, text: str) -> tuple[str, bool]: """Pop the dialog and return the result.""" cls = GuiEditLabel(parent, text=text) - cls.exec_() + cls.exec() label = cls.itemLabel accepted = cls.result() == QDialog.Accepted cls.deleteLater() diff --git a/novelwriter/dialogs/quotes.py b/novelwriter/dialogs/quotes.py index dac6fbc3..ec7257b5 100644 --- a/novelwriter/dialogs/quotes.py +++ b/novelwriter/dialogs/quotes.py @@ -123,7 +123,7 @@ class GuiQuoteSelect(QDialog): def getQuote(cls, parent: QWidget, current: str = "") -> tuple[str, bool]: """Pop the dialog and return the result.""" cls = GuiQuoteSelect(parent, current=current) - cls.exec_() + cls.exec() quote = cls._selected accepted = cls.result() == QDialog.DialogCode.Accepted cls.deleteLater() diff --git a/novelwriter/error.py b/novelwriter/error.py index e2f10c93..ca90847f 100644 --- a/novelwriter/error.py +++ b/novelwriter/error.py @@ -197,7 +197,7 @@ def exceptionHandler(exType: type, exValue: BaseException, exTrace: TracebackTyp errMsg = NWErrorMessage(nwGUI) errMsg.setMessage(exType, exValue, exTrace) - errMsg.exec_() + errMsg.exec() try: # Try a controlled shutdown diff --git a/novelwriter/gui/doceditor.py b/novelwriter/gui/doceditor.py index 84b37036..26654124 100644 --- a/novelwriter/gui/doceditor.py +++ b/novelwriter/gui/doceditor.py @@ -1171,7 +1171,7 @@ class GuiDocEditor(QPlainTextEdit): action.triggered.connect(lambda: self._addWord(word, block)) # Execute the context menu - ctxMenu.exec_(self.viewport().mapToGlobal(pos)) + ctxMenu.exec(self.viewport().mapToGlobal(pos)) ctxMenu.deleteLater() return diff --git a/novelwriter/gui/docviewer.py b/novelwriter/gui/docviewer.py index 58cda227..724da61f 100644 --- a/novelwriter/gui/docviewer.py +++ b/novelwriter/gui/docviewer.py @@ -410,7 +410,7 @@ class GuiDocViewer(QTextBrowser): ctxMenu.addAction(mnuSelPara) # Open the context menu - ctxMenu.exec_(self.viewport().mapToGlobal(point)) + ctxMenu.exec(self.viewport().mapToGlobal(point)) ctxMenu.deleteLater() return diff --git a/novelwriter/gui/projtree.py b/novelwriter/gui/projtree.py index 8baed4c3..52131dc6 100644 --- a/novelwriter/gui/projtree.py +++ b/novelwriter/gui/projtree.py @@ -1230,7 +1230,7 @@ class GuiProjectTree(QTreeWidget): else: ctxMenu.buildSingleSelectMenu(hasChild) - ctxMenu.exec_(self.viewport().mapToGlobal(clickPos)) + ctxMenu.exec(self.viewport().mapToGlobal(clickPos)) ctxMenu.deleteLater() return True @@ -1410,7 +1410,7 @@ class GuiProjectTree(QTreeWidget): itemList.remove(tHandle) dlgMerge = GuiDocMerge(self.mainGui, tHandle, itemList) - dlgMerge.exec_() + dlgMerge.exec() if dlgMerge.result() == QDialog.DialogCode.Accepted: @@ -1480,7 +1480,7 @@ class GuiProjectTree(QTreeWidget): return False dlgSplit = GuiDocSplit(self.mainGui, tHandle) - dlgSplit.exec_() + dlgSplit.exec() if dlgSplit.result() == QDialog.DialogCode.Accepted: diff --git a/novelwriter/guimain.py b/novelwriter/guimain.py index e52219ef..8fe569c7 100644 --- a/novelwriter/guimain.py +++ b/novelwriter/guimain.py @@ -768,7 +768,7 @@ class GuiMain(QMainWindow): """Open the welcome dialog.""" dialog = GuiWelcome(self) dialog.openProjectRequest.connect(self._openProjectFromWelcome) - dialog.exec_() + dialog.exec() return @pyqtSlot() @@ -776,7 +776,7 @@ class GuiMain(QMainWindow): """Open the preferences dialog.""" dialog = GuiPreferences(self) dialog.newPreferencesReady.connect(self._processConfigChanges) - dialog.exec_() + dialog.exec() return @pyqtSlot() @@ -786,7 +786,7 @@ class GuiMain(QMainWindow): if SHARED.hasProject: dialog = GuiProjectSettings(self, gotoPage=focusTab) dialog.newProjectSettingsReady.connect(self._processProjectSettingsChanges) - dialog.exec_() + dialog.exec() return @pyqtSlot() @@ -820,7 +820,7 @@ class GuiMain(QMainWindow): if SHARED.hasProject: dialog = GuiWordList(self) dialog.newWordListReady.connect(self._processWordListChanges) - dialog.exec_() + dialog.exec() return @pyqtSlot() diff --git a/novelwriter/shared.py b/novelwriter/shared.py index af6767a6..25410871 100644 --- a/novelwriter/shared.py +++ b/novelwriter/shared.py @@ -292,7 +292,7 @@ class SharedData(QObject): self._lastAlert = alert.logMessage if log: logger.info(self._lastAlert, stacklevel=2) - alert.exec_() + alert.exec() alert.deleteLater() return @@ -304,7 +304,7 @@ class SharedData(QObject): self._lastAlert = alert.logMessage if log: logger.warning(self._lastAlert, stacklevel=2) - alert.exec_() + alert.exec() alert.deleteLater() return @@ -319,7 +319,7 @@ class SharedData(QObject): self._lastAlert = alert.logMessage if log: logger.error(self._lastAlert, stacklevel=2) - alert.exec_() + alert.exec() alert.deleteLater() return @@ -329,7 +329,7 @@ class SharedData(QObject): alert.setMessage(text, info, details) alert.setAlertType(_GuiAlert.WARN if warn else _GuiAlert.ASK, True) self._lastAlert = alert.logMessage - alert.exec_() + alert.exec() isYes = alert.result() == QMessageBox.StandardButton.Yes alert.deleteLater() return isYes diff --git a/novelwriter/tools/lipsum.py b/novelwriter/tools/lipsum.py index 3c05d99c..39dee4e0 100644 --- a/novelwriter/tools/lipsum.py +++ b/novelwriter/tools/lipsum.py @@ -129,7 +129,7 @@ class GuiLipsum(QDialog): def getLipsum(cls, parent: QWidget) -> str: """Pop the dialog and return the lipsum text.""" cls = GuiLipsum(parent) - cls.exec_() + cls.exec() text = cls.lipsumText cls.deleteLater() return text diff --git a/novelwriter/tools/manuscript.py b/novelwriter/tools/manuscript.py index 01c6801e..554ef1b9 100644 --- a/novelwriter/tools/manuscript.py +++ b/novelwriter/tools/manuscript.py @@ -385,7 +385,7 @@ class GuiManuscript(QDialog): build = self._getSelectedBuild() if isinstance(build, BuildSettings): dlgBuild = GuiManuscriptBuild(self, build) - dlgBuild.exec_() + dlgBuild.exec() # After the build is done, save build settings changes if build.changed: @@ -398,7 +398,7 @@ class GuiManuscript(QDialog): """Open the print preview dialog.""" preview = QPrintPreviewDialog(self) preview.paintRequested.connect(self.docPreview.printPreview) - preview.exec_() + preview.exec() return ## diff --git a/novelwriter/tools/welcome.py b/novelwriter/tools/welcome.py index fa2bd022..b07ac3e0 100644 --- a/novelwriter/tools/welcome.py +++ b/novelwriter/tools/welcome.py @@ -377,7 +377,7 @@ class _OpenProjectPage(QWidget): action.triggered.connect(self.openSelectedItem) action = ctxMenu.addAction(self.tr("Remove Project")) action.triggered.connect(self._deleteSelectedItem) - ctxMenu.exec_(self.mapToGlobal(pos)) + ctxMenu.exec(self.mapToGlobal(pos)) ctxMenu.deleteLater() return diff --git a/tests/conftest.py b/tests/conftest.py index 0a24ab11..9ca87f06 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -142,7 +142,7 @@ def projPath(fncPath): @pytest.fixture(scope="function") def mockGUI(qtbot, monkeypatch): """Create a mock instance of novelWriter's main GUI class.""" - monkeypatch.setattr(QMessageBox, "exec_", lambda *a: None) + monkeypatch.setattr(QMessageBox, "exec", lambda *a: None) monkeypatch.setattr(QMessageBox, "result", lambda *a: QMessageBox.Yes) gui = MockGuiMain() theme = MockTheme() @@ -154,7 +154,7 @@ def mockGUI(qtbot, monkeypatch): @pytest.fixture(scope="function") def nwGUI(qtbot, monkeypatch, functionFixture): """Create an instance of the novelWriter GUI.""" - monkeypatch.setattr(QMessageBox, "exec_", lambda *a: None) + monkeypatch.setattr(QMessageBox, "exec", lambda *a: None) monkeypatch.setattr(QMessageBox, "result", lambda *a: QMessageBox.Yes) nwGUI = main(["--testmode", f"--config={_TMP_CONF}", f"--data={_TMP_CONF}"]) diff --git a/tests/test_base/test_base_error.py b/tests/test_base/test_base_error.py index 55ba64d5..1f8c2205 100644 --- a/tests/test_base/test_base_error.py +++ b/tests/test_base/test_base_error.py @@ -72,27 +72,27 @@ def testBaseError_Handler(qtbot, monkeypatch, nwGUI): """ # Normal shutdown with monkeypatch.context() as mp: - mp.setattr(NWErrorMessage, "exec_", lambda *a: None) + mp.setattr(NWErrorMessage, "exec", lambda *a: None) mp.setattr("PyQt5.QtWidgets.QApplication.exit", lambda *a: None) exceptionHandler(Exception, "Error Message", None) # type: ignore # Should not crash when no GUI is found with monkeypatch.context() as mp: - mp.setattr(NWErrorMessage, "exec_", lambda *a: None) + mp.setattr(NWErrorMessage, "exec", lambda *a: None) mp.setattr("PyQt5.QtWidgets.QApplication.exit", lambda *a: None) mp.setattr("PyQt5.QtWidgets.QApplication.topLevelWidgets", lambda: []) exceptionHandler(Exception, "Error Message", None) # type: ignore # Should handle QApplication failing with monkeypatch.context() as mp: - mp.setattr(NWErrorMessage, "exec_", lambda *a: None) + mp.setattr(NWErrorMessage, "exec", lambda *a: None) mp.setattr("PyQt5.QtWidgets.QApplication.exit", lambda *a: None) mp.setattr("PyQt5.QtWidgets.QApplication.topLevelWidgets", causeException) exceptionHandler(Exception, "Error Message", None) # type: ignore # Should handle failing to close main GUI with monkeypatch.context() as mp: - mp.setattr(NWErrorMessage, "exec_", lambda *a: None) + mp.setattr(NWErrorMessage, "exec", lambda *a: None) mp.setattr("PyQt5.QtWidgets.QApplication.exit", lambda *a: None) mp.setattr(nwGUI, "closeMain", causeException) exceptionHandler(Exception, "Error Message", None) # type: ignore diff --git a/tests/test_base/test_base_init.py b/tests/test_base/test_base_init.py index 113286a8..5326df7c 100644 --- a/tests/test_base/test_base_init.py +++ b/tests/test_base/test_base_init.py @@ -70,7 +70,7 @@ def testBaseInit_Launch(caplog, monkeypatch, fncPath): monkeypatch.setattr("PyQt5.QtWidgets.QApplication.setApplicationVersion", lambda *a: None) monkeypatch.setattr("PyQt5.QtWidgets.QApplication.setWindowIcon", lambda *a: None) monkeypatch.setattr("PyQt5.QtWidgets.QApplication.setOrganizationDomain", lambda *a: None) - monkeypatch.setattr("PyQt5.QtWidgets.QApplication.exec_", lambda *a: 0) + monkeypatch.setattr("PyQt5.QtWidgets.QApplication.exec", lambda *a: 0) with pytest.raises(SystemExit) as ex: main([f"--config={fncPath}", f"--data={fncPath}"]) assert ex.value.code == 0 @@ -148,7 +148,7 @@ def testBaseInit_Imports(caplog, monkeypatch, fncPath): """Check import error handling.""" monkeypatch.setattr("novelwriter.guimain.GuiMain", MockGuiMain) monkeypatch.setattr("PyQt5.QtWidgets.QApplication.__init__", lambda *a: None) - monkeypatch.setattr("PyQt5.QtWidgets.QApplication.exec_", lambda *a: 0) + monkeypatch.setattr("PyQt5.QtWidgets.QApplication.exec", lambda *a: 0) monkeypatch.setattr("PyQt5.QtWidgets.QErrorMessage.__init__", lambda *a: None) monkeypatch.setattr("PyQt5.QtWidgets.QErrorMessage.resize", lambda *a: None) monkeypatch.setattr("PyQt5.QtWidgets.QErrorMessage.showMessage", lambda *a: None) diff --git a/tests/test_base/test_base_shared.py b/tests/test_base/test_base_shared.py index 2aed97c0..6cdb8dfe 100644 --- a/tests/test_base/test_base_shared.py +++ b/tests/test_base/test_base_shared.py @@ -129,7 +129,7 @@ def testBaseSharedData_Projects(monkeypatch, caplog, fncPath): @pytest.mark.base def testBaseSharedData_Alerts(qtbot, monkeypatch, caplog): """Test SharedData class alert helper functions.""" - monkeypatch.setattr(QMessageBox, "exec_", lambda *a: None) + monkeypatch.setattr(QMessageBox, "exec", lambda *a: None) monkeypatch.setattr(QMessageBox, "result", lambda *a: QMessageBox.Yes) shared = SharedData() diff --git a/tests/test_dialogs/test_dlg_dialogs.py b/tests/test_dialogs/test_dlg_dialogs.py index 7cf9d9f6..173d622c 100644 --- a/tests/test_dialogs/test_dlg_dialogs.py +++ b/tests/test_dialogs/test_dlg_dialogs.py @@ -32,7 +32,7 @@ from novelwriter.dialogs.editlabel import GuiEditLabel @pytest.mark.gui def testDlgOther_QuoteSelect(qtbot, monkeypatch, nwGUI): """Test the quote symbols dialog.""" - monkeypatch.setattr(GuiQuoteSelect, "exec_", lambda *a: None) + monkeypatch.setattr(GuiQuoteSelect, "exec", lambda *a: None) nwQuot = GuiQuoteSelect(nwGUI) nwQuot.show() @@ -68,7 +68,7 @@ def testDlgOther_QuoteSelect(qtbot, monkeypatch, nwGUI): @pytest.mark.gui def testDlgOther_EditLabel(qtbot, monkeypatch): """Test the label editor dialog.""" - monkeypatch.setattr(GuiEditLabel, "exec_", lambda *a: None) + monkeypatch.setattr(GuiEditLabel, "exec", lambda *a: None) with monkeypatch.context() as mp: mp.setattr(GuiEditLabel, "result", lambda *a: QDialog.Accepted) diff --git a/tests/test_dialogs/test_dlg_preferences.py b/tests/test_dialogs/test_dlg_preferences.py index 95d2eb59..85330f87 100644 --- a/tests/test_dialogs/test_dlg_preferences.py +++ b/tests/test_dialogs/test_dlg_preferences.py @@ -38,7 +38,7 @@ KEY_DELAY = 1 def testDlgPreferences_Main(qtbot, monkeypatch, nwGUI, tstPaths): """Test the preferences dialog loading.""" monkeypatch.setattr(SHARED._spelling, "listDictionaries", lambda: [("en", "English [en]")]) - monkeypatch.setattr(GuiPreferences, "exec_", lambda *a: None) + monkeypatch.setattr(GuiPreferences, "exec", lambda *a: None) # Load GUI with standard values nwGUI.mainMenu.aPreferences.activate(QAction.ActionEvent.Trigger) diff --git a/tests/test_dialogs/test_dlg_projectsettings.py b/tests/test_dialogs/test_dlg_projectsettings.py index 74cfd24a..20eb84fe 100644 --- a/tests/test_dialogs/test_dlg_projectsettings.py +++ b/tests/test_dialogs/test_dlg_projectsettings.py @@ -42,7 +42,7 @@ def testDlgProjSettings_Dialog(qtbot, monkeypatch, nwGUI): test, but are instead tested in the individual tab tests. """ # Block the GUI blocking thread - monkeypatch.setattr(GuiProjectSettings, "exec_", lambda *a: None) + monkeypatch.setattr(GuiProjectSettings, "exec", lambda *a: None) monkeypatch.setattr(GuiProjectSettings, "result", lambda *a: QDialog.Accepted) # Check that we cannot open when there is no project diff --git a/tests/test_dialogs/test_dlg_wordlist.py b/tests/test_dialogs/test_dlg_wordlist.py index 8f7483a2..ca9eb34a 100644 --- a/tests/test_dialogs/test_dlg_wordlist.py +++ b/tests/test_dialogs/test_dlg_wordlist.py @@ -38,7 +38,7 @@ def testDlgWordList_Dialog(qtbot, monkeypatch, nwGUI, fncPath, projPath): """test the word list editor.""" buildTestProject(nwGUI, projPath) - monkeypatch.setattr(GuiWordList, "exec_", lambda *a: None) + monkeypatch.setattr(GuiWordList, "exec", lambda *a: None) monkeypatch.setattr(GuiWordList, "result", lambda *a: QDialog.Accepted) monkeypatch.setattr(GuiWordList, "accept", lambda *a: None) diff --git a/tests/test_gui/test_gui_doceditor.py b/tests/test_gui/test_gui_doceditor.py index ca8e06e4..e2485c0e 100644 --- a/tests/test_gui/test_gui_doceditor.py +++ b/tests/test_gui/test_gui_doceditor.py @@ -244,7 +244,7 @@ def testGuiEditor_MetaData(qtbot, nwGUI, projPath, mockRnd): @pytest.mark.gui def testGuiEditor_ContextMenu(monkeypatch, qtbot, nwGUI, projPath, mockRnd): """Test the editor context menu.""" - monkeypatch.setattr(QMenu, "exec_", lambda *a: None) + monkeypatch.setattr(QMenu, "exec", lambda *a: None) buildTestProject(nwGUI, projPath) assert nwGUI.openDocument(C.hSceneDoc) is True diff --git a/tests/test_gui/test_gui_docviewer.py b/tests/test_gui/test_gui_docviewer.py index 4b3dd176..9eaf3c4a 100644 --- a/tests/test_gui/test_gui_docviewer.py +++ b/tests/test_gui/test_gui_docviewer.py @@ -146,7 +146,7 @@ def testGuiViewer_Main(qtbot, monkeypatch, nwGUI, prjLipsum): docViewer.setTextCursor(cursor) docViewer._makeSelection(QTextCursor.WordUnderCursor) with monkeypatch.context() as mp: - mp.setattr(QMenu, "exec_", mockExec) + mp.setattr(QMenu, "exec", mockExec) docViewer._openContextMenu(docViewer.cursorRect().center()) assert menuOpened diff --git a/tests/test_gui/test_gui_guimain.py b/tests/test_gui/test_gui_guimain.py index 8b8a1bd7..4de04a95 100644 --- a/tests/test_gui/test_gui_guimain.py +++ b/tests/test_gui/test_gui_guimain.py @@ -60,7 +60,7 @@ def testGuiMain_ProjectBlocker(nwGUI): @pytest.mark.gui def testGuiMain_Launch(qtbot, monkeypatch, nwGUI, projPath): """Test the handling of launch tasks.""" - monkeypatch.setattr(GuiWelcome, "exec_", lambda *a: None) + monkeypatch.setattr(GuiWelcome, "exec", lambda *a: None) CONFIG.lastNotes = "0x0" buildTestProject(nwGUI, projPath) @@ -511,7 +511,7 @@ def testGuiMain_Editing(qtbot, monkeypatch, nwGUI, projPath, tstPaths, mockRnd): assert "test" in suggest with monkeypatch.context() as mp: - mp.setattr(QMenu, "exec_", lambda *a: None) + mp.setattr(QMenu, "exec", lambda *a: None) docEditor.setCursorPosition(errPos) docEditor._openContextFromCursor() diff --git a/tests/test_gui/test_gui_i18n.py b/tests/test_gui/test_gui_i18n.py index caaf3141..941c140d 100644 --- a/tests/test_gui/test_gui_i18n.py +++ b/tests/test_gui/test_gui_i18n.py @@ -47,8 +47,8 @@ LANG_DATA = CONFIG.listLanguages(CONFIG.LANG_NW) @pytest.mark.parametrize("language", [a for a, b in LANG_DATA]) def testGuiI18n_Localisation(qtbot, monkeypatch, language, nwGUI, projPath): """Test loading the gui with a specific language.""" - monkeypatch.setattr(QDialog, "exec_", lambda *a: None) - monkeypatch.setattr(QMessageBox, "exec_", lambda *a: None) + monkeypatch.setattr(QDialog, "exec", lambda *a: None) + monkeypatch.setattr(QMessageBox, "exec", lambda *a: None) monkeypatch.setattr(QMessageBox, "result", lambda *a: QMessageBox.Yes) # Set the test language diff --git a/tests/test_gui/test_gui_projtree.py b/tests/test_gui/test_gui_projtree.py index 4934f26c..9fda0ca6 100644 --- a/tests/test_gui/test_gui_projtree.py +++ b/tests/test_gui/test_gui_projtree.py @@ -539,7 +539,7 @@ def testGuiProjTree_MergeDocuments(qtbot, monkeypatch, nwGUI, projPath, mockRnd, mergeData = {} monkeypatch.setattr(GuiDocMerge, "__init__", lambda *a: None) - monkeypatch.setattr(GuiDocMerge, "exec_", lambda *a: None) + monkeypatch.setattr(GuiDocMerge, "exec", lambda *a: None) monkeypatch.setattr(GuiDocMerge, "result", lambda *a: QDialog.Accepted) monkeypatch.setattr(GuiDocMerge, "getData", lambda *a: mergeData) @@ -640,7 +640,7 @@ def testGuiProjTree_SplitDocument(qtbot, monkeypatch, nwGUI, projPath, mockRnd, splitText = [] monkeypatch.setattr(GuiDocSplit, "__init__", lambda *a: None) - monkeypatch.setattr(GuiDocSplit, "exec_", lambda *a: None) + monkeypatch.setattr(GuiDocSplit, "exec", lambda *a: None) monkeypatch.setattr(GuiDocSplit, "result", lambda *a: QDialog.Accepted) monkeypatch.setattr(GuiDocSplit, "getData", lambda *a: (splitData, splitText)) @@ -1162,7 +1162,7 @@ def testGuiProjTree_ContextMenu(qtbot, monkeypatch, nwGUI, projPath, mockRnd): # Pop the menu with monkeypatch.context() as mp: - mp.setattr(QMenu, "exec_", lambda *a: None) + mp.setattr(QMenu, "exec", lambda *a: None) projTree.clearSelection() # No item under menu diff --git a/tests/test_tools/test_tools_lipsum.py b/tests/test_tools/test_tools_lipsum.py index cc4f8b18..b2ecc445 100644 --- a/tests/test_tools/test_tools_lipsum.py +++ b/tests/test_tools/test_tools_lipsum.py @@ -60,7 +60,7 @@ def testToolLipsum_Main(qtbot, monkeypatch, nwGUI, projPath, mockRnd): assert nwGUI.openDocument(C.hSceneDoc) is True nwGUI.docEditor.setCursorLine(3) with monkeypatch.context() as mp: - mp.setattr(GuiLipsum, "exec_", lambda *a: None) + mp.setattr(GuiLipsum, "exec", lambda *a: None) mp.setattr(GuiLipsum, "lipsumText", "FooBar") nwGUI.mainMenu.aLipsumText.activate(QAction.Trigger) assert nwGUI.docEditor.getText() == "### New Scene\n\nFooBar" diff --git a/tests/test_tools/test_tools_manuscript.py b/tests/test_tools/test_tools_manuscript.py index 374bafa0..f3a6ff13 100644 --- a/tests/test_tools/test_tools_manuscript.py +++ b/tests/test_tools/test_tools_manuscript.py @@ -278,7 +278,7 @@ def testManuscript_Features(monkeypatch, qtbot, nwGUI, projPath, mockRnd): build._changed = True manus.buildList.clearSelection() with monkeypatch.context() as mp: - mp.setattr("novelwriter.tools.manusbuild.GuiManuscriptBuild.exec_", lambda *a: None) + mp.setattr("novelwriter.tools.manusbuild.GuiManuscriptBuild.exec", lambda *a: None) manus.buildList.setCurrentRow(0) manus.btnBuild.click() @@ -313,7 +313,7 @@ def testManuscript_Print(monkeypatch, qtbot: QtBot, nwGUI: GuiMain, projPath: Pa assert manus.docPreview.toPlainText().strip() != "" with monkeypatch.context() as mp: - mp.setattr(QPrintPreviewDialog, "exec_", lambda *a: None) + mp.setattr(QPrintPreviewDialog, "exec", lambda *a: None) manus.btnPrint.click() for obj in manus.children(): if isinstance(obj, QPrintPreviewDialog): diff --git a/tests/test_tools/test_tools_welcome.py b/tests/test_tools/test_tools_welcome.py index 29900674..1603007c 100644 --- a/tests/test_tools/test_tools_welcome.py +++ b/tests/test_tools/test_tools_welcome.py @@ -70,7 +70,7 @@ def testToolWelcome_Main(qtbot: QtBot, monkeypatch, nwGUI, fncPath): @pytest.mark.gui def testToolWelcome_Open(qtbot: QtBot, monkeypatch, nwGUI, fncPath): """Test the open tab in the Welcome window.""" - monkeypatch.setattr(QMenu, "exec_", lambda *a: None) + monkeypatch.setattr(QMenu, "exec", lambda *a: None) monkeypatch.setattr(QMenu, "deleteLater", lambda *a: None) CONFIG.recentProjects.update("/stuff/project_one", "Project One", 12345, 1690000000)