From 4eba1c1d8a10e8a35bc8b2202a6e745198427f86 Mon Sep 17 00:00:00 2001 From: Neil Booth Date: Thu, 14 Jan 2016 07:40:46 +0900 Subject: [PATCH] Wizard: fixes for hardware wallet initialization --- plugins/trezor/qt_generic.py | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/plugins/trezor/qt_generic.py b/plugins/trezor/qt_generic.py index ffadfcdc..64fd11cf 100644 --- a/plugins/trezor/qt_generic.py +++ b/plugins/trezor/qt_generic.py @@ -6,7 +6,7 @@ from PyQt4.Qt import Qt from PyQt4.Qt import QGridLayout, QInputDialog, QPushButton from PyQt4.Qt import QVBoxLayout, QLabel, SIGNAL from electrum_gui.qt.main_window import StatusBarButton -from electrum_gui.qt.password_dialog import PasswordDialog +from electrum_gui.qt.password_dialog import PasswordDialog, PW_PASSPHRASE from electrum_gui.qt.util import * from .plugin import TrezorCompatiblePlugin, TIM_NEW, TIM_RECOVER, TIM_MNEMONIC @@ -85,8 +85,7 @@ class QtHandler(PrintError): self.done.set() def passphrase_dialog(self, msg): - d = PasswordDialog(self.top_level_window(), None, msg, - PasswordDialog.PW_PASSPHRASE) + d = PasswordDialog(self.top_level_window(), None, msg, PW_PASSPHRASE) confirmed, p, passphrase = d.run() if confirmed: passphrase = BIP44_Wallet.normalize_passphrase(passphrase) @@ -135,9 +134,7 @@ class QtHandler(PrintError): wizard = self.win vbox = QVBoxLayout() - main_label = QLabel(_("Initialization settings for your %s:") % device) - vbox.addWidget(main_label) - OK_button = OkButton(wizard, _('Next')) + next_enabled=True def clean_text(widget): text = unicode(widget.toPlainText()).strip() @@ -172,9 +169,9 @@ class QtHandler(PrintError): else: msg = _("Enter the master private key beginning with xprv:") def set_enabled(): - OK_button.setEnabled(Wallet.is_xprv(clean_text(text))) + wizard.next_button.setEnabled(Wallet.is_xprv(clean_text(text))) text.textChanged.connect(set_enabled) - OK_button.setEnabled(False) + next_enabled = False vbox.addWidget(QLabel(msg)) vbox.addWidget(text) @@ -203,12 +200,8 @@ class QtHandler(PrintError): cb_phrase.setChecked(False) vbox.addWidget(cb_phrase) - vbox.addStretch(1) - vbox.addLayout(Buttons(CancelButton(wizard), OK_button)) - - wizard.set_layout(vbox) - if not wizard.exec_(): - raise UserCancelled + title = _("Initialization settings for your %s:") % device + wizard.set_main_layout(vbox, next_enabled=next_enabled, title=title) if method in [TIM_NEW, TIM_RECOVER]: item = bg.checkedId()