show dialog if IOError is raised reading wallet file
This commit is contained in:
parent
3b9f9d5320
commit
1f9598e1c7
|
@ -259,13 +259,14 @@ class ElectrumWindow(QMainWindow):
|
||||||
filename = unicode( QFileDialog.getOpenFileName(self, "Select your wallet file", wallet_folder) )
|
filename = unicode( QFileDialog.getOpenFileName(self, "Select your wallet file", wallet_folder) )
|
||||||
if not filename:
|
if not filename:
|
||||||
return
|
return
|
||||||
|
try:
|
||||||
storage = WalletStorage({'wallet_path': filename})
|
storage = WalletStorage({'wallet_path': filename})
|
||||||
if not storage.file_exists:
|
except Exception as e:
|
||||||
self.show_message("file not found "+ filename)
|
self.show_message(str(e))
|
||||||
|
return
|
||||||
|
if not storage.file_exists:
|
||||||
|
self.show_message(_("File not found") + ' ' + filename)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
# read wizard action
|
# read wizard action
|
||||||
try:
|
try:
|
||||||
wallet = Wallet(storage)
|
wallet = Wallet(storage)
|
||||||
|
@ -273,15 +274,12 @@ class ElectrumWindow(QMainWindow):
|
||||||
QMessageBox.warning(None, _('Warning'), str(e), _('OK'))
|
QMessageBox.warning(None, _('Warning'), str(e), _('OK'))
|
||||||
return
|
return
|
||||||
action = wallet.get_action()
|
action = wallet.get_action()
|
||||||
|
|
||||||
# ask for confirmation
|
# ask for confirmation
|
||||||
if action is not None:
|
if action is not None:
|
||||||
if not self.question(_("This file contains an incompletely created wallet.\nDo you want to complete its creation now?")):
|
if not self.question(_("This file contains an incompletely created wallet.\nDo you want to complete its creation now?")):
|
||||||
return
|
return
|
||||||
|
|
||||||
# close current wallet
|
# close current wallet
|
||||||
self.close_wallet()
|
self.close_wallet()
|
||||||
|
|
||||||
# run wizard
|
# run wizard
|
||||||
if action is not None:
|
if action is not None:
|
||||||
import installwizard
|
import installwizard
|
||||||
|
@ -296,7 +294,6 @@ class ElectrumWindow(QMainWindow):
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
wallet.start_threads(self.network)
|
wallet.start_threads(self.network)
|
||||||
|
|
||||||
# load new wallet in gui
|
# load new wallet in gui
|
||||||
self.load_wallet(wallet)
|
self.load_wallet(wallet)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue