diff --git a/qt/aqt/utils.py b/qt/aqt/utils.py index 8b72c4a64..66365fcfd 100644 --- a/qt/aqt/utils.py +++ b/qt/aqt/utils.py @@ -338,28 +338,6 @@ def getTag(parent, deck, question, tags="user", **kwargs): return ret -def restoreComboHistory(comboBox, name): - name += "BoxHistory" - history = aqt.mw.pm.profile.get(name, []) - comboBox.addItems(history) - comboBox.lineEdit().setText(history[0] if history else "") - comboBox.lineEdit().selectAll() - return history - - -def saveComboHistory(comboBox, history, name): - name += "BoxHistory" - text_input = comboBox.lineEdit().text() - if text_input in history: - history.remove(text_input) - history.insert(0, text_input) - history = history[:50] - comboBox.clear() - comboBox.addItems(history) - aqt.mw.pm.profile[name] = history - return text_input - - # File handling ###################################################################### @@ -520,6 +498,28 @@ def restoreComboIndex(widget, history, key): widget.setCurrentIndex(index) +def restoreComboHistory(comboBox, name): + name += "BoxHistory" + history = aqt.mw.pm.profile.get(name, []) + comboBox.addItems(history) + comboBox.lineEdit().setText(history[0] if history else "") + comboBox.lineEdit().selectAll() + return history + + +def saveComboHistory(comboBox, history, name): + name += "BoxHistory" + text_input = comboBox.lineEdit().text() + if text_input in history: + history.remove(text_input) + history.insert(0, text_input) + history = history[:50] + comboBox.clear() + comboBox.addItems(history) + aqt.mw.pm.profile[name] = history + return text_input + + def saveSplitter(widget, key): key += "Splitter" aqt.mw.pm.profile[key] = widget.saveState()