trezor: more user friendly when cannot connect
Tell the user and ask if they want to try again. If they say no, raise a silent exception. Apply this more friendly behaviour to the install wizard too (see issue #1668).
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
from sys import stdout
|
||||
import sys
|
||||
|
||||
from PyQt4.QtGui import *
|
||||
from PyQt4.QtCore import *
|
||||
@@ -14,8 +14,8 @@ from password_dialog import PasswordLayout, PW_NEW, PW_PASSPHRASE
|
||||
|
||||
from electrum.wallet import Wallet
|
||||
from electrum.mnemonic import prepare_seed
|
||||
from electrum.util import SilentException
|
||||
from electrum.wizard import (WizardBase, UserCancelled,
|
||||
from electrum.util import UserCancelled
|
||||
from electrum.wizard import (WizardBase,
|
||||
MSG_ENTER_PASSWORD, MSG_RESTORE_PASSPHRASE,
|
||||
MSG_COSIGNER, MSG_ENTER_SEED_OR_MPK,
|
||||
MSG_SHOW_MPK, MSG_VERIFY_SEED,
|
||||
@@ -119,7 +119,7 @@ class InstallWizard(QDialog, MessageBoxMixin, WizardBase):
|
||||
self.refresh_gui()
|
||||
|
||||
def on_error(self, exc_info):
|
||||
if not isinstance(exc_info[1], SilentException):
|
||||
if not isinstance(exc_info[1], UserCancelled):
|
||||
traceback.print_exception(*exc_info)
|
||||
self.show_error(str(exc_info[1]))
|
||||
|
||||
@@ -167,7 +167,7 @@ class InstallWizard(QDialog, MessageBoxMixin, WizardBase):
|
||||
self.print_error("wallet creation cancelled by user")
|
||||
self.accept() # For when called from menu
|
||||
except BaseException as e:
|
||||
self.show_error(str(e))
|
||||
self.on_error(sys.exc_info())
|
||||
raise
|
||||
return wallet
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ from electrum.i18n import _
|
||||
from electrum.util import (block_explorer, block_explorer_info, format_time,
|
||||
block_explorer_URL, format_satoshis, PrintError,
|
||||
format_satoshis_plain, NotEnoughFunds, StoreDict,
|
||||
SilentException)
|
||||
UserCancelled)
|
||||
from electrum import Transaction, mnemonic
|
||||
from electrum import util, bitcoin, commands
|
||||
from electrum import SimpleConfig, COIN_CHOOSERS, paymentrequest
|
||||
@@ -214,7 +214,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
|
||||
self.raise_()
|
||||
|
||||
def on_error(self, exc_info):
|
||||
if not isinstance(exc_info[1], SilentException):
|
||||
if not isinstance(exc_info[1], UserCancelled):
|
||||
traceback.print_exception(*exc_info)
|
||||
self.show_error(str(exc_info[1]))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user