Browse Source

kivy: improve confirm seed screen

283
ThomasV 9 years ago
parent
commit
b3861bd54d
  1. 21
      gui/kivy/uix/dialogs/create_restore.py
  2. 2
      gui/kivy/uix/dialogs/installwizard.py

21
gui/kivy/uix/dialogs/create_restore.py

@ -129,6 +129,7 @@ Builder.load_string('''
<WordButton@Button>: <WordButton@Button>:
size_hint: None, None size_hint: None, None
padding: '5dp', '5dp'
text_size: None, self.height text_size: None, self.height
width: self.texture_size[0] width: self.texture_size[0]
height: '30dp' height: '30dp'
@ -184,6 +185,7 @@ Builder.load_string('''
new_word: root.on_word new_word: root.on_word
BoxLayout: BoxLayout:
id: line1
update_amount: root.update_text update_amount: root.update_text
size_hint: 1, None size_hint: 1, None
height: '30dp' height: '30dp'
@ -208,9 +210,13 @@ Builder.load_string('''
MButton: MButton:
text: 'P' text: 'P'
BoxLayout: BoxLayout:
id: line2
update_amount: root.update_text update_amount: root.update_text
size_hint: 1, None size_hint: 1, None
height: '30dp' height: '30dp'
Widget:
size_hint: 0.5, None
height: '33dp'
MButton: MButton:
text: 'A' text: 'A'
MButton: MButton:
@ -229,10 +235,16 @@ Builder.load_string('''
text: 'K' text: 'K'
MButton: MButton:
text: 'L' text: 'L'
Widget:
size_hint: 0.5, None
height: '33dp'
BoxLayout: BoxLayout:
id: line3
update_amount: root.update_text update_amount: root.update_text
size_hint: 1, None size_hint: 1, None
height: '30dp' height: '30dp'
Widget:
size_hint: 1, None
MButton: MButton:
text: 'Z' text: 'Z'
MButton: MButton:
@ -249,6 +261,7 @@ Builder.load_string('''
text: 'M' text: 'M'
MButton: MButton:
text: '<' text: '<'
size_hint: 2, None
GridLayout: GridLayout:
rows: 1 rows: 1
@ -409,6 +422,14 @@ class RestoreSeedDialog(WizardDialog):
b = WordButton(text=w) b = WordButton(text=w)
self.ids.suggestions.add_widget(b) self.ids.suggestions.add_widget(b)
i = len(last_word)
p = set([x[i] for x in suggestions])
for line in [self.ids.line1, self.ids.line2, self.ids.line3]:
for c in line.children:
if isinstance(c, Button):
if c.text in 'ABCDEFGHIJKLMNOPQRSTUVWXYZ':
c.disabled = (c.text.lower() not in p) and p
def on_word(self, w): def on_word(self, w):
text = self.get_seed_text() text = self.get_seed_text()
words = text.split(' ') words = text.split(' ')

2
gui/kivy/uix/dialogs/installwizard.py

@ -98,7 +98,7 @@ class InstallWizard(Widget):
else: else:
self.run('add_seed', (text, None)) self.run('add_seed', (text, None))
# fixme: sync # fixme: sync
msg = _('You may also enter an extended public key, to create a watching-only wallet') msg = _('You may use the camera and scan an extended public key, to create a watching-only wallet')
RestoreSeedDialog(test=Wallet.is_any, message=msg, on_release=on_seed).open() RestoreSeedDialog(test=Wallet.is_any, message=msg, on_release=on_seed).open()
def add_seed(self, text, password): def add_seed(self, text, password):

Loading…
Cancel
Save