diff --git a/aqt/main.py b/aqt/main.py index b91d2f9f6..1b1cd3eeb 100644 --- a/aqt/main.py +++ b/aqt/main.py @@ -276,11 +276,14 @@ close the profile or restart Anki.""")) self.maybeAutoSync() - def _checkForUnclosedWidgets(self): for w in self.app.topLevelWidgets(): if w.isVisible(): - showWarning(f"Window should have been closed: {w}") + # windows with this property are safe to close immediately + if getattr(w, "silentlyClose"): + w.close() + else: + showWarning(f"Window should have been closed: {w}") def unloadProfileAndExit(self): self.unloadProfile(self.cleanupAndExit) @@ -1065,6 +1068,7 @@ will be lost. Continue?""")) def onDebug(self): d = self.debugDiag = QDialog() + d.silentlyClose = True frm = aqt.forms.debug.Ui_Dialog() frm.setupUi(d) s = self.debugDiagShort = QShortcut(QKeySequence("ctrl+return"), d) diff --git a/aqt/utils.py b/aqt/utils.py index f5a150697..85bb21f95 100644 --- a/aqt/utils.py +++ b/aqt/utils.py @@ -392,6 +392,7 @@ _tooltipLabel = None def tooltip(msg, period=3000, parent=None): global _tooltipTimer, _tooltipLabel class CustomLabel(QLabel): + silentlyClose = True def mousePressEvent(self, evt): evt.accept() self.hide()