commit 77e0d3745e990e97ddbac5550e399f3e695af788
parent 7e36770a067209836fb6d3c78f7272420543ba5e
Author: ThomasV <thomasv@electrum.org>
Date: Sat, 2 Jan 2021 11:48:15 +0100
fix #4326
Diffstat:
2 files changed, 28 insertions(+), 15 deletions(-)
diff --git a/electrum/gui/kivy/uix/dialogs/installwizard.py b/electrum/gui/kivy/uix/dialogs/installwizard.py
@@ -874,16 +874,18 @@ class RestoreSeedDialog(WizardDialog):
self.ids.text_input_seed.text = ''
self.message = _('Please type your seed phrase using the virtual keyboard.')
self.title = _('Enter Seed')
- self.ext = False
- self.bip39 = False
+ self.opt_ext = kwargs['opt_ext']
+ self.opt_bip39 = kwargs['opt_bip39']
+ self.is_ext = False
+ self.is_bip39 = False
def options_dialog(self):
from .seed_options import SeedOptionsDialog
def callback(ext, bip39):
- self.ext = ext
- self.bip39 = bip39
+ self.is_ext = ext
+ self.is_bip39 = bip39
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()
def get_suggestions(self, prefix):
@@ -892,7 +894,7 @@ class RestoreSeedDialog(WizardDialog):
yield w
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):
self.update_next_button()
@@ -980,7 +982,7 @@ class RestoreSeedDialog(WizardDialog):
tis.focus = False
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):
@@ -1094,6 +1096,8 @@ class InstallWizard(BaseWizard, Widget):
ConfirmSeedDialog(self, **kwargs).open()
def restore_seed_dialog(self, **kwargs):
+ kwargs['opt_bip39'] = self.opt_bip39
+ kwargs['opt_ext'] = self.opt_ext
RestoreSeedDialog(self, **kwargs).open()
def confirm_dialog(self, **kwargs):
diff --git a/electrum/gui/kivy/uix/dialogs/seed_options.py b/electrum/gui/kivy/uix/dialogs/seed_options.py
@@ -6,6 +6,10 @@ from kivy.lang import Builder
Builder.load_string('''
<SeedOptionsDialog@Popup>
id: popup
+ opt_bip39: False
+ opt_ext: False
+ is_bip39: False
+ is_ext: False
title: _('Seed Options')
size_hint: 0.8, 0.8
pos_hint: {'top':0.9}
@@ -22,16 +26,24 @@ Builder.load_string('''
size_hint: 1, 0.2
Label:
text: _('Extend Seed')
+ opacity: 1 if root.opt_ext else 0
CheckBox:
id:ext
+ disabled: not root.opt_ext
+ opacity: 1 if root.opt_ext else 0
+ active: root.is_ext
BoxLayout:
orientation: 'horizontal'
size_hint: 1, 0.2
Label:
text: _('BIP39')
id:bip39_label
+ opacity: 1 if root.opt_bip39 else 0
CheckBox:
id:bip39
+ disabled: not root.opt_bip39
+ opacity: 1 if root.opt_bip39 else 0
+ active: root.is_bip39
Widget:
size_hint: 1, 0.1
BoxLayout:
@@ -53,13 +65,10 @@ Builder.load_string('''
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)
- self.ids.ext.active = is_ext
- if is_bip39 is None:
- self.ids.bip39.opacity = 0
- self.ids.bip39_label.opacity = 0
- self.ids.bip39.disabled = True
- else:
- self.ids.bip39.active = is_bip39
+ self.opt_ext = opt_ext
+ self.opt_bip39 = opt_bip39
+ self.is_ext = is_ext
+ self.is_bip39 = is_bip39
self.callback = callback