Browse Source
Merge pull request #3610 from SomberNight/wizard_derivation_presets
wizard: add derivation presets for bip44/49
3.1
ThomasV
7 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
18 additions and
2 deletions
-
gui/qt/installwizard.py
-
lib/base_wizard.py
|
|
@ -462,7 +462,8 @@ class InstallWizard(QDialog, MessageBoxMixin, BaseWizard): |
|
|
|
return clayout.selected_index() |
|
|
|
|
|
|
|
@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.addWidget(WWLabel(message)) |
|
|
|
line = QLineEdit() |
|
|
@ -472,6 +473,15 @@ class InstallWizard(QDialog, MessageBoxMixin, BaseWizard): |
|
|
|
line.textEdited.connect(f) |
|
|
|
vbox.addWidget(line) |
|
|
|
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)) |
|
|
|
return ' '.join(line.text().split()) |
|
|
|
|
|
|
|
|
|
@ -236,7 +236,13 @@ class BaseWizard(object): |
|
|
|
_('Enter your wallet derivation here.'), |
|
|
|
_('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): |
|
|
|
from .keystore import hardware_keystore |
|
|
|