Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding timestamp on coins tab for easier utxo time sorting #9369

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion electrum/gui/qt/utxo_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
from electrum.bitcoin import is_address
from electrum.transaction import PartialTxInput, PartialTxOutput
from electrum.lnutil import MIN_FUNDING_SAT
from electrum.util import profiler
from electrum.util import profiler, format_time

from .util import ColorScheme, MONOSPACE_FONT, EnterButton
from .my_treeview import MyTreeView, MySortModel
Expand All @@ -56,13 +56,15 @@ class Columns(MyTreeView.BaseColumnsEnum):
LABEL = enum.auto()
AMOUNT = enum.auto()
PARENTS = enum.auto()
DATE = enum.auto()

headers = {
Columns.OUTPOINT: _('Output point'),
Columns.ADDRESS: _('Address'),
Columns.PARENTS: _('Parents'),
Columns.LABEL: _('Label'),
Columns.AMOUNT: _('Amount'),
Columns.DATE: _('Date'),
}
filter_columns = [Columns.ADDRESS, Columns.LABEL, Columns.OUTPOINT]
stretch_column = Columns.LABEL
Expand Down Expand Up @@ -109,9 +111,12 @@ def update(self):
utxo.value_sats(), whitespaces=True)
amount_str_nots = self.main_window.format_amount(
utxo.value_sats(), whitespaces=False, add_thousands_sep=False)
timestamp = self.wallet.adb.get_tx_height(utxo.prevout.txid.hex()).timestamp
date = format_time(timestamp) if timestamp else _('Unknown')
labels[self.Columns.OUTPOINT] = str(utxo.short_id)
labels[self.Columns.ADDRESS] = utxo.address
labels[self.Columns.AMOUNT] = amount_str
labels[self.Columns.DATE] = date
utxo_item = [QStandardItem(x) for x in labels]
self.set_editability(utxo_item)
utxo_item[self.Columns.OUTPOINT].setData(name, self.ROLE_PREVOUT_STR)
Expand Down