diff --git a/aqt/__init__.py b/aqt/__init__.py index c93beed41..356d2e401 100644 --- a/aqt/__init__.py +++ b/aqt/__init__.py @@ -44,11 +44,12 @@ from anki.utils import checksum class DialogManager: def __init__(self): - from aqt import addcards, browser, editcurrent + from aqt import addcards, browser, editcurrent, stats self._dialogs = { "AddCards": [addcards.AddCards, None], "Browser": [browser.Browser, None], "EditCurrent": [editcurrent.EditCurrent, None], + "DeckStats": [stats.DeckStats, None] } def open(self, name, *args): diff --git a/aqt/main.py b/aqt/main.py index 416953449..dd77f53a6 100644 --- a/aqt/main.py +++ b/aqt/main.py @@ -734,7 +734,7 @@ title="%s" %s>%s''' % ( deck = self._selectedDeck() if not deck: return - aqt.stats.DeckStats(self) + aqt.dialogs.open("DeckStats", self) def onPrefs(self): import aqt.preferences diff --git a/aqt/stats.py b/aqt/stats.py index f11530fcd..036481793 100644 --- a/aqt/stats.py +++ b/aqt/stats.py @@ -42,8 +42,12 @@ class DeckStats(QDialog): self.show() self.activateWindow() + def canClose(self): + return True + def reject(self): saveGeom(self, self.name) + aqt.dialogs.close("DeckStats") QDialog.reject(self) def _imagePath(self):