From ebbefb5de3799fbd55061a2668317d552c27660c Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 20 Jan 2020 10:56:22 +0530 Subject: [PATCH] DRYer --- src/calibre/gui2/widgets2.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/calibre/gui2/widgets2.py b/src/calibre/gui2/widgets2.py index 92f6d31f03..9f2401beb4 100644 --- a/src/calibre/gui2/widgets2.py +++ b/src/calibre/gui2/widgets2.py @@ -36,7 +36,7 @@ class HistoryMixin(object): def initialize(self, name): self._name = name - self.history = history.get(self.store_name, []) + self.history = self.load_history() self.set_separator(None) self.update_items_cache(self.history) self.setText('') @@ -45,6 +45,9 @@ class HistoryMixin(object): except AttributeError: self.lineEdit().editingFinished.connect(self.save_history) + def load_history(self): + return history.get(self.store_name, []) + def save_history(self): ct = unicode_type(self.text()) if len(ct) >= self.min_history_entry_length: