Break out logic into a function

This commit is contained in:
Neil Booth 2015-12-31 12:16:32 +09:00
parent 3df8d11f1a
commit 441b695815
1 changed files with 7 additions and 4 deletions

View File

@ -130,6 +130,12 @@ class ElectrumGui(MessageBoxMixin):
for window in self.windows: for window in self.windows:
window.close() window.close()
def remove_from_recently_open(self, filename):
recent = self.config.get('recently_open', [])
if filename in recent:
recent.remove(filename)
self.config.set_key('recently_open', recent)
def load_wallet_file(self, filename): def load_wallet_file(self, filename):
try: try:
storage = WalletStorage(filename) storage = WalletStorage(filename)
@ -137,10 +143,7 @@ class ElectrumGui(MessageBoxMixin):
self.show_error(str(e)) self.show_error(str(e))
return return
if not storage.file_exists: if not storage.file_exists:
recent = self.config.get('recently_open', []) self.remove_from_recently_open(filename)
if filename in recent:
recent.remove(filename)
self.config.set_key('recently_open', recent)
action = 'new' action = 'new'
else: else:
try: try: