Browse Source

kivy: improve tx dialog

283
ThomasV 9 years ago
parent
commit
25f6533e5c
  1. 36
      gui/kivy/uix/dialogs/tx_dialog.py

36
gui/kivy/uix/dialogs/tx_dialog.py

@ -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: txid_label
text: root.txid_str
text_size: self.width, None
size: self.texture_size
Label: Label:
id: status_label id: status_label
text: root.status_str text: root.status_str
text_size: self.width, None text_size: self.width, None
size_hint: 1, 0.3 size: self.texture_size
Label:
id: date_label
text: root.time_str
text_size: self.width, None
size_hint: 1, 0.3
Label: Label:
id: amount_label id: amount_label
text: root.amount_str text: root.amount_str
text_size: self.width, None text_size: self.size
size_hint: 1, 0.3
Label: Label:
id: fee_label id: fee_label
text: root.fee_str text: root.fee_str
text_size: self.size
Label:
id: txid_label
text: root.txid_str
text_size: self.width, None text_size: self.width, None
size_hint: 1, 0.3 size: self.texture_size
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…
Cancel
Save