Qt history list: Ctrl+F filter to work for "Short ID" (scid)
This commit is contained in:
@@ -88,6 +88,8 @@ class HistoryColumns(IntEnum):
|
|||||||
FIAT_ACQ_PRICE = 5
|
FIAT_ACQ_PRICE = 5
|
||||||
FIAT_CAP_GAINS = 6
|
FIAT_CAP_GAINS = 6
|
||||||
TXID = 7
|
TXID = 7
|
||||||
|
SHORT_ID = 8 # ~SCID
|
||||||
|
|
||||||
|
|
||||||
class HistorySortModel(QSortFilterProxyModel):
|
class HistorySortModel(QSortFilterProxyModel):
|
||||||
def lessThan(self, source_left: QModelIndex, source_right: QModelIndex):
|
def lessThan(self, source_left: QModelIndex, source_right: QModelIndex):
|
||||||
@@ -121,6 +123,7 @@ class HistoryNode(CustomNode):
|
|||||||
tx_item = self.get_data()
|
tx_item = self.get_data()
|
||||||
is_lightning = tx_item.get('lightning', False)
|
is_lightning = tx_item.get('lightning', False)
|
||||||
timestamp = tx_item['timestamp']
|
timestamp = tx_item['timestamp']
|
||||||
|
short_id = None
|
||||||
if is_lightning:
|
if is_lightning:
|
||||||
status = 0
|
status = 0
|
||||||
if timestamp is None:
|
if timestamp is None:
|
||||||
@@ -129,6 +132,9 @@ class HistoryNode(CustomNode):
|
|||||||
status_str = format_time(int(timestamp))
|
status_str = format_time(int(timestamp))
|
||||||
else:
|
else:
|
||||||
tx_hash = tx_item['txid']
|
tx_hash = tx_item['txid']
|
||||||
|
txpos_in_block = tx_item.get('txpos_in_block')
|
||||||
|
if txpos_in_block is not None and txpos_in_block >= 0:
|
||||||
|
short_id = f"{tx_item['height']}x{txpos_in_block}"
|
||||||
conf = tx_item['confirmations']
|
conf = tx_item['confirmations']
|
||||||
try:
|
try:
|
||||||
status, status_str = self.model.tx_status_cache[tx_hash]
|
status, status_str = self.model.tx_status_cache[tx_hash]
|
||||||
@@ -155,6 +161,7 @@ class HistoryNode(CustomNode):
|
|||||||
HistoryColumns.FIAT_CAP_GAINS:
|
HistoryColumns.FIAT_CAP_GAINS:
|
||||||
tx_item['capital_gain'].value if 'capital_gain' in tx_item else None,
|
tx_item['capital_gain'].value if 'capital_gain' in tx_item else None,
|
||||||
HistoryColumns.TXID: tx_hash if not is_lightning else None,
|
HistoryColumns.TXID: tx_hash if not is_lightning else None,
|
||||||
|
HistoryColumns.SHORT_ID: short_id,
|
||||||
}
|
}
|
||||||
return QVariant(d[col])
|
return QVariant(d[col])
|
||||||
if role == MyTreeView.ROLE_EDIT_KEY:
|
if role == MyTreeView.ROLE_EDIT_KEY:
|
||||||
@@ -219,6 +226,8 @@ class HistoryNode(CustomNode):
|
|||||||
return QVariant(window.fx.format_fiat(cg))
|
return QVariant(window.fx.format_fiat(cg))
|
||||||
elif col == HistoryColumns.TXID:
|
elif col == HistoryColumns.TXID:
|
||||||
return QVariant(tx_hash) if not is_lightning else QVariant('')
|
return QVariant(tx_hash) if not is_lightning else QVariant('')
|
||||||
|
elif col == HistoryColumns.SHORT_ID:
|
||||||
|
return QVariant(short_id or "")
|
||||||
return QVariant()
|
return QVariant()
|
||||||
|
|
||||||
|
|
||||||
@@ -350,6 +359,7 @@ class HistoryModel(CustomModel, Logger):
|
|||||||
self.view.showColumn(col) if b else self.view.hideColumn(col)
|
self.view.showColumn(col) if b else self.view.hideColumn(col)
|
||||||
# txid
|
# txid
|
||||||
set_visible(HistoryColumns.TXID, False)
|
set_visible(HistoryColumns.TXID, False)
|
||||||
|
set_visible(HistoryColumns.SHORT_ID, False)
|
||||||
# fiat
|
# fiat
|
||||||
history = self.window.fx.show_history()
|
history = self.window.fx.show_history()
|
||||||
cap_gains = self.window.fx.get_history_capital_gains_config()
|
cap_gains = self.window.fx.get_history_capital_gains_config()
|
||||||
@@ -415,6 +425,7 @@ class HistoryModel(CustomModel, Logger):
|
|||||||
HistoryColumns.FIAT_ACQ_PRICE: fiat_acq_title,
|
HistoryColumns.FIAT_ACQ_PRICE: fiat_acq_title,
|
||||||
HistoryColumns.FIAT_CAP_GAINS: fiat_cg_title,
|
HistoryColumns.FIAT_CAP_GAINS: fiat_cg_title,
|
||||||
HistoryColumns.TXID: 'TXID',
|
HistoryColumns.TXID: 'TXID',
|
||||||
|
HistoryColumns.SHORT_ID: 'Short ID',
|
||||||
}[section]
|
}[section]
|
||||||
|
|
||||||
def flags(self, idx: QModelIndex) -> int:
|
def flags(self, idx: QModelIndex) -> int:
|
||||||
@@ -436,10 +447,13 @@ class HistoryModel(CustomModel, Logger):
|
|||||||
|
|
||||||
|
|
||||||
class HistoryList(MyTreeView, AcceptFileDragDrop):
|
class HistoryList(MyTreeView, AcceptFileDragDrop):
|
||||||
filter_columns = [HistoryColumns.STATUS,
|
filter_columns = [
|
||||||
HistoryColumns.DESCRIPTION,
|
HistoryColumns.STATUS,
|
||||||
HistoryColumns.AMOUNT,
|
HistoryColumns.DESCRIPTION,
|
||||||
HistoryColumns.TXID]
|
HistoryColumns.AMOUNT,
|
||||||
|
HistoryColumns.TXID,
|
||||||
|
HistoryColumns.SHORT_ID,
|
||||||
|
]
|
||||||
|
|
||||||
def tx_item_from_proxy_row(self, proxy_row):
|
def tx_item_from_proxy_row(self, proxy_row):
|
||||||
hm_idx = self.model().mapToSource(self.model().index(proxy_row, 0))
|
hm_idx = self.model().mapToSource(self.model().index(proxy_row, 0))
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ from .qrtextedit import ShowQRTextEdit
|
|||||||
from .transaction_dialog import TxOutputColoring, QTextBrowserWithDefaultSize
|
from .transaction_dialog import TxOutputColoring, QTextBrowserWithDefaultSize
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
|
from electrum.transaction import PartialTxInput
|
||||||
from .main_window import ElectrumWindow
|
from .main_window import ElectrumWindow
|
||||||
|
|
||||||
# todo:
|
# todo:
|
||||||
@@ -46,7 +47,7 @@ if TYPE_CHECKING:
|
|||||||
|
|
||||||
class UTXODialog(WindowModalDialog):
|
class UTXODialog(WindowModalDialog):
|
||||||
|
|
||||||
def __init__(self, window: 'ElectrumWindow', utxo):
|
def __init__(self, window: 'ElectrumWindow', utxo: 'PartialTxInput'):
|
||||||
WindowModalDialog.__init__(self, window, _("Coin Privacy Analysis"))
|
WindowModalDialog.__init__(self, window, _("Coin Privacy Analysis"))
|
||||||
self.main_window = window
|
self.main_window = window
|
||||||
self.config = window.config
|
self.config = window.config
|
||||||
|
|||||||
@@ -905,7 +905,8 @@ class LNWallet(LNWorker):
|
|||||||
'fee_msat': None,
|
'fee_msat': None,
|
||||||
'height': tx_height.height,
|
'height': tx_height.height,
|
||||||
'confirmations': tx_height.conf,
|
'confirmations': tx_height.conf,
|
||||||
}
|
'txpos_in_block': tx_height.txpos,
|
||||||
|
} # FIXME this data structure needs to be kept in ~sync with wallet.get_onchain_history
|
||||||
out[funding_txid] = item
|
out[funding_txid] = item
|
||||||
item = chan.get_closing_height()
|
item = chan.get_closing_height()
|
||||||
if item is None:
|
if item is None:
|
||||||
@@ -926,7 +927,8 @@ class LNWallet(LNWorker):
|
|||||||
'fee_msat': None,
|
'fee_msat': None,
|
||||||
'height': tx_height.height,
|
'height': tx_height.height,
|
||||||
'confirmations': tx_height.conf,
|
'confirmations': tx_height.conf,
|
||||||
}
|
'txpos_in_block': tx_height.txpos,
|
||||||
|
} # FIXME this data structure needs to be kept in ~sync with wallet.get_onchain_history
|
||||||
out[closing_txid] = item
|
out[closing_txid] = item
|
||||||
# add info about submarine swaps
|
# add info about submarine swaps
|
||||||
settled_payments = self.get_payments(status='settled')
|
settled_payments = self.get_payments(status='settled')
|
||||||
|
|||||||
Reference in New Issue
Block a user