kivy: remove hidden state in RefLabel, use it for seed and private keys
This commit is contained in:
@@ -133,13 +133,14 @@
|
||||
font_size: '6pt'
|
||||
name: ''
|
||||
data: ''
|
||||
text: self.data
|
||||
text: self.data if self.data else _('Tap to show')
|
||||
touched: False
|
||||
padding: '10dp', '10dp'
|
||||
on_touch_down:
|
||||
touch = args[1]
|
||||
if self.collide_point(*touch.pos): app.on_ref_label(self, touch)
|
||||
else: self.touched = False
|
||||
touched = bool(self.collide_point(*touch.pos))
|
||||
if touched: app.on_ref_label(self)
|
||||
if touched: self.touched = True
|
||||
canvas.before:
|
||||
Color:
|
||||
rgb: .3, .3, .3
|
||||
|
||||
@@ -856,14 +856,10 @@ class ElectrumWindow(App):
|
||||
self._orientation = 'landscape' if width > height else 'portrait'
|
||||
self._ui_mode = 'tablet' if min(width, height) > inch(3.51) else 'phone'
|
||||
|
||||
def on_ref_label(self, label, touch):
|
||||
if label.touched:
|
||||
label.touched = False
|
||||
self.qr_dialog(label.name, label.data, True)
|
||||
else:
|
||||
label.touched = True
|
||||
self._clipboard.copy(label.data)
|
||||
Clock.schedule_once(lambda dt: self.show_info(_('Text copied to clipboard.\nTap again to display it as QR code.')))
|
||||
def on_ref_label(self, label):
|
||||
if not label.data:
|
||||
return
|
||||
self.qr_dialog(label.name, label.data, True)
|
||||
|
||||
def show_error(self, error, width='200dp', pos=None, arrow_pos=None,
|
||||
exit=False, icon='atlas://electrum/gui/kivy/theming/light/error', duration=0,
|
||||
@@ -1064,9 +1060,9 @@ class ElectrumWindow(App):
|
||||
except:
|
||||
self.show_error("Invalid PIN")
|
||||
return
|
||||
label.text = _('Seed') + ':\n' + seed
|
||||
label.data = seed
|
||||
if passphrase:
|
||||
label.text += '\n\n' + _('Passphrase') + ': ' + passphrase
|
||||
label.data += '\n\n' + _('Passphrase') + ': ' + passphrase
|
||||
|
||||
def password_dialog(self, wallet, msg, on_success, on_failure):
|
||||
from .uix.dialogs.password_dialog import PasswordDialog
|
||||
|
||||
@@ -103,6 +103,7 @@ Builder.load_string('''
|
||||
address: ''
|
||||
balance: ''
|
||||
status: ''
|
||||
script_type: ''
|
||||
pk: ''
|
||||
BoxLayout:
|
||||
orientation: 'vertical'
|
||||
@@ -113,26 +114,31 @@ Builder.load_string('''
|
||||
size_hint_y: None
|
||||
padding: '10dp'
|
||||
spacing: '10dp'
|
||||
TopLabel:
|
||||
text: _('Address')
|
||||
RefLabel:
|
||||
data: root.address
|
||||
name: _('Address')
|
||||
GridLayout:
|
||||
cols: 1
|
||||
size_hint_y: None
|
||||
height: self.minimum_height
|
||||
spacing: '10dp'
|
||||
BoxLabel:
|
||||
text: _('Address')
|
||||
value: root.address
|
||||
BoxLabel:
|
||||
text: _('Balance')
|
||||
value: root.balance
|
||||
BoxLabel:
|
||||
text: _('Script type')
|
||||
value: root.script_type
|
||||
BoxLabel:
|
||||
text: _('Status')
|
||||
value: root.status
|
||||
TopLabel:
|
||||
text: _('Private Key')
|
||||
RefLabel:
|
||||
id: pk_label
|
||||
touched: True if not self.touched else True
|
||||
data: root.pk
|
||||
name: _('Private key')
|
||||
on_touched: if not self.data: root.do_export(self)
|
||||
Widget:
|
||||
size_hint: 1, 0.1
|
||||
BoxLayout:
|
||||
@@ -141,14 +147,8 @@ Builder.load_string('''
|
||||
Button:
|
||||
size_hint: 0.5, None
|
||||
height: '48dp'
|
||||
text: _('Hide key') if pk_label.data else _('Show key')
|
||||
on_release:
|
||||
setattr(pk_label, 'data', '') if pk_label.data else root.do_export(pk_label)
|
||||
Button:
|
||||
size_hint: 0.5, None
|
||||
height: '48dp'
|
||||
text: _('Use')
|
||||
on_release: root.do_use()
|
||||
text: _('Receive')
|
||||
on_release: root.receive_at()
|
||||
Button:
|
||||
size_hint: 0.5, None
|
||||
height: '48dp'
|
||||
@@ -162,14 +162,15 @@ class AddressPopup(Popup):
|
||||
|
||||
def __init__(self, parent, address, balance, status, **kwargs):
|
||||
super(AddressPopup, self).__init__(**kwargs)
|
||||
self.title = _('Address')
|
||||
self.title = _('Address Details')
|
||||
self.parent_dialog = parent
|
||||
self.app = parent.app
|
||||
self.address = address
|
||||
self.status = status
|
||||
self.script_type = self.app.wallet.get_txin_type(self.address)
|
||||
self.balance = self.app.format_amount_and_units(balance)
|
||||
|
||||
def do_use(self):
|
||||
def receive_at(self):
|
||||
self.dismiss()
|
||||
self.parent_dialog.dismiss()
|
||||
self.app.switch_to('receive')
|
||||
|
||||
@@ -59,22 +59,17 @@ Popup:
|
||||
RefLabel:
|
||||
data: app.wallet.get_master_public_key() or 'None'
|
||||
name: _('Master Public Key')
|
||||
|
||||
|
||||
TopLabel:
|
||||
id: seed_label
|
||||
text: _('This wallet is watching-only') if root.watching_only else ''
|
||||
TopLabel:
|
||||
text: _('This wallet is watching-only') if root.watching_only else _('Seed')
|
||||
RefLabel:
|
||||
id: seed_label
|
||||
data: ''
|
||||
name: _('Seed')
|
||||
on_touched: if not self.data and not root.watching_only: app.show_seed(seed_label)
|
||||
|
||||
BoxLayout:
|
||||
size_hint: 1, None
|
||||
height: '48dp'
|
||||
Button:
|
||||
size_hint: 0.5, None
|
||||
height: '48dp'
|
||||
text: '' if not root.has_seed else (_('Hide seed') if seed_label.text else _('Show seed'))
|
||||
disabled: not root.has_seed
|
||||
on_release:
|
||||
setattr(seed_label, 'text', '') if seed_label.text else app.show_seed(seed_label)
|
||||
Button:
|
||||
size_hint: 0.5, None
|
||||
height: '48dp'
|
||||
@@ -82,3 +77,9 @@ Popup:
|
||||
on_release:
|
||||
root.dismiss()
|
||||
app.delete_wallet()
|
||||
Button:
|
||||
size_hint: 0.5, None
|
||||
height: '48dp'
|
||||
text: _('Close')
|
||||
on_release:
|
||||
root.dismiss()
|
||||
|
||||
Reference in New Issue
Block a user