Browse Source

qt tx dialog: two columns for tx stats

also show "RBF", and fix "date"
regtest_lnd
SomberNight 6 years ago
parent
commit
271d1a3f1d
No known key found for this signature in database GPG Key ID: B33B5F232C6271E9
  1. 59
      electrum/gui/qt/transaction_dialog.py
  2. 2
      electrum/wallet.py

59
electrum/gui/qt/transaction_dialog.py

@ -32,7 +32,7 @@ import traceback
from PyQt5.QtCore import QSize from PyQt5.QtCore import QSize
from PyQt5.QtGui import QTextCharFormat, QBrush, QFont from PyQt5.QtGui import QTextCharFormat, QBrush, QFont
from PyQt5.QtWidgets import (QDialog, QLabel, QPushButton, QHBoxLayout, QVBoxLayout, from PyQt5.QtWidgets import (QDialog, QLabel, QPushButton, QHBoxLayout, QVBoxLayout,
QTextEdit) QTextEdit, QFrame)
import qrcode import qrcode
from qrcode import exceptions from qrcode import exceptions
@ -105,19 +105,9 @@ class TxDialog(QDialog, MessageBoxMixin):
self.tx_hash_e.addButton(qr_icon, qr_show, _("Show as QR code")) self.tx_hash_e.addButton(qr_icon, qr_show, _("Show as QR code"))
self.tx_hash_e.setReadOnly(True) self.tx_hash_e.setReadOnly(True)
vbox.addWidget(self.tx_hash_e) vbox.addWidget(self.tx_hash_e)
self.tx_desc = QLabel()
vbox.addWidget(self.tx_desc)
self.status_label = QLabel()
vbox.addWidget(self.status_label)
self.date_label = QLabel()
vbox.addWidget(self.date_label)
self.amount_label = QLabel()
vbox.addWidget(self.amount_label)
self.size_label = QLabel()
vbox.addWidget(self.size_label)
self.fee_label = QLabel()
vbox.addWidget(self.fee_label)
self.add_tx_stats(vbox)
vbox.addSpacing(10)
self.add_io(vbox) self.add_io(vbox)
self.sign_button = b = QPushButton(_("Sign")) self.sign_button = b = QPushButton(_("Sign"))
@ -257,6 +247,8 @@ class TxDialog(QDialog, MessageBoxMixin):
self.date_label.show() self.date_label.show()
else: else:
self.date_label.hide() self.date_label.hide()
self.locktime_label.setText(f"LockTime: {self.tx.locktime}")
self.rbf_label.setText(f"RBF: {not self.tx.is_final()}")
if amount is None: if amount is None:
amount_str = _("Transaction unrelated to your wallet") amount_str = _("Transaction unrelated to your wallet")
elif amount > 0: elif amount > 0:
@ -277,9 +269,6 @@ class TxDialog(QDialog, MessageBoxMixin):
run_hook('transaction_dialog_update', self) run_hook('transaction_dialog_update', self)
def add_io(self, vbox): def add_io(self, vbox):
if self.tx.locktime > 0:
vbox.addWidget(QLabel("LockTime: %d\n" % self.tx.locktime))
vbox.addWidget(QLabel(_("Inputs") + ' (%d)'%len(self.tx.inputs()))) vbox.addWidget(QLabel(_("Inputs") + ' (%d)'%len(self.tx.inputs())))
ext = QTextCharFormat() ext = QTextCharFormat()
rec = QTextCharFormat() rec = QTextCharFormat()
@ -336,6 +325,44 @@ class TxDialog(QDialog, MessageBoxMixin):
cursor.insertBlock() cursor.insertBlock()
vbox.addWidget(o_text) vbox.addWidget(o_text)
def add_tx_stats(self, vbox):
hbox_stats = QHBoxLayout()
# left column
vbox_left = QVBoxLayout()
self.tx_desc = QLabel()
vbox_left.addWidget(self.tx_desc)
self.status_label = QLabel()
vbox_left.addWidget(self.status_label)
self.date_label = QLabel()
vbox_left.addWidget(self.date_label)
self.amount_label = QLabel()
vbox_left.addWidget(self.amount_label)
vbox_left.addStretch(1)
hbox_stats.addLayout(vbox_left, 50)
# vertical line separator
line_separator = QFrame()
line_separator.setFrameShape(QFrame.VLine)
line_separator.setFrameShadow(QFrame.Sunken)
line_separator.setLineWidth(1)
hbox_stats.addWidget(line_separator)
# right column
vbox_right = QVBoxLayout()
self.size_label = QLabel()
vbox_right.addWidget(self.size_label)
self.fee_label = QLabel()
vbox_right.addWidget(self.fee_label)
self.rbf_label = QLabel()
vbox_right.addWidget(self.rbf_label)
self.locktime_label = QLabel()
vbox_right.addWidget(self.locktime_label)
vbox_right.addStretch(1)
hbox_stats.addLayout(vbox_right, 50)
vbox.addLayout(hbox_stats)
class QTextEditWithDefaultSize(QTextEdit): class QTextEditWithDefaultSize(QTextEdit):
def sizeHint(self): def sizeHint(self):

2
electrum/wallet.py

@ -356,7 +356,7 @@ class Abstract_Wallet(AddressSynchronizer):
if self.db.get_transaction(tx_hash): if self.db.get_transaction(tx_hash):
label = self.get_label(tx_hash) label = self.get_label(tx_hash)
tx_mined_status = self.get_tx_height(tx_hash) tx_mined_status = self.get_tx_height(tx_hash)
height, conf = tx_mined_status.height, tx_mined_status.conf height, conf, timestamp = tx_mined_status.height, tx_mined_status.conf, tx_mined_status.timestamp
if height > 0: if height > 0:
if conf: if conf:
status = _("{} confirmations").format(conf) status = _("{} confirmations").format(conf)

Loading…
Cancel
Save