From 7eabc364684233d17e2b03017c8a67d7bc305613 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Fri, 20 Sep 2013 14:51:12 +0900 Subject: [PATCH] remember window size for deck&model selection (#931) --- aqt/deckchooser.py | 2 +- aqt/modelchooser.py | 2 +- aqt/studydeck.py | 7 +++++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/aqt/deckchooser.py b/aqt/deckchooser.py index 2d0174ef1..fceff6251 100644 --- a/aqt/deckchooser.py +++ b/aqt/deckchooser.py @@ -76,7 +76,7 @@ class DeckChooser(QHBoxLayout): ret = StudyDeck( self.mw, current=current, accept=_("Choose"), title=_("Choose Deck"), help="addingnotes", - cancel=False, parent=self.widget) + cancel=False, parent=self.widget, geomKey="selectDeck") self.deck.setText(ret.name) def selectedId(self): diff --git a/aqt/modelchooser.py b/aqt/modelchooser.py index 0b04eb4b8..2d442df00 100644 --- a/aqt/modelchooser.py +++ b/aqt/modelchooser.py @@ -69,7 +69,7 @@ class ModelChooser(QHBoxLayout): self.mw, names=nameFunc, accept=_("Choose"), title=_("Choose Note Type"), help="_notes", current=current, parent=self.widget, - buttons=[edit], cancel=True) + buttons=[edit], cancel=True, geomKey="selectModel") if not ret.name: return m = self.deck.models.byName(ret.name) diff --git a/aqt/studydeck.py b/aqt/studydeck.py index 633afafec..81a96e477 100644 --- a/aqt/studydeck.py +++ b/aqt/studydeck.py @@ -4,13 +4,13 @@ from aqt.qt import * import aqt -from aqt.utils import showInfo, openHelp, getOnlyText, shortcut +from aqt.utils import showInfo, openHelp, getOnlyText, shortcut, restoreGeom, saveGeom from anki.hooks import addHook, remHook class StudyDeck(QDialog): def __init__(self, mw, names=None, accept=None, title=None, help="studydeck", current=None, cancel=True, - parent=None, dyn=False, buttons=[]): + parent=None, dyn=False, buttons=[], geomKey="default"): QDialog.__init__(self, parent or mw) self.mw = mw self.form = aqt.forms.studydeck.Ui_Dialog() @@ -18,6 +18,8 @@ class StudyDeck(QDialog): self.form.filter.installEventFilter(self) self.cancel = cancel addHook('reset', self.onReset) + self.geomKey = "studyDeck-"+geomKey + restoreGeom(self, self.geomKey) if not cancel: self.form.buttonBox.removeButton( self.form.buttonBox.button(QDialogButtonBox.Cancel)) @@ -106,6 +108,7 @@ class StudyDeck(QDialog): self.redraw(self.filt, self.focus) def accept(self): + saveGeom(self, self.geomKey) remHook('reset', self.onReset) row = self.form.list.currentRow() if row < 0: