tMerge pull request #3610 from SomberNight/wizard_derivation_presets - electrum - Electrum Bitcoin wallet
 (HTM) git clone https://git.parazyd.org/electrum
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) Submodules
       ---
 (DIR) commit d1843a804a582c8bfa7740c8a82e3a6afd3f00ae
 (DIR) parent ffff09736addb4b4176d7faa9eaed175d7cef7fc
 (HTM) Author: ThomasV <thomasv@electrum.org>
       Date:   Fri, 29 Dec 2017 16:04:53 +0100
       
       Merge pull request #3610 from SomberNight/wizard_derivation_presets
       
       wizard: add derivation presets for bip44/49
       Diffstat:
         M gui/qt/installwizard.py             |      12 +++++++++++-
         M lib/base_wizard.py                  |       8 +++++++-
       
       2 files changed, 18 insertions(+), 2 deletions(-)
       ---
 (DIR) diff --git a/gui/qt/installwizard.py b/gui/qt/installwizard.py
       t@@ -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()
       t@@ -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())
        
 (DIR) diff --git a/lib/base_wizard.py b/lib/base_wizard.py
       t@@ -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