diff --git a/gui/kivy/uix/dialogs/installwizard.py b/gui/kivy/uix/dialogs/installwizard.py index e7eae5f7f..20fed582c 100644 --- a/gui/kivy/uix/dialogs/installwizard.py +++ b/gui/kivy/uix/dialogs/installwizard.py @@ -408,17 +408,13 @@ Builder.load_string(''' text: root.title SeedLabel: text: root.message - GridLayout: - cols: 2 + TextInput: + id: passphrase_input + multiline: False size_hint: 1, None height: '27dp' - BigLabel: - text: '' - TextInput: - id: passphrase_input - multiline: False - size_hint: 1, None - height: '27dp' + SeedLabel: + text: root.warning ''') @@ -515,6 +511,7 @@ class WizardChoiceDialog(WizardDialog): class LineDialog(WizardDialog): title = StringProperty('') message = StringProperty('') + warning = StringProperty('') def __init__(self, wizard, **kwargs): WizardDialog.__init__(self, wizard, **kwargs) @@ -741,7 +738,14 @@ class InstallWizard(BaseWizard, Widget): self.wallet.start_threads(self.network) self.dispatch('on_wizard_complete', self.wallet) - def choice_dialog(self, **kwargs): WizardChoiceDialog(self, **kwargs).open() + def choice_dialog(self, **kwargs): + choices = kwargs['choices'] + if len(choices) > 1: + WizardChoiceDialog(self, **kwargs).open() + else: + f = kwargs['run_next'] + apply(f, (choices[0][0],)) + def multisig_dialog(self, **kwargs): WizardMultisigDialog(self, **kwargs).open() def show_seed_dialog(self, **kwargs): ShowSeedDialog(self, **kwargs).open() def line_dialog(self, **kwargs): LineDialog(self, **kwargs).open() @@ -754,7 +758,7 @@ class InstallWizard(BaseWizard, Widget): def restore_seed_dialog(self, **kwargs): RestoreSeedDialog(self, **kwargs).open() - def restore_keys_dialog(self, **kwargs): + def add_xpub_dialog(self, **kwargs): kwargs['message'] += ' ' + _('Use the camera button to scan a QR code.') AddXpubDialog(self, **kwargs).open() diff --git a/gui/qt/installwizard.py b/gui/qt/installwizard.py index 4ba2c6b56..68fae61e3 100644 --- a/gui/qt/installwizard.py +++ b/gui/qt/installwizard.py @@ -267,7 +267,7 @@ class InstallWizard(QDialog, MessageBoxMixin, BaseWizard): return seed, is_bip39 @wizard_dialog - def restore_keys_dialog(self, title, message, is_valid, run_next): + def add_xpub_dialog(self, title, message, is_valid, run_next): return self.text_input(title, message, is_valid) @wizard_dialog @@ -378,7 +378,7 @@ class InstallWizard(QDialog, MessageBoxMixin, BaseWizard): return clayout.selected_index() @wizard_dialog - def line_dialog(self, run_next, title, message, default, test): + def line_dialog(self, run_next, title, message, warning, default, test): vbox = QVBoxLayout() vbox.addWidget(WWLabel(message)) line = QLineEdit() @@ -387,6 +387,7 @@ class InstallWizard(QDialog, MessageBoxMixin, BaseWizard): self.next_button.setEnabled(test(text)) line.textEdited.connect(f) vbox.addWidget(line) + vbox.addWidget(WWLabel(warning)) self.set_main_layout(vbox, title, next_enabled=test(default)) return ' '.join(unicode(line.text()).split()) diff --git a/lib/base_wizard.py b/lib/base_wizard.py index dd413fb25..1679ecb87 100644 --- a/lib/base_wizard.py +++ b/lib/base_wizard.py @@ -152,14 +152,11 @@ class BaseWizard(object): _("To create a watching-only wallet, please enter your master public key (xpub)."), _("To create a spending wallet, please enter a master private key (xprv), or a list of Bitcoin private keys.") ]) + self.add_xpub_dialog(title=title, message=message, run_next=self.on_restore_from_key, is_valid=v) else: v = keystore.is_bip32_key - title = _("Master public or private key") - message = ' '.join([ - _("To create a watching-only wallet, please enter your master public key (xpub)."), - _("To create a spending wallet, please enter a master private key (xprv).") - ]) - self.restore_keys_dialog(title=title, message=message, run_next=self.on_restore_from_key, is_valid=v) + i = len(self.keystores) + 1 + self.add_cosigner_dialog(index=i, run_next=self.on_restore_from_key, is_valid=v) def on_restore_from_key(self, text): k = keystore.from_keys(text) @@ -255,12 +252,13 @@ class BaseWizard(object): message = '\n'.join([ _('Your seed may have a passphrase.'), _('If that is the case, enter it here.'), - '\n', + ]) + warning = '\n'.join([ _('Note that this is NOT your encryption password.'), _('If you do not know what this is, leave this field empty.'), ]) f = lambda x: self.on_restore_passphrase(seed, x, is_bip39) - self.line_dialog(title=_('Passphrase'), message=message, default='', test=lambda x:True, run_next=f) + self.line_dialog(title=_('Passphrase'), message=message, warning=warning, default='', test=lambda x:True, run_next=f) else: self.on_restore_passphrase(seed, '', False) @@ -344,12 +342,13 @@ class BaseWizard(object): message = '\n'.join([ _('You may extend your seed with a passphrase.'), _('This allows you to derive several wallets from the same seed.'), - '\n', + ]) + warning = '\n'.join([ _('Note that this is NOT your encryption password.'), _('If you do not know what this is, leave this field empty.'), ]) f = lambda x: self.confirm_seed(seed, x) - self.line_dialog(run_next=f, title=title, message=message, default='', test=lambda x:True) + self.line_dialog(run_next=f, title=title, message=message, warning=warning, default='', test=lambda x:True) def confirm_seed(self, seed, passphrase): f = lambda x: self.confirm_passphrase(seed, passphrase)