ThomasV 5 years ago
parent
commit
77e0d3745e
  1. 18
      electrum/gui/kivy/uix/dialogs/installwizard.py
  2. 25
      electrum/gui/kivy/uix/dialogs/seed_options.py

18
electrum/gui/kivy/uix/dialogs/installwizard.py

@ -874,16 +874,18 @@ class RestoreSeedDialog(WizardDialog):
self.ids.text_input_seed.text = '' self.ids.text_input_seed.text = ''
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 self.opt_ext = kwargs['opt_ext']
self.bip39 = False self.opt_bip39 = kwargs['opt_bip39']
self.is_ext = False
self.is_bip39 = False
def options_dialog(self): def options_dialog(self):
from .seed_options import SeedOptionsDialog from .seed_options import SeedOptionsDialog
def callback(ext, bip39): def callback(ext, bip39):
self.ext = ext self.is_ext = ext
self.bip39 = bip39 self.is_bip39 = bip39
self.update_next_button() self.update_next_button()
d = SeedOptionsDialog(self.ext, self.bip39, callback) d = SeedOptionsDialog(self.opt_ext, self.opt_bip39, self.is_ext, self.is_bip39, callback)
d.open() d.open()
def get_suggestions(self, prefix): def get_suggestions(self, prefix):
@ -892,7 +894,7 @@ class RestoreSeedDialog(WizardDialog):
yield w yield w
def update_next_button(self): def update_next_button(self):
self.ids.next.disabled = False if self.bip39 else not bool(self._test(self.get_text())) self.ids.next.disabled = False if self.is_bip39 else not bool(self._test(self.get_text()))
def on_text(self, dt): def on_text(self, dt):
self.update_next_button() self.update_next_button()
@ -980,7 +982,7 @@ class RestoreSeedDialog(WizardDialog):
tis.focus = False tis.focus = False
def get_params(self, b): def get_params(self, b):
return (self.get_text(), self.bip39, self.ext) return (self.get_text(), self.is_bip39, self.is_ext)
class ConfirmSeedDialog(RestoreSeedDialog): class ConfirmSeedDialog(RestoreSeedDialog):
@ -1094,6 +1096,8 @@ class InstallWizard(BaseWizard, Widget):
ConfirmSeedDialog(self, **kwargs).open() ConfirmSeedDialog(self, **kwargs).open()
def restore_seed_dialog(self, **kwargs): def restore_seed_dialog(self, **kwargs):
kwargs['opt_bip39'] = self.opt_bip39
kwargs['opt_ext'] = self.opt_ext
RestoreSeedDialog(self, **kwargs).open() RestoreSeedDialog(self, **kwargs).open()
def confirm_dialog(self, **kwargs): def confirm_dialog(self, **kwargs):

25
electrum/gui/kivy/uix/dialogs/seed_options.py

@ -6,6 +6,10 @@ from kivy.lang import Builder
Builder.load_string(''' Builder.load_string('''
<SeedOptionsDialog@Popup> <SeedOptionsDialog@Popup>
id: popup id: popup
opt_bip39: False
opt_ext: False
is_bip39: False
is_ext: False
title: _('Seed Options') title: _('Seed Options')
size_hint: 0.8, 0.8 size_hint: 0.8, 0.8
pos_hint: {'top':0.9} pos_hint: {'top':0.9}
@ -22,16 +26,24 @@ Builder.load_string('''
size_hint: 1, 0.2 size_hint: 1, 0.2
Label: Label:
text: _('Extend Seed') text: _('Extend Seed')
opacity: 1 if root.opt_ext else 0
CheckBox: CheckBox:
id:ext id:ext
disabled: not root.opt_ext
opacity: 1 if root.opt_ext else 0
active: root.is_ext
BoxLayout: BoxLayout:
orientation: 'horizontal' orientation: 'horizontal'
size_hint: 1, 0.2 size_hint: 1, 0.2
Label: Label:
text: _('BIP39') text: _('BIP39')
id:bip39_label id:bip39_label
opacity: 1 if root.opt_bip39 else 0
CheckBox: CheckBox:
id:bip39 id:bip39
disabled: not root.opt_bip39
opacity: 1 if root.opt_bip39 else 0
active: root.is_bip39
Widget: Widget:
size_hint: 1, 0.1 size_hint: 1, 0.1
BoxLayout: BoxLayout:
@ -53,13 +65,10 @@ Builder.load_string('''
class SeedOptionsDialog(Factory.Popup): class SeedOptionsDialog(Factory.Popup):
def __init__(self, is_ext, is_bip39, callback): def __init__(self, opt_ext, opt_bip39, is_ext, is_bip39, callback):
Factory.Popup.__init__(self) Factory.Popup.__init__(self)
self.ids.ext.active = is_ext self.opt_ext = opt_ext
if is_bip39 is None: self.opt_bip39 = opt_bip39
self.ids.bip39.opacity = 0 self.is_ext = is_ext
self.ids.bip39_label.opacity = 0 self.is_bip39 = is_bip39
self.ids.bip39.disabled = True
else:
self.ids.bip39.active = is_bip39
self.callback = callback self.callback = callback

Loading…
Cancel
Save