1
0

improve wizard messages; skip choice screen if there is only one choice

This commit is contained in:
ThomasV
2016-09-26 12:02:54 +02:00
parent 9f7ca3dcb7
commit 4bc756751b
3 changed files with 27 additions and 23 deletions

View File

@@ -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()

View File

@@ -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())