From 1f9598e1c7a06978da5e898d7485b87c83f76a18 Mon Sep 17 00:00:00 2001 From: ThomasV Date: Fri, 30 Jan 2015 13:44:05 +0100 Subject: [PATCH] show dialog if IOError is raised reading wallet file --- gui/qt/main_window.py | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/gui/qt/main_window.py b/gui/qt/main_window.py index 11057046..f305ca09 100644 --- a/gui/qt/main_window.py +++ b/gui/qt/main_window.py @@ -259,13 +259,14 @@ class ElectrumWindow(QMainWindow): filename = unicode( QFileDialog.getOpenFileName(self, "Select your wallet file", wallet_folder) ) if not filename: return - - storage = WalletStorage({'wallet_path': filename}) - if not storage.file_exists: - self.show_message("file not found "+ filename) + try: + storage = WalletStorage({'wallet_path': filename}) + except Exception as e: + self.show_message(str(e)) + return + if not storage.file_exists: + self.show_message(_("File not found") + ' ' + filename) return - - # read wizard action try: wallet = Wallet(storage) @@ -273,15 +274,12 @@ class ElectrumWindow(QMainWindow): QMessageBox.warning(None, _('Warning'), str(e), _('OK')) return action = wallet.get_action() - # ask for confirmation if action is not None: if not self.question(_("This file contains an incompletely created wallet.\nDo you want to complete its creation now?")): return - # close current wallet self.close_wallet() - # run wizard if action is not None: import installwizard @@ -296,7 +294,6 @@ class ElectrumWindow(QMainWindow): return else: wallet.start_threads(self.network) - # load new wallet in gui self.load_wallet(wallet)