Move trezor-specific install wizard code to plugin
This commit is contained in:
@@ -418,88 +418,3 @@ class InstallWizard(WindowModalDialog, WizardBase):
|
||||
self.set_layout(vbox)
|
||||
if not self.exec_():
|
||||
raise UserCancelled
|
||||
|
||||
def request_trezor_init_settings(self, method, device):
|
||||
vbox = QVBoxLayout()
|
||||
|
||||
main_label = QLabel(_("Initialization settings for your %s:") % device)
|
||||
vbox.addWidget(main_label)
|
||||
|
||||
OK_button = OkButton(self, _('Next'))
|
||||
|
||||
if method in [self.TIM_NEW, self.TIM_RECOVER]:
|
||||
gb = QGroupBox()
|
||||
vbox1 = QVBoxLayout()
|
||||
gb.setLayout(vbox1)
|
||||
vbox.addWidget(gb)
|
||||
gb.setTitle(_("Select your seed length:"))
|
||||
choices = [
|
||||
_("12 words"),
|
||||
_("18 words"),
|
||||
_("24 words"),
|
||||
]
|
||||
bg = QButtonGroup()
|
||||
for i, choice in enumerate(choices):
|
||||
rb = QRadioButton(gb)
|
||||
rb.setText(choice)
|
||||
bg.addButton(rb)
|
||||
bg.setId(rb, i)
|
||||
vbox1.addWidget(rb)
|
||||
rb.setChecked(True)
|
||||
cb_pin = QCheckBox(_('Enable PIN protection'))
|
||||
cb_pin.setChecked(True)
|
||||
else:
|
||||
text = QTextEdit()
|
||||
text.setMaximumHeight(60)
|
||||
if method == self.TIM_MNEMONIC:
|
||||
msg = _("Enter your BIP39 mnemonic:")
|
||||
else:
|
||||
msg = _("Enter the master private key beginning with xprv:")
|
||||
def set_enabled():
|
||||
OK_button.setEnabled(Wallet.is_xprv(
|
||||
self.get_seed_text(text)))
|
||||
text.textChanged.connect(set_enabled)
|
||||
OK_button.setEnabled(False)
|
||||
|
||||
vbox.addWidget(QLabel(msg))
|
||||
vbox.addWidget(text)
|
||||
pin = QLineEdit()
|
||||
pin.setValidator(QRegExpValidator(QRegExp('[1-9]{0,10}')))
|
||||
pin.setMaximumWidth(100)
|
||||
hbox_pin = QHBoxLayout()
|
||||
hbox_pin.addWidget(QLabel(_("Enter your PIN (digits 1-9):")))
|
||||
hbox_pin.addWidget(pin)
|
||||
hbox_pin.addStretch(1)
|
||||
|
||||
label = QLabel(_("Enter a label to name your device:"))
|
||||
name = QLineEdit()
|
||||
hl = QHBoxLayout()
|
||||
hl.addWidget(label)
|
||||
hl.addWidget(name)
|
||||
hl.addStretch(1)
|
||||
vbox.addLayout(hl)
|
||||
|
||||
if method in [self.TIM_NEW, self.TIM_RECOVER]:
|
||||
vbox.addWidget(cb_pin)
|
||||
else:
|
||||
vbox.addLayout(hbox_pin)
|
||||
|
||||
cb_phrase = QCheckBox(_('Enable Passphrase protection'))
|
||||
cb_phrase.setChecked(False)
|
||||
vbox.addWidget(cb_phrase)
|
||||
|
||||
vbox.addStretch(1)
|
||||
vbox.addLayout(Buttons(CancelButton(self), OK_button))
|
||||
self.set_layout(vbox)
|
||||
|
||||
if not self.exec_():
|
||||
raise UserCancelled
|
||||
|
||||
if method in [self.TIM_NEW, self.TIM_RECOVER]:
|
||||
item = bg.checkedId()
|
||||
pin = cb_pin.isChecked()
|
||||
else:
|
||||
item = ' '.join(str(self.get_seed_text(text)).split())
|
||||
pin = str(pin.text())
|
||||
|
||||
return (item, unicode(name.text()), pin, cb_phrase.isChecked())
|
||||
|
||||
Reference in New Issue
Block a user