don't throw an error when closing with tooltip or debug window open
This commit is contained in:
parent
3b9ac82a32
commit
7b1747d650
@ -276,10 +276,13 @@ close the profile or restart Anki."""))
|
||||
|
||||
self.maybeAutoSync()
|
||||
|
||||
|
||||
def _checkForUnclosedWidgets(self):
|
||||
for w in self.app.topLevelWidgets():
|
||||
if w.isVisible():
|
||||
# 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):
|
||||
@ -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)
|
||||
|
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user