kivy: pass message to restore dialog, and remove dead code.

This commit is contained in:
ThomasV 2016-01-16 12:44:59 +01:00
parent 9a98ad2881
commit cd6ec773c9
2 changed files with 15 additions and 30 deletions

View File

@ -135,6 +135,12 @@ Builder.load_string('''
<RestoreSeedDialog>
Label:
color: root.text_color
size_hint: 1, None
text_size: self.width, None
height: self.texture_size[1]
text: "[b]ENTER YOUR SEED PHRASE[/b]"
GridLayout
cols: 1
padding: 0, '12dp'
@ -156,10 +162,7 @@ Builder.load_string('''
height: self.texture_size[1]
halign: 'justify'
valign: 'middle'
text:
_('If you need additional information, please check '
'[color=#0000ff][ref=1]'
'https://electrum.org/faq.html#seed[/ref][/color]')
text: root.message
on_ref_press:
import webbrowser
webbrowser.open('https://electrum.org/faq.html#seed')
@ -287,26 +290,12 @@ class CreateRestoreDialog(CreateAccountDialog):
if value:
app = App.get_running_app()
self._back = _back = partial(app.dispatch, 'on_back')
#app.navigation_higherarchy.append(_back)
def close(self):
app = App.get_running_app()
#if self._back in app.navigation_higherarchy:
# app.navigation_higherarchy.pop()
# self._back = None
super(CreateRestoreDialog, self).close()
class ShowSeedDialog(CreateAccountDialog):
seed_text = StringProperty('')
'''Text to be displayed in the TextInput'''
message = StringProperty('')
'''Message to be displayed under seed'''
seed = ObjectProperty(None)
def on_parent(self, instance, value):
if value:
@ -315,18 +304,12 @@ class ShowSeedDialog(CreateAccountDialog):
stepper.opacity = 1
stepper.source = 'atlas://gui/kivy/theming/light/stepper_full'
self._back = _back = partial(self.ids.back.dispatch, 'on_release')
#app.navigation_higherarchy.append(_back)
def close(self):
app = App.get_running_app()
#if self._back in app.navigation_higherarchy:
# app.navigation_higherarchy.pop()
# self._back = None
super(ShowSeedDialog, self).close()
class RestoreSeedDialog(CreateAccountDialog):
message = StringProperty('')
def __init__(self, **kwargs):
super(RestoreSeedDialog, self).__init__(**kwargs)
self._test = kwargs['test']

View File

@ -104,7 +104,8 @@ class InstallWizard(Widget):
else:
self.wallet = Wallet.from_text(text)
# fixme: sync
RestoreSeedDialog(test=Wallet.is_any, on_release=partial(on_seed)).open()
msg = _('You may also enter an extended public key, to create a watching-only wallet')
RestoreSeedDialog(test=Wallet.is_any, message=msg, on_release=partial(on_seed)).open()
def add_seed(self, seed, password):
def task():
@ -142,7 +143,8 @@ class InstallWizard(Widget):
else:
self.wallet = Wallet.from_text(seed)
# fixme: sync
RestoreSeedDialog(test=lambda x: x==seed, on_release=partial(on_seed)).open()
msg = _('Please retype your seed phrase, to confirm that you properly saved it')
RestoreSeedDialog(test=lambda x: x==seed, message=msg, on_release=partial(on_seed)).open()
def enter_pin(self, seed):
from password_dialog import PasswordDialog
@ -157,8 +159,8 @@ class InstallWizard(Widget):
if conf == pin:
self.run('add_seed', (seed, pin))
else:
app = App.get_running_app()
app.show_error(_('Passwords do not match'), duration=.5)
app.show_error(_('PIN mismatch'), duration=.5)
self.run('enter_pin', (seed,))
popup = PasswordDialog('Confirm your PIN code', callback)
popup.open()