kivy: pass message to restore dialog, and remove dead code.
This commit is contained in:
parent
9a98ad2881
commit
cd6ec773c9
|
@ -135,6 +135,12 @@ Builder.load_string('''
|
||||||
|
|
||||||
|
|
||||||
<RestoreSeedDialog>
|
<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
|
GridLayout
|
||||||
cols: 1
|
cols: 1
|
||||||
padding: 0, '12dp'
|
padding: 0, '12dp'
|
||||||
|
@ -156,10 +162,7 @@ Builder.load_string('''
|
||||||
height: self.texture_size[1]
|
height: self.texture_size[1]
|
||||||
halign: 'justify'
|
halign: 'justify'
|
||||||
valign: 'middle'
|
valign: 'middle'
|
||||||
text:
|
text: root.message
|
||||||
_('If you need additional information, please check '
|
|
||||||
'[color=#0000ff][ref=1]'
|
|
||||||
'https://electrum.org/faq.html#seed[/ref][/color]')
|
|
||||||
on_ref_press:
|
on_ref_press:
|
||||||
import webbrowser
|
import webbrowser
|
||||||
webbrowser.open('https://electrum.org/faq.html#seed')
|
webbrowser.open('https://electrum.org/faq.html#seed')
|
||||||
|
@ -287,26 +290,12 @@ class CreateRestoreDialog(CreateAccountDialog):
|
||||||
if value:
|
if value:
|
||||||
app = App.get_running_app()
|
app = App.get_running_app()
|
||||||
self._back = _back = partial(app.dispatch, 'on_back')
|
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):
|
class ShowSeedDialog(CreateAccountDialog):
|
||||||
|
|
||||||
seed_text = StringProperty('')
|
seed_text = StringProperty('')
|
||||||
'''Text to be displayed in the TextInput'''
|
|
||||||
|
|
||||||
message = StringProperty('')
|
message = StringProperty('')
|
||||||
'''Message to be displayed under seed'''
|
|
||||||
|
|
||||||
seed = ObjectProperty(None)
|
|
||||||
|
|
||||||
def on_parent(self, instance, value):
|
def on_parent(self, instance, value):
|
||||||
if value:
|
if value:
|
||||||
|
@ -315,18 +304,12 @@ class ShowSeedDialog(CreateAccountDialog):
|
||||||
stepper.opacity = 1
|
stepper.opacity = 1
|
||||||
stepper.source = 'atlas://gui/kivy/theming/light/stepper_full'
|
stepper.source = 'atlas://gui/kivy/theming/light/stepper_full'
|
||||||
self._back = _back = partial(self.ids.back.dispatch, 'on_release')
|
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):
|
class RestoreSeedDialog(CreateAccountDialog):
|
||||||
|
|
||||||
|
message = StringProperty('')
|
||||||
|
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
super(RestoreSeedDialog, self).__init__(**kwargs)
|
super(RestoreSeedDialog, self).__init__(**kwargs)
|
||||||
self._test = kwargs['test']
|
self._test = kwargs['test']
|
||||||
|
|
|
@ -104,7 +104,8 @@ class InstallWizard(Widget):
|
||||||
else:
|
else:
|
||||||
self.wallet = Wallet.from_text(text)
|
self.wallet = Wallet.from_text(text)
|
||||||
# fixme: sync
|
# 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 add_seed(self, seed, password):
|
||||||
def task():
|
def task():
|
||||||
|
@ -142,7 +143,8 @@ class InstallWizard(Widget):
|
||||||
else:
|
else:
|
||||||
self.wallet = Wallet.from_text(seed)
|
self.wallet = Wallet.from_text(seed)
|
||||||
# fixme: sync
|
# 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):
|
def enter_pin(self, seed):
|
||||||
from password_dialog import PasswordDialog
|
from password_dialog import PasswordDialog
|
||||||
|
@ -157,8 +159,8 @@ class InstallWizard(Widget):
|
||||||
if conf == pin:
|
if conf == pin:
|
||||||
self.run('add_seed', (seed, pin))
|
self.run('add_seed', (seed, pin))
|
||||||
else:
|
else:
|
||||||
app = App.get_running_app()
|
app.show_error(_('PIN mismatch'), duration=.5)
|
||||||
app.show_error(_('Passwords do not match'), duration=.5)
|
self.run('enter_pin', (seed,))
|
||||||
popup = PasswordDialog('Confirm your PIN code', callback)
|
popup = PasswordDialog('Confirm your PIN code', callback)
|
||||||
popup.open()
|
popup.open()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue