Trezor: small improvements for device initialization
This commit is contained in:
parent
3cd088b2e6
commit
1e030706cb
|
@ -59,10 +59,11 @@ class GuiMixin(object):
|
|||
return self.proto.PassphraseAck(passphrase=passphrase)
|
||||
|
||||
def callback_WordRequest(self, msg):
|
||||
msg = _("Enter seed word as explained on your %s") % self.device
|
||||
self.step += 1
|
||||
msg = _("Step %d/24. Enter seed word as explained on "
|
||||
"your %s") % (self.step, self.device)
|
||||
word = self.handler.get_word(msg)
|
||||
if word is None:
|
||||
return self.proto.Cancel()
|
||||
# Unfortunately the device can't handle self.proto.Cancel()
|
||||
return self.proto.WordAck(word=word)
|
||||
|
||||
|
||||
|
@ -172,8 +173,7 @@ class TrezorClientBase(GuiMixin, PrintError):
|
|||
|
||||
@staticmethod
|
||||
def wrapper(func):
|
||||
'''Wrap base class methods to show exceptions and clear
|
||||
any dialog box it opened.'''
|
||||
'''Wrap methods to clear any message box they opened.'''
|
||||
|
||||
def wrapped(self, *args, **kwargs):
|
||||
try:
|
||||
|
|
|
@ -283,6 +283,15 @@ class TrezorCompatiblePlugin(BasePlugin, ThreadJob):
|
|||
(item, label, pin_protection, passphrase_protection) \
|
||||
= wallet.handler.request_trezor_init_settings(method, self.device)
|
||||
|
||||
if method == TIM_RECOVER:
|
||||
# Warn user about firmware lameness
|
||||
wallet.handler.show_error(_(
|
||||
"You will be asked to enter 24 words regardless of your "
|
||||
"seed's actual length. If you enter a word incorrectly or "
|
||||
"misspell it, you cannot change it or go back - you will need "
|
||||
"to start again from the beginning.\n\nSo please enter "
|
||||
"the words carefully!"))
|
||||
|
||||
language = 'english'
|
||||
|
||||
def initialize_device():
|
||||
|
@ -294,6 +303,7 @@ class TrezorCompatiblePlugin(BasePlugin, ThreadJob):
|
|||
pin_protection, label, language)
|
||||
elif method == TIM_RECOVER:
|
||||
word_count = 6 * (item + 2) # 12, 18 or 24
|
||||
client.step = 0
|
||||
client.recovery_device(word_count, passphrase_protection,
|
||||
pin_protection, label, language)
|
||||
elif method == TIM_MNEMONIC:
|
||||
|
|
|
@ -112,8 +112,7 @@ class QtHandler(PrintError):
|
|||
text.returnPressed.connect(dialog.accept)
|
||||
hbox.addWidget(text)
|
||||
hbox.addStretch(1)
|
||||
if not dialog.exec_():
|
||||
return None
|
||||
dialog.exec_() # Firmware cannot handle cancellation
|
||||
self.word = unicode(text.text())
|
||||
self.done.set()
|
||||
|
||||
|
|
Loading…
Reference in New Issue