commit 271d1a3f1d0548000f2aef1593cebd278367fb77
parent 99f9a1b4847422ab78799f187c46a4bde7ed34dd
Author: SomberNight <somber.night@protonmail.com>
Date: Mon, 29 Apr 2019 01:19:06 +0200
qt tx dialog: two columns for tx stats
also show "RBF", and fix "date"
Diffstat:
2 files changed, 44 insertions(+), 17 deletions(-)
diff --git a/electrum/gui/qt/transaction_dialog.py b/electrum/gui/qt/transaction_dialog.py
@@ -32,7 +32,7 @@ import traceback
from PyQt5.QtCore import QSize
from PyQt5.QtGui import QTextCharFormat, QBrush, QFont
from PyQt5.QtWidgets import (QDialog, QLabel, QPushButton, QHBoxLayout, QVBoxLayout,
- QTextEdit)
+ QTextEdit, QFrame)
import qrcode
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.setReadOnly(True)
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.sign_button = b = QPushButton(_("Sign"))
@@ -257,6 +247,8 @@ class TxDialog(QDialog, MessageBoxMixin):
self.date_label.show()
else:
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:
amount_str = _("Transaction unrelated to your wallet")
elif amount > 0:
@@ -277,9 +269,6 @@ class TxDialog(QDialog, MessageBoxMixin):
run_hook('transaction_dialog_update', self)
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())))
ext = QTextCharFormat()
rec = QTextCharFormat()
@@ -336,6 +325,44 @@ class TxDialog(QDialog, MessageBoxMixin):
cursor.insertBlock()
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):
def sizeHint(self):
diff --git a/electrum/wallet.py b/electrum/wallet.py
@@ -356,7 +356,7 @@ class Abstract_Wallet(AddressSynchronizer):
if self.db.get_transaction(tx_hash):
label = self.get_label(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 conf:
status = _("{} confirmations").format(conf)