kivy: seed options dialog

This commit is contained in:
ThomasV 2016-10-11 14:59:29 +02:00
parent 49550514af
commit 834d3322b3
2 changed files with 27 additions and 6 deletions

View File

@ -227,6 +227,7 @@ Builder.load_string('''
id: text_input_seed id: text_input_seed
text: '' text: ''
on_text: Clock.schedule_once(root.on_text) on_text: Clock.schedule_once(root.on_text)
on_release: root.options_dialog()
SeedLabel: SeedLabel:
text: root.message text: root.message
BoxLayout: BoxLayout:
@ -397,10 +398,12 @@ Builder.load_string('''
height: self.minimum_height height: self.minimum_height
orientation: 'vertical' orientation: 'vertical'
spacing: '12dp' spacing: '12dp'
SeedLabel:
text: root.message
SeedButton: SeedButton:
text: root.seed_text text: root.seed_text
on_release: root.options_dialog()
SeedLabel:
text: root.message
<LineDialog> <LineDialog>
@ -523,14 +526,22 @@ class LineDialog(WizardDialog):
class ShowSeedDialog(WizardDialog): class ShowSeedDialog(WizardDialog):
seed_text = StringProperty('') seed_text = StringProperty('')
message = _("If you forget your PIN or lose your device, your seed phrase will be the only way to recover your funds.") message = _("If you forget your PIN or lose your device, your seed phrase will be the only way to recover your funds.")
ext = False
def on_parent(self, instance, value): def on_parent(self, instance, value):
if value: if value:
app = App.get_running_app() app = App.get_running_app()
self._back = _back = partial(self.ids.back.dispatch, 'on_release') self._back = _back = partial(self.ids.back.dispatch, 'on_release')
def options_dialog(self):
from seed_options import SeedOptionsDialog
def callback(status):
self.ext = status
d = SeedOptionsDialog(self.ext, callback)
d.open()
def get_params(self, b): def get_params(self, b):
return (True,) return (self.ext,)
class WordButton(Button): class WordButton(Button):
@ -551,6 +562,14 @@ class RestoreSeedDialog(WizardDialog):
self.ids.text_input_seed.text = test_seed if is_test else '' self.ids.text_input_seed.text = test_seed if is_test else ''
self.message = _('Please type your seed phrase using the virtual keyboard.') self.message = _('Please type your seed phrase using the virtual keyboard.')
self.title = _('Enter Seed') self.title = _('Enter Seed')
self.ext = False
def options_dialog(self):
from seed_options import SeedOptionsDialog
def callback(status):
self.ext = status
d = SeedOptionsDialog(self.ext, callback)
d.open()
def get_suggestions(self, prefix): def get_suggestions(self, prefix):
for w in self.words: for w in self.words:
@ -646,12 +665,14 @@ class RestoreSeedDialog(WizardDialog):
tis.focus = False tis.focus = False
def get_params(self, b): def get_params(self, b):
return (self.get_text(), False, True) return (self.get_text(), False, self.ext)
class ConfirmSeedDialog(RestoreSeedDialog): class ConfirmSeedDialog(RestoreSeedDialog):
def get_params(self, b): def get_params(self, b):
return (self.get_text(),) return (self.get_text(),)
def options_dialog(self):
pass
class ShowXpubDialog(WizardDialog): class ShowXpubDialog(WizardDialog):

View File

@ -256,7 +256,7 @@ class InstallWizard(QDialog, MessageBoxMixin, BaseWizard):
vbox.addStretch(1) vbox.addStretch(1)
vbox.addWidget(QLabel(_('Options') + ':')) vbox.addWidget(QLabel(_('Options') + ':'))
if self.opt_ext: if self.opt_ext:
cb_pass = QCheckBox(_('Add an extension to this seed')) cb_pass = QCheckBox(_('Extend this seed with custom words'))
vbox.addWidget(cb_pass) vbox.addWidget(cb_pass)
if self.opt_bip39: if self.opt_bip39:
def f(b): def f(b):
@ -325,7 +325,7 @@ class InstallWizard(QDialog, MessageBoxMixin, BaseWizard):
vbox.addLayout(slayout.layout()) vbox.addLayout(slayout.layout())
vbox.addStretch(1) vbox.addStretch(1)
vbox.addWidget(QLabel(_('Option') + ':')) vbox.addWidget(QLabel(_('Option') + ':'))
cb_pass = QCheckBox(_('Add an extension to this seed')) cb_pass = QCheckBox(_('Extend this seed with custom words'))
vbox.addWidget(cb_pass) vbox.addWidget(cb_pass)
self.set_main_layout(vbox) self.set_main_layout(vbox)
return cb_pass.isChecked() return cb_pass.isChecked()