improve recently_open menu

This commit is contained in:
ThomasV 2015-08-07 19:24:43 +02:00
parent b40f3571e8
commit 464a89ddf5
1 changed files with 6 additions and 2 deletions

View File

@ -290,6 +290,10 @@ class ElectrumWindow(QMainWindow):
return return
if not storage.file_exists: if not storage.file_exists:
self.show_message(_("File not found") + ' ' + filename) self.show_message(_("File not found") + ' ' + filename)
recent = self.config.get('recently_open', [])
if filename in recent:
recent.remove(filename)
self.config.set_key('recently_open', recent)
return return
# read wizard action # read wizard action
try: try:
@ -373,10 +377,10 @@ class ElectrumWindow(QMainWindow):
recent = self.config.get('recently_open', []) recent = self.config.get('recently_open', [])
if filename and filename not in recent: if filename and filename not in recent:
recent.insert(0, filename) recent.insert(0, filename)
recent = recent[:10] recent = recent[:5]
self.config.set_key('recently_open', recent) self.config.set_key('recently_open', recent)
self.recently_visited_menu.clear() self.recently_visited_menu.clear()
for i, k in enumerate(recent): for i, k in enumerate(sorted(recent)):
b = os.path.basename(k) b = os.path.basename(k)
def loader(k): def loader(k):
return lambda: self.load_wallet_file(k) return lambda: self.load_wallet_file(k)