mirror of
https://github.com/ankitects/anki.git
synced 2025-11-07 13:17:12 -05:00
Set to browser.py findreplace.ui remember the last regex/case
by creating the saveIsChecked and restoreIsChecked. https://anki.tenderapp.com/discussions/ankidesktop/39468-find-and-replace-does-not-remember-the-input-from-last-time
This commit is contained in:
parent
54d7f136cb
commit
40f98a244f
2 changed files with 19 additions and 0 deletions
|
|
@ -38,11 +38,13 @@ from aqt.utils import (
|
||||||
qtMenuShortcutWorkaround,
|
qtMenuShortcutWorkaround,
|
||||||
restoreGeom,
|
restoreGeom,
|
||||||
restoreHeader,
|
restoreHeader,
|
||||||
|
restoreIsChecked,
|
||||||
restoreSplitter,
|
restoreSplitter,
|
||||||
restoreState,
|
restoreState,
|
||||||
saveComboBoxHistory,
|
saveComboBoxHistory,
|
||||||
saveGeom,
|
saveGeom,
|
||||||
saveHeader,
|
saveHeader,
|
||||||
|
saveIsChecked,
|
||||||
saveSplitter,
|
saveSplitter,
|
||||||
saveState,
|
saveState,
|
||||||
setupComboBoxHistory,
|
setupComboBoxHistory,
|
||||||
|
|
@ -1936,6 +1938,9 @@ update cards set usn=?, mod=?, did=? where id in """
|
||||||
findhistory = setupComboBoxHistory(frm.find, combo + "Find")
|
findhistory = setupComboBoxHistory(frm.find, combo + "Find")
|
||||||
replacehistory = setupComboBoxHistory(frm.replace, combo + "Replace")
|
replacehistory = setupComboBoxHistory(frm.replace, combo + "Replace")
|
||||||
|
|
||||||
|
restoreIsChecked(frm.re, combo + "Regex")
|
||||||
|
restoreIsChecked(frm.ignoreCase, combo + "ignoreCase")
|
||||||
|
|
||||||
frm.find.setFocus()
|
frm.find.setFocus()
|
||||||
frm.field.addItems([_("All Fields")] + fields)
|
frm.field.addItems([_("All Fields")] + fields)
|
||||||
qconnect(frm.buttonBox.helpRequested, self.onFindReplaceHelp)
|
qconnect(frm.buttonBox.helpRequested, self.onFindReplaceHelp)
|
||||||
|
|
@ -1955,6 +1960,9 @@ update cards set usn=?, mod=?, did=? where id in """
|
||||||
regex = frm.re.isChecked()
|
regex = frm.re.isChecked()
|
||||||
nocase = frm.ignoreCase.isChecked()
|
nocase = frm.ignoreCase.isChecked()
|
||||||
|
|
||||||
|
saveIsChecked(frm.re, combo + "Regex")
|
||||||
|
saveIsChecked(frm.ignoreCase, combo + "ignoreCase")
|
||||||
|
|
||||||
self.mw.checkpoint(_("Find and Replace"))
|
self.mw.checkpoint(_("Find and Replace"))
|
||||||
# starts progress dialog as well
|
# starts progress dialog as well
|
||||||
self.model.beginReset()
|
self.model.beginReset()
|
||||||
|
|
|
||||||
|
|
@ -492,6 +492,17 @@ def restoreState(widget, key):
|
||||||
widget.restoreState(aqt.mw.pm.profile[key])
|
widget.restoreState(aqt.mw.pm.profile[key])
|
||||||
|
|
||||||
|
|
||||||
|
def saveIsChecked(widget, key):
|
||||||
|
key += "IsChecked"
|
||||||
|
aqt.mw.pm.profile[key] = widget.isChecked()
|
||||||
|
|
||||||
|
|
||||||
|
def restoreIsChecked(widget, key):
|
||||||
|
key += "IsChecked"
|
||||||
|
if aqt.mw.pm.profile.get(key) is not None:
|
||||||
|
widget.setChecked(aqt.mw.pm.profile[key])
|
||||||
|
|
||||||
|
|
||||||
def saveSplitter(widget, key):
|
def saveSplitter(widget, key):
|
||||||
key += "Splitter"
|
key += "Splitter"
|
||||||
aqt.mw.pm.profile[key] = widget.saveState()
|
aqt.mw.pm.profile[key] = widget.saveState()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue