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