diff --git a/gui/qt/installwizard.py b/gui/qt/installwizard.py index fc5b440a6..f6127a6c0 100644 --- a/gui/qt/installwizard.py +++ b/gui/qt/installwizard.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()) diff --git a/lib/base_wizard.py b/lib/base_wizard.py index 987e2cf50..597a15d65 100644 --- a/lib/base_wizard.py +++ b/lib/base_wizard.py @@ -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