remember window size for deck&model selection (#931)
This commit is contained in:
parent
2fff30db2f
commit
7eabc36468
@ -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):
|
||||
|
@ -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)
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user