1
0

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:
Neil Booth
2016-02-06 19:51:39 +09:00
parent 317e6cea32
commit 16397b1ed7
9 changed files with 51 additions and 44 deletions

View File

@@ -1,7 +1,7 @@
from sys import stderr
from electrum.i18n import _
from electrum.util import PrintError, SilentException
from electrum.util import PrintError, UserCancelled
class GuiMixin(object):
@@ -27,7 +27,7 @@ class GuiMixin(object):
# gets old very quickly, so we suppress those.
if msg.code in (self.types.Failure_PinCancelled,
self.types.Failure_ActionCancelled):
raise SilentException()
raise UserCancelled()
raise RuntimeError(msg.message)
def callback_ButtonRequest(self, msg):

View File

@@ -220,8 +220,6 @@ class TrezorCompatiblePlugin(HW_PluginBase):
process. Then create the wallet accounts.'''
devmgr = self.device_manager()
device_info = devmgr.select_device(wallet, self)
if not device_info:
raise RuntimeError(_("No devices found"))
devmgr.pair_wallet(wallet, device_info.device.id_)
if device_info.initialized:
task = partial(wallet.create_hd_account, None)

View File

@@ -11,9 +11,8 @@ from ..hw_wallet.qt import QtHandlerBase
from electrum.i18n import _
from electrum.plugins import hook, DeviceMgr
from electrum.util import PrintError
from electrum.util import PrintError, UserCancelled
from electrum.wallet import Wallet, BIP44_Wallet
from electrum.wizard import UserCancelled
PASSPHRASE_HELP_SHORT =_(
"Passphrases allow you to access new wallets, each "
@@ -317,10 +316,7 @@ def qt_plugin_class(base_plugin_class):
device_id = self.device_manager().wallet_id(window.wallet)
if not device_id:
info = self.device_manager().select_device(window.wallet, self)
if info:
device_id = info.device.id_
else:
window.wallet.handler.show_error(_("No devices found"))
device_id = info.device.id_
return device_id
def query_choice(self, window, msg, choices):