ensure only one copy of stats shown, and close with collection

This commit is contained in:
Damien Elmes 2017-06-22 16:49:53 +10:00
parent 34dcf64d76
commit aeaf9df32f
3 changed files with 7 additions and 2 deletions

View File

@ -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):

View File

@ -734,7 +734,7 @@ title="%s" %s>%s</button>''' % (
deck = self._selectedDeck()
if not deck:
return
aqt.stats.DeckStats(self)
aqt.dialogs.open("DeckStats", self)
def onPrefs(self):
import aqt.preferences

View File

@ -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):