This commit is contained in:
Kovid Goyal 2020-01-20 10:56:22 +05:30
parent 8c454346a2
commit ebbefb5de3
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -36,7 +36,7 @@ class HistoryMixin(object):
def initialize(self, name): def initialize(self, name):
self._name = name self._name = name
self.history = history.get(self.store_name, []) self.history = self.load_history()
self.set_separator(None) self.set_separator(None)
self.update_items_cache(self.history) self.update_items_cache(self.history)
self.setText('') self.setText('')
@ -45,6 +45,9 @@ class HistoryMixin(object):
except AttributeError: except AttributeError:
self.lineEdit().editingFinished.connect(self.save_history) self.lineEdit().editingFinished.connect(self.save_history)
def load_history(self):
return history.get(self.store_name, [])
def save_history(self): def save_history(self):
ct = unicode_type(self.text()) ct = unicode_type(self.text())
if len(ct) >= self.min_history_entry_length: if len(ct) >= self.min_history_entry_length: