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(
|
ret = StudyDeck(
|
||||||
self.mw, current=current, accept=_("Choose"),
|
self.mw, current=current, accept=_("Choose"),
|
||||||
title=_("Choose Deck"), help="addingnotes",
|
title=_("Choose Deck"), help="addingnotes",
|
||||||
cancel=False, parent=self.widget)
|
cancel=False, parent=self.widget, geomKey="selectDeck")
|
||||||
self.deck.setText(ret.name)
|
self.deck.setText(ret.name)
|
||||||
|
|
||||||
def selectedId(self):
|
def selectedId(self):
|
||||||
|
@ -69,7 +69,7 @@ class ModelChooser(QHBoxLayout):
|
|||||||
self.mw, names=nameFunc,
|
self.mw, names=nameFunc,
|
||||||
accept=_("Choose"), title=_("Choose Note Type"),
|
accept=_("Choose"), title=_("Choose Note Type"),
|
||||||
help="_notes", current=current, parent=self.widget,
|
help="_notes", current=current, parent=self.widget,
|
||||||
buttons=[edit], cancel=True)
|
buttons=[edit], cancel=True, geomKey="selectModel")
|
||||||
if not ret.name:
|
if not ret.name:
|
||||||
return
|
return
|
||||||
m = self.deck.models.byName(ret.name)
|
m = self.deck.models.byName(ret.name)
|
||||||
|
@ -4,13 +4,13 @@
|
|||||||
|
|
||||||
from aqt.qt import *
|
from aqt.qt import *
|
||||||
import aqt
|
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
|
from anki.hooks import addHook, remHook
|
||||||
|
|
||||||
class StudyDeck(QDialog):
|
class StudyDeck(QDialog):
|
||||||
def __init__(self, mw, names=None, accept=None, title=None,
|
def __init__(self, mw, names=None, accept=None, title=None,
|
||||||
help="studydeck", current=None, cancel=True,
|
help="studydeck", current=None, cancel=True,
|
||||||
parent=None, dyn=False, buttons=[]):
|
parent=None, dyn=False, buttons=[], geomKey="default"):
|
||||||
QDialog.__init__(self, parent or mw)
|
QDialog.__init__(self, parent or mw)
|
||||||
self.mw = mw
|
self.mw = mw
|
||||||
self.form = aqt.forms.studydeck.Ui_Dialog()
|
self.form = aqt.forms.studydeck.Ui_Dialog()
|
||||||
@ -18,6 +18,8 @@ class StudyDeck(QDialog):
|
|||||||
self.form.filter.installEventFilter(self)
|
self.form.filter.installEventFilter(self)
|
||||||
self.cancel = cancel
|
self.cancel = cancel
|
||||||
addHook('reset', self.onReset)
|
addHook('reset', self.onReset)
|
||||||
|
self.geomKey = "studyDeck-"+geomKey
|
||||||
|
restoreGeom(self, self.geomKey)
|
||||||
if not cancel:
|
if not cancel:
|
||||||
self.form.buttonBox.removeButton(
|
self.form.buttonBox.removeButton(
|
||||||
self.form.buttonBox.button(QDialogButtonBox.Cancel))
|
self.form.buttonBox.button(QDialogButtonBox.Cancel))
|
||||||
@ -106,6 +108,7 @@ class StudyDeck(QDialog):
|
|||||||
self.redraw(self.filt, self.focus)
|
self.redraw(self.filt, self.focus)
|
||||||
|
|
||||||
def accept(self):
|
def accept(self):
|
||||||
|
saveGeom(self, self.geomKey)
|
||||||
remHook('reset', self.onReset)
|
remHook('reset', self.onReset)
|
||||||
row = self.form.list.currentRow()
|
row = self.form.list.currentRow()
|
||||||
if row < 0:
|
if row < 0:
|
||||||
|
Loading…
Reference in New Issue
Block a user