remember window size for deck&model selection (#931)

This commit is contained in:
Damien Elmes 2013-09-20 14:51:12 +09:00
parent 2fff30db2f
commit 7eabc36468
3 changed files with 7 additions and 4 deletions

View File

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

View File

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

View File

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