mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-09-03 02:35:20 +00:00
kivy: improve tx dialog
This commit is contained in:
parent
ff7bdc1f38
commit
25f6533e5c
1 changed files with 19 additions and 29 deletions
|
@ -17,36 +17,28 @@ Builder.load_string('''
|
||||||
amount_str: ''
|
amount_str: ''
|
||||||
txid_str: ''
|
txid_str: ''
|
||||||
status_str: ''
|
status_str: ''
|
||||||
time_str: ''
|
|
||||||
AnchorLayout:
|
AnchorLayout:
|
||||||
anchor_x: 'center'
|
anchor_x: 'center'
|
||||||
BoxLayout:
|
BoxLayout:
|
||||||
orientation: 'vertical'
|
orientation: 'vertical'
|
||||||
|
Label:
|
||||||
|
id: status_label
|
||||||
|
text: root.status_str
|
||||||
|
text_size: self.width, None
|
||||||
|
size: self.texture_size
|
||||||
|
Label:
|
||||||
|
id: amount_label
|
||||||
|
text: root.amount_str
|
||||||
|
text_size: self.size
|
||||||
|
Label:
|
||||||
|
id: fee_label
|
||||||
|
text: root.fee_str
|
||||||
|
text_size: self.size
|
||||||
Label:
|
Label:
|
||||||
id: txid_label
|
id: txid_label
|
||||||
text: root.txid_str
|
text: root.txid_str
|
||||||
text_size: self.width, None
|
text_size: self.width, None
|
||||||
size: self.texture_size
|
size: self.texture_size
|
||||||
Label:
|
|
||||||
id: status_label
|
|
||||||
text: root.status_str
|
|
||||||
text_size: self.width, None
|
|
||||||
size_hint: 1, 0.3
|
|
||||||
Label:
|
|
||||||
id: date_label
|
|
||||||
text: root.time_str
|
|
||||||
text_size: self.width, None
|
|
||||||
size_hint: 1, 0.3
|
|
||||||
Label:
|
|
||||||
id: amount_label
|
|
||||||
text: root.amount_str
|
|
||||||
text_size: self.width, None
|
|
||||||
size_hint: 1, 0.3
|
|
||||||
Label:
|
|
||||||
id: fee_label
|
|
||||||
text: root.fee_str
|
|
||||||
text_size: self.width, None
|
|
||||||
size_hint: 1, 0.3
|
|
||||||
Widget:
|
Widget:
|
||||||
size_hint: 1, 1
|
size_hint: 1, 1
|
||||||
BoxLayout:
|
BoxLayout:
|
||||||
|
@ -56,15 +48,15 @@ Builder.load_string('''
|
||||||
size_hint: 0.5, None
|
size_hint: 0.5, None
|
||||||
height: '48dp'
|
height: '48dp'
|
||||||
text: _('Sign') if root.can_sign else _('Broadcast') if root.can_broadcast else ''
|
text: _('Sign') if root.can_sign else _('Broadcast') if root.can_broadcast else ''
|
||||||
#opacity: 1 if root.can_sign or root.can_broadcast else 0
|
opacity: 1 if root.can_sign or root.can_broadcast else 0
|
||||||
disabled: not( root.can_sign or root.can_broadcast )
|
disabled: not( root.can_sign or root.can_broadcast )
|
||||||
on_release:
|
on_release:
|
||||||
if root.can_sign: root.do_sign()
|
if root.can_sign: root.do_sign()
|
||||||
if root.can_broadcast: root.do_broadcast()
|
if root.can_broadcast: root.do_broadcast()
|
||||||
Button:
|
IconButton:
|
||||||
size_hint: 0.5, None
|
size_hint: 0.5, None
|
||||||
height: '48dp'
|
height: '48dp'
|
||||||
text: _('QR')
|
icon: 'atlas://gui/kivy/theming/light/qrcode'
|
||||||
on_release: root.show_qr()
|
on_release: root.show_qr()
|
||||||
Button:
|
Button:
|
||||||
size_hint: 0.5, None
|
size_hint: 0.5, None
|
||||||
|
@ -89,16 +81,14 @@ class TxDialog(Factory.Popup):
|
||||||
self.txid_str = _('Transaction ID') + ' :\n' + ' '.join(map(''.join, zip(*[iter(tx_hash)]*4)))
|
self.txid_str = _('Transaction ID') + ' :\n' + ' '.join(map(''.join, zip(*[iter(tx_hash)]*4)))
|
||||||
if tx_hash in self.wallet.transactions.keys():
|
if tx_hash in self.wallet.transactions.keys():
|
||||||
conf, timestamp = self.wallet.get_confirmations(tx_hash)
|
conf, timestamp = self.wallet.get_confirmations(tx_hash)
|
||||||
self.status_str = _("%d confirmations")%conf
|
self.status_str = _("%d confirmations")%conf if conf else _('Pending')
|
||||||
if timestamp:
|
if timestamp:
|
||||||
self.time_str = datetime.fromtimestamp(timestamp).isoformat(' ')[:-3]
|
self.status_str += '\n' + _("Date") + ': ' + datetime.fromtimestamp(timestamp).isoformat(' ')[:-3]
|
||||||
else:
|
|
||||||
self.time_str = _('Pending')
|
|
||||||
else:
|
else:
|
||||||
self.can_broadcast = self.app.network is not None
|
self.can_broadcast = self.app.network is not None
|
||||||
else:
|
else:
|
||||||
s, r = self.tx.signature_count()
|
s, r = self.tx.signature_count()
|
||||||
self.txid_str = _("Unsigned") if s == 0 else _('Partially signed') + ' (%d/%d)'%(s,r)
|
self.status_str = _("Unsigned") if s == 0 else _('Partially signed') + ' (%d/%d)'%(s,r)
|
||||||
|
|
||||||
is_relevant, is_mine, v, fee = self.wallet.get_wallet_delta(self.tx)
|
is_relevant, is_mine, v, fee = self.wallet.get_wallet_delta(self.tx)
|
||||||
if is_relevant:
|
if is_relevant:
|
||||||
|
|
Loading…
Add table
Reference in a new issue