Merge pull request #3610 from SomberNight/wizard_derivation_presets
wizard: add derivation presets for bip44/49
This commit is contained in:
@@ -462,7 +462,8 @@ class InstallWizard(QDialog, MessageBoxMixin, BaseWizard):
|
|||||||
return clayout.selected_index()
|
return clayout.selected_index()
|
||||||
|
|
||||||
@wizard_dialog
|
@wizard_dialog
|
||||||
def line_dialog(self, run_next, title, message, default, test, warning=''):
|
def line_dialog(self, run_next, title, message, default, test, warning='',
|
||||||
|
presets=()):
|
||||||
vbox = QVBoxLayout()
|
vbox = QVBoxLayout()
|
||||||
vbox.addWidget(WWLabel(message))
|
vbox.addWidget(WWLabel(message))
|
||||||
line = QLineEdit()
|
line = QLineEdit()
|
||||||
@@ -472,6 +473,15 @@ class InstallWizard(QDialog, MessageBoxMixin, BaseWizard):
|
|||||||
line.textEdited.connect(f)
|
line.textEdited.connect(f)
|
||||||
vbox.addWidget(line)
|
vbox.addWidget(line)
|
||||||
vbox.addWidget(WWLabel(warning))
|
vbox.addWidget(WWLabel(warning))
|
||||||
|
|
||||||
|
for preset in presets:
|
||||||
|
button = QPushButton(preset[0])
|
||||||
|
button.clicked.connect(lambda __, text=preset[1]: line.setText(text))
|
||||||
|
button.setMaximumWidth(150)
|
||||||
|
hbox = QHBoxLayout()
|
||||||
|
hbox.addWidget(button, Qt.AlignCenter)
|
||||||
|
vbox.addLayout(hbox)
|
||||||
|
|
||||||
self.exec_layout(vbox, title, next_enabled=test(default))
|
self.exec_layout(vbox, title, next_enabled=test(default))
|
||||||
return ' '.join(line.text().split())
|
return ' '.join(line.text().split())
|
||||||
|
|
||||||
|
|||||||
@@ -236,7 +236,13 @@ class BaseWizard(object):
|
|||||||
_('Enter your wallet derivation here.'),
|
_('Enter your wallet derivation here.'),
|
||||||
_('If you are not sure what this is, leave this field unchanged.')
|
_('If you are not sure what this is, leave this field unchanged.')
|
||||||
])
|
])
|
||||||
self.line_dialog(run_next=f, title=_('Derivation'), message=message, default=default, test=bitcoin.is_bip32_derivation)
|
presets = (
|
||||||
|
('legacy BIP44', bip44_derivation(0, False)),
|
||||||
|
('p2sh-segwit BIP49', bip44_derivation(0, True)),
|
||||||
|
)
|
||||||
|
self.line_dialog(run_next=f, title=_('Derivation'), message=message,
|
||||||
|
default=default, test=bitcoin.is_bip32_derivation,
|
||||||
|
presets=presets)
|
||||||
|
|
||||||
def on_hw_derivation(self, name, device_info, derivation):
|
def on_hw_derivation(self, name, device_info, derivation):
|
||||||
from .keystore import hardware_keystore
|
from .keystore import hardware_keystore
|
||||||
|
|||||||
Reference in New Issue
Block a user