commit 1e030706cb96f19a7e55dbc01acae48b91b0ce14
parent 3cd088b2e6dcf1a46a47de72d39d466dcf5e6e87
Author: Neil Booth <kyuupichan@gmail.com>
Date: Fri, 22 Jan 2016 19:48:04 +0900
Trezor: small improvements for device initialization
Diffstat:
3 files changed, 16 insertions(+), 7 deletions(-)
diff --git a/plugins/trezor/clientbase.py b/plugins/trezor/clientbase.py
@@ -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:
diff --git a/plugins/trezor/plugin.py b/plugins/trezor/plugin.py
@@ -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:
diff --git a/plugins/trezor/qt_generic.py b/plugins/trezor/qt_generic.py
@@ -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()