mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-31 17:31:36 +00:00
Wizard: fixes for hardware wallet initialization
This commit is contained in:
parent
5cb18f95de
commit
4eba1c1d8a
1 changed files with 7 additions and 14 deletions
|
@ -6,7 +6,7 @@ from PyQt4.Qt import Qt
|
||||||
from PyQt4.Qt import QGridLayout, QInputDialog, QPushButton
|
from PyQt4.Qt import QGridLayout, QInputDialog, QPushButton
|
||||||
from PyQt4.Qt import QVBoxLayout, QLabel, SIGNAL
|
from PyQt4.Qt import QVBoxLayout, QLabel, SIGNAL
|
||||||
from electrum_gui.qt.main_window import StatusBarButton
|
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 electrum_gui.qt.util import *
|
||||||
from .plugin import TrezorCompatiblePlugin, TIM_NEW, TIM_RECOVER, TIM_MNEMONIC
|
from .plugin import TrezorCompatiblePlugin, TIM_NEW, TIM_RECOVER, TIM_MNEMONIC
|
||||||
|
|
||||||
|
@ -85,8 +85,7 @@ class QtHandler(PrintError):
|
||||||
self.done.set()
|
self.done.set()
|
||||||
|
|
||||||
def passphrase_dialog(self, msg):
|
def passphrase_dialog(self, msg):
|
||||||
d = PasswordDialog(self.top_level_window(), None, msg,
|
d = PasswordDialog(self.top_level_window(), None, msg, PW_PASSPHRASE)
|
||||||
PasswordDialog.PW_PASSPHRASE)
|
|
||||||
confirmed, p, passphrase = d.run()
|
confirmed, p, passphrase = d.run()
|
||||||
if confirmed:
|
if confirmed:
|
||||||
passphrase = BIP44_Wallet.normalize_passphrase(passphrase)
|
passphrase = BIP44_Wallet.normalize_passphrase(passphrase)
|
||||||
|
@ -135,9 +134,7 @@ class QtHandler(PrintError):
|
||||||
wizard = self.win
|
wizard = self.win
|
||||||
|
|
||||||
vbox = QVBoxLayout()
|
vbox = QVBoxLayout()
|
||||||
main_label = QLabel(_("Initialization settings for your %s:") % device)
|
next_enabled=True
|
||||||
vbox.addWidget(main_label)
|
|
||||||
OK_button = OkButton(wizard, _('Next'))
|
|
||||||
|
|
||||||
def clean_text(widget):
|
def clean_text(widget):
|
||||||
text = unicode(widget.toPlainText()).strip()
|
text = unicode(widget.toPlainText()).strip()
|
||||||
|
@ -172,9 +169,9 @@ class QtHandler(PrintError):
|
||||||
else:
|
else:
|
||||||
msg = _("Enter the master private key beginning with xprv:")
|
msg = _("Enter the master private key beginning with xprv:")
|
||||||
def set_enabled():
|
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)
|
text.textChanged.connect(set_enabled)
|
||||||
OK_button.setEnabled(False)
|
next_enabled = False
|
||||||
|
|
||||||
vbox.addWidget(QLabel(msg))
|
vbox.addWidget(QLabel(msg))
|
||||||
vbox.addWidget(text)
|
vbox.addWidget(text)
|
||||||
|
@ -203,12 +200,8 @@ class QtHandler(PrintError):
|
||||||
cb_phrase.setChecked(False)
|
cb_phrase.setChecked(False)
|
||||||
vbox.addWidget(cb_phrase)
|
vbox.addWidget(cb_phrase)
|
||||||
|
|
||||||
vbox.addStretch(1)
|
title = _("Initialization settings for your %s:") % device
|
||||||
vbox.addLayout(Buttons(CancelButton(wizard), OK_button))
|
wizard.set_main_layout(vbox, next_enabled=next_enabled, title=title)
|
||||||
|
|
||||||
wizard.set_layout(vbox)
|
|
||||||
if not wizard.exec_():
|
|
||||||
raise UserCancelled
|
|
||||||
|
|
||||||
if method in [TIM_NEW, TIM_RECOVER]:
|
if method in [TIM_NEW, TIM_RECOVER]:
|
||||||
item = bg.checkedId()
|
item = bg.checkedId()
|
||||||
|
|
Loading…
Add table
Reference in a new issue