Remove deleteLater form message boxes, and some redundant ones in tests
This commit is contained in:
@@ -316,7 +316,6 @@ class SharedData(QObject):
|
||||
if log:
|
||||
logger.info(self._lastAlert, stacklevel=2)
|
||||
alert.exec()
|
||||
alert.deleteLater()
|
||||
return
|
||||
|
||||
def warn(self, text: str, info: str = "", details: str = "", log: bool = True) -> None:
|
||||
@@ -328,7 +327,6 @@ class SharedData(QObject):
|
||||
if log:
|
||||
logger.warning(self._lastAlert, stacklevel=2)
|
||||
alert.exec()
|
||||
alert.deleteLater()
|
||||
return
|
||||
|
||||
def error(self, text: str, info: str = "", details: str = "", log: bool = True,
|
||||
@@ -343,7 +341,6 @@ class SharedData(QObject):
|
||||
if log:
|
||||
logger.error(self._lastAlert, stacklevel=2)
|
||||
alert.exec()
|
||||
alert.deleteLater()
|
||||
return
|
||||
|
||||
def question(self, text: str, info: str = "", details: str = "", warn: bool = False) -> bool:
|
||||
@@ -354,7 +351,6 @@ class SharedData(QObject):
|
||||
self._lastAlert = alert.logMessage
|
||||
alert.exec()
|
||||
isYes = alert.result() == QMessageBox.StandardButton.Yes
|
||||
alert.deleteLater()
|
||||
return isYes
|
||||
|
||||
##
|
||||
|
||||
@@ -91,7 +91,6 @@ def testDlgPreferences_Main(qtbot, monkeypatch, nwGUI, tstPaths):
|
||||
def testDlgPreferences_Actions(qtbot, monkeypatch, nwGUI):
|
||||
"""Test the preferences dialog actions."""
|
||||
monkeypatch.setattr(SHARED._spelling, "listDictionaries", lambda: [("en", "English [en]")])
|
||||
monkeypatch.setattr(GuiPreferences, "deleteLater", lambda *a: None)
|
||||
prefs = GuiPreferences(nwGUI)
|
||||
prefs.show()
|
||||
|
||||
@@ -155,7 +154,6 @@ def testDlgPreferences_Settings(qtbot, monkeypatch, nwGUI, tstPaths):
|
||||
|
||||
monkeypatch.setattr(SHARED._spelling, "listDictionaries", lambda: spelling)
|
||||
monkeypatch.setattr(CONFIG, "listLanguages", lambda *a: languages)
|
||||
monkeypatch.setattr(GuiPreferences, "deleteLater", lambda *a: None)
|
||||
|
||||
prefs = GuiPreferences(nwGUI)
|
||||
prefs.show()
|
||||
|
||||
@@ -70,7 +70,6 @@ def testToolWelcome_Main(qtbot: QtBot, monkeypatch, nwGUI, fncPath):
|
||||
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, "deleteLater", lambda *a: None)
|
||||
|
||||
CONFIG.recentProjects.update("/stuff/project_one", "Project One", 12345, 1690000000)
|
||||
CONFIG.recentProjects.update("/stuff/project_two", "Project Two", 54321, 1700000000)
|
||||
|
||||
Reference in New Issue
Block a user