Renamed save_combo_index to save_combo_index_for_session

This commit is contained in:
evandrocoan 2020-06-08 15:54:20 -03:00
parent 1d32873869
commit 38fba41fb2
2 changed files with 8 additions and 8 deletions

View file

@ -37,14 +37,14 @@ from aqt.utils import (
openHelp, openHelp,
qtMenuShortcutWorkaround, qtMenuShortcutWorkaround,
restore_combo_history, restore_combo_history,
restore_combo_index, restore_combo_index_for_session,
restore_is_checked, restore_is_checked,
restoreGeom, restoreGeom,
restoreHeader, restoreHeader,
restoreSplitter, restoreSplitter,
restoreState, restoreState,
save_combo_history, save_combo_history,
save_combo_index, save_combo_index_for_session,
save_is_checked, save_is_checked,
saveGeom, saveGeom,
saveHeader, saveHeader,
@ -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)
restore_combo_index(frm.field, allfields, combo + "Field") restore_combo_index_for_session(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,7 +1954,7 @@ update cards set usn=?, mod=?, did=? where id in """
if not r: if not r:
return return
save_combo_index(frm.field, combo + "Field") save_combo_index_for_session(frm.field, combo + "Field")
if frm.field.currentIndex() == 0: if frm.field.currentIndex() == 0:
field = None field = None
else: else:
@ -2019,7 +2019,7 @@ update cards set usn=?, mod=?, did=? where id in """
anki.find.fieldNames(self.col, downcase=False), key=lambda x: x.lower() anki.find.fieldNames(self.col, downcase=False), key=lambda x: x.lower()
) )
frm.fields.addItems(fields) frm.fields.addItems(fields)
restore_combo_index(frm.fields, fields, "findDupesFields") restore_combo_index_for_session(frm.fields, fields, "findDupesFields")
self._dupesButton = None self._dupesButton = None
# links # links
@ -2035,7 +2035,7 @@ update cards set usn=?, mod=?, did=? where id in """
def onClick(): def onClick():
search_text = save_combo_history(frm.search, searchHistory, "findDupesFind") search_text = save_combo_history(frm.search, searchHistory, "findDupesFind")
save_combo_index(frm.fields, "findDupesFields") save_combo_index_for_session(frm.fields, "findDupesFields")
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)

View file

@ -481,14 +481,14 @@ def restore_is_checked(widget, key: str):
widget.setChecked(aqt.mw.pm.profile[key]) widget.setChecked(aqt.mw.pm.profile[key])
def save_combo_index(widget: QComboBox, key: str): def save_combo_index_for_session(widget: QComboBox, key: str):
textKey = key + "ComboActiveText" textKey = key + "ComboActiveText"
indexKey = key + "ComboActiveIndex" indexKey = key + "ComboActiveIndex"
aqt.mw.pm.session[textKey] = widget.currentText() aqt.mw.pm.session[textKey] = widget.currentText()
aqt.mw.pm.session[indexKey] = widget.currentIndex() aqt.mw.pm.session[indexKey] = widget.currentIndex()
def restore_combo_index(widget: QComboBox, history: List[str], key: str): def restore_combo_index_for_session(widget: QComboBox, history: List[str], key: str):
textKey = key + "ComboActiveText" textKey = key + "ComboActiveText"
indexKey = key + "ComboActiveIndex" indexKey = key + "ComboActiveIndex"
text = aqt.mw.pm.session.get(textKey) text = aqt.mw.pm.session.get(textKey)