tseed_options.py - electrum - Electrum Bitcoin wallet
HTML git clone https://git.parazyd.org/electrum
DIR Log
DIR Files
DIR Refs
DIR Submodules
---
tseed_options.py (2237B)
---
1 from kivy.app import App
2 from kivy.factory import Factory
3 from kivy.properties import ObjectProperty
4 from kivy.lang import Builder
5
6 Builder.load_string('''
7 <SeedOptionsDialog@Popup>
8 id: popup
9 opt_bip39: False
10 opt_ext: False
11 is_bip39: False
12 is_ext: False
13 title: _('Seed Options')
14 size_hint: 0.8, 0.8
15 pos_hint: {'top':0.9}
16 BoxLayout:
17 orientation: 'vertical'
18 Label:
19 id: description
20 text: _('You may extend your seed with custom words')
21 halign: 'left'
22 text_size: self.width, None
23 size: self.texture_size
24 BoxLayout:
25 orientation: 'horizontal'
26 size_hint: 1, 0.2
27 Label:
28 text: _('Extend Seed')
29 opacity: 1 if root.opt_ext else 0
30 CheckBox:
31 id:ext
32 disabled: not root.opt_ext
33 opacity: 1 if root.opt_ext else 0
34 active: root.is_ext
35 BoxLayout:
36 orientation: 'horizontal'
37 size_hint: 1, 0.2
38 Label:
39 text: _('BIP39')
40 id:bip39_label
41 opacity: 1 if root.opt_bip39 else 0
42 CheckBox:
43 id:bip39
44 disabled: not root.opt_bip39
45 opacity: 1 if root.opt_bip39 else 0
46 active: root.is_bip39
47 Widget:
48 size_hint: 1, 0.1
49 BoxLayout:
50 orientation: 'horizontal'
51 size_hint: 1, 0.2
52 Button:
53 text: 'Cancel'
54 size_hint: 0.5, None
55 height: '48dp'
56 on_release: popup.dismiss()
57 Button:
58 text: 'OK'
59 size_hint: 0.5, None
60 height: '48dp'
61 on_release:
62 root.callback(ext.active, bip39.active)
63 popup.dismiss()
64 ''')
65
66
67 class SeedOptionsDialog(Factory.Popup):
68 def __init__(self, opt_ext, opt_bip39, is_ext, is_bip39, callback):
69 Factory.Popup.__init__(self)
70 self.opt_ext = opt_ext
71 self.opt_bip39 = opt_bip39
72 self.is_ext = is_ext
73 self.is_bip39 = is_bip39
74 self.callback = callback