Renamed setupComboBoxHistory to restoreComboHisotory,
saveComboActiveIndex to saveComboIndex, saveComboBoxHistory to saveComboHistory and restoreComboActiveIndex to restoreComboIndex.
This commit is contained in:
parent
a78b3d522e
commit
6047c6ecc0
@ -36,20 +36,20 @@ from aqt.utils import (
|
||||
getTag,
|
||||
openHelp,
|
||||
qtMenuShortcutWorkaround,
|
||||
restoreComboActiveIndex,
|
||||
restoreComboHistory,
|
||||
restoreComboIndex,
|
||||
restoreGeom,
|
||||
restoreHeader,
|
||||
restoreIsChecked,
|
||||
restoreSplitter,
|
||||
restoreState,
|
||||
saveComboActiveIndex,
|
||||
saveComboBoxHistory,
|
||||
saveComboHistory,
|
||||
saveComboIndex,
|
||||
saveGeom,
|
||||
saveHeader,
|
||||
saveIsChecked,
|
||||
saveSplitter,
|
||||
saveState,
|
||||
setupComboBoxHistory,
|
||||
shortcut,
|
||||
showInfo,
|
||||
showWarning,
|
||||
@ -1937,8 +1937,8 @@ update cards set usn=?, mod=?, did=? where id in """
|
||||
d.setWindowModality(Qt.WindowModal)
|
||||
|
||||
combo = "BrowserFindAndReplace"
|
||||
findhistory = setupComboBoxHistory(frm.find, combo + "Find")
|
||||
replacehistory = setupComboBoxHistory(frm.replace, combo + "Replace")
|
||||
findhistory = restoreComboHistory(frm.find, combo + "Find")
|
||||
replacehistory = restoreComboHistory(frm.replace, combo + "Replace")
|
||||
|
||||
restoreIsChecked(frm.re, combo + "Regex")
|
||||
restoreIsChecked(frm.ignoreCase, combo + "ignoreCase")
|
||||
@ -1946,7 +1946,7 @@ update cards set usn=?, mod=?, did=? where id in """
|
||||
frm.find.setFocus()
|
||||
allfields = [_("All Fields")] + fields
|
||||
frm.field.addItems(allfields)
|
||||
restoreComboActiveIndex(frm.field, allfields, combo + "Field")
|
||||
restoreComboIndex(frm.field, allfields, combo + "Field")
|
||||
qconnect(frm.buttonBox.helpRequested, self.onFindReplaceHelp)
|
||||
restoreGeom(d, "findreplace")
|
||||
r = d.exec_()
|
||||
@ -1954,14 +1954,14 @@ update cards set usn=?, mod=?, did=? where id in """
|
||||
if not r:
|
||||
return
|
||||
|
||||
saveComboActiveIndex(frm.field, combo + "Field")
|
||||
saveComboIndex(frm.field, combo + "Field")
|
||||
if frm.field.currentIndex() == 0:
|
||||
field = None
|
||||
else:
|
||||
field = fields[frm.field.currentIndex() - 1]
|
||||
|
||||
search = saveComboBoxHistory(frm.find, findhistory, combo + "Find")
|
||||
replace = saveComboBoxHistory(frm.replace, replacehistory, combo + "Replace")
|
||||
search = saveComboHistory(frm.find, findhistory, combo + "Find")
|
||||
replace = saveComboHistory(frm.replace, replacehistory, combo + "Replace")
|
||||
|
||||
regex = frm.re.isChecked()
|
||||
nocase = frm.ignoreCase.isChecked()
|
||||
@ -2013,7 +2013,7 @@ update cards set usn=?, mod=?, did=? where id in """
|
||||
frm = aqt.forms.finddupes.Ui_Dialog()
|
||||
frm.setupUi(d)
|
||||
restoreGeom(d, "findDupes")
|
||||
searchHistory = setupComboBoxHistory(frm.search, "findDupesFind")
|
||||
searchHistory = restoreComboHistory(frm.search, "findDupesFind")
|
||||
|
||||
fields = sorted(
|
||||
anki.find.fieldNames(self.col, downcase=False), key=lambda x: x.lower()
|
||||
@ -2032,7 +2032,7 @@ update cards set usn=?, mod=?, did=? where id in """
|
||||
qconnect(d.finished, onFin)
|
||||
|
||||
def onClick():
|
||||
search_text = saveComboBoxHistory(frm.search, searchHistory, "findDupesFind")
|
||||
search_text = saveComboHistory(frm.search, searchHistory, "findDupesFind")
|
||||
field = fields[frm.fields.currentIndex()]
|
||||
self.duplicatesReport(frm.webView, field, search_text, frm, web_context)
|
||||
|
||||
|
@ -338,7 +338,7 @@ def getTag(parent, deck, question, tags="user", **kwargs):
|
||||
return ret
|
||||
|
||||
|
||||
def setupComboBoxHistory(comboBox, name):
|
||||
def restoreComboHistory(comboBox, name):
|
||||
name += "BoxHistory"
|
||||
history = aqt.mw.pm.profile.get(name, [])
|
||||
comboBox.addItems(history)
|
||||
@ -347,7 +347,7 @@ def setupComboBoxHistory(comboBox, name):
|
||||
return history
|
||||
|
||||
|
||||
def saveComboBoxHistory(comboBox, history, name):
|
||||
def saveComboHistory(comboBox, history, name):
|
||||
name += "BoxHistory"
|
||||
text_input = comboBox.lineEdit().text()
|
||||
if text_input in history:
|
||||
@ -503,14 +503,14 @@ def restoreIsChecked(widget, key):
|
||||
widget.setChecked(aqt.mw.pm.profile[key])
|
||||
|
||||
|
||||
def saveComboActiveIndex(widget, key):
|
||||
def saveComboIndex(widget, key):
|
||||
textKey = key + "ComboActiveText"
|
||||
indexKey = key + "ComboActiveIndex"
|
||||
aqt.mw.pm.profile[textKey] = widget.currentText()
|
||||
aqt.mw.pm.profile[indexKey] = widget.currentIndex()
|
||||
|
||||
|
||||
def restoreComboActiveIndex(widget, history, key):
|
||||
def restoreComboIndex(widget, history, key):
|
||||
textKey = key + "ComboActiveText"
|
||||
indexKey = key + "ComboActiveIndex"
|
||||
text = aqt.mw.pm.profile.get(textKey)
|
||||
|
Loading…
Reference in New Issue
Block a user