mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-28 16:01:30 +00:00
qt: add extra fields to copy submenus
This commit is contained in:
parent
e48c7d01cd
commit
17a893441a
1 changed files with 13 additions and 9 deletions
|
@ -609,9 +609,11 @@ class HistoryList(MyTreeView, AcceptFileDragDrop):
|
||||||
column_title = self.hm.headerData(column, Qt.Horizontal, Qt.DisplayRole)
|
column_title = self.hm.headerData(column, Qt.Horizontal, Qt.DisplayRole)
|
||||||
idx2 = idx.sibling(idx.row(), column)
|
idx2 = idx.sibling(idx.row(), column)
|
||||||
column_data = (self.hm.data(idx2, Qt.DisplayRole).value() or '').strip()
|
column_data = (self.hm.data(idx2, Qt.DisplayRole).value() or '').strip()
|
||||||
cc.addAction(column_title,
|
cc.addAction(
|
||||||
|
column_title,
|
||||||
lambda text=column_data, title=column_title:
|
lambda text=column_data, title=column_title:
|
||||||
self.place_text_on_clipboard(text, title=title))
|
self.place_text_on_clipboard(text, title=title))
|
||||||
|
return cc
|
||||||
|
|
||||||
def create_menu(self, position: QPoint):
|
def create_menu(self, position: QPoint):
|
||||||
org_idx: QModelIndex = self.indexAt(position)
|
org_idx: QModelIndex = self.indexAt(position)
|
||||||
|
@ -622,8 +624,10 @@ class HistoryList(MyTreeView, AcceptFileDragDrop):
|
||||||
tx_item = self.hm.transactions.value_from_pos(idx.row())
|
tx_item = self.hm.transactions.value_from_pos(idx.row())
|
||||||
if tx_item.get('lightning') and tx_item['type'] == 'payment':
|
if tx_item.get('lightning') and tx_item['type'] == 'payment':
|
||||||
menu = QMenu()
|
menu = QMenu()
|
||||||
menu.addAction(_("View payment"), lambda: self.parent.show_lightning_transaction(tx_item))
|
menu.addAction(_("View Payment"), lambda: self.parent.show_lightning_transaction(tx_item))
|
||||||
self.add_copy_menu(menu, idx)
|
cc = self.add_copy_menu(menu, idx)
|
||||||
|
cc.addAction(_("Payment Hash"), lambda: self.place_text_on_clipboard(tx_item['payment_hash'], title="Payment Hash"))
|
||||||
|
cc.addAction(_("Preimage"), lambda: self.place_text_on_clipboard(tx_item['preimage'], title="Preimage"))
|
||||||
menu.exec_(self.viewport().mapToGlobal(position))
|
menu.exec_(self.viewport().mapToGlobal(position))
|
||||||
return
|
return
|
||||||
tx_hash = tx_item['txid']
|
tx_hash = tx_item['txid']
|
||||||
|
@ -640,18 +644,18 @@ class HistoryList(MyTreeView, AcceptFileDragDrop):
|
||||||
menu = QMenu()
|
menu = QMenu()
|
||||||
if tx_details.can_remove:
|
if tx_details.can_remove:
|
||||||
menu.addAction(_("Remove"), lambda: self.remove_local_tx(tx_hash))
|
menu.addAction(_("Remove"), lambda: self.remove_local_tx(tx_hash))
|
||||||
menu.addAction(_("Copy Transaction ID"), lambda: self.place_text_on_clipboard(tx_hash, title="TXID"))
|
cc = self.add_copy_menu(menu, idx)
|
||||||
self.add_copy_menu(menu, idx)
|
cc.addAction(_("Transaction ID"), lambda: self.place_text_on_clipboard(tx_hash, title="TXID"))
|
||||||
for c in self.editable_columns:
|
for c in self.editable_columns:
|
||||||
if self.isColumnHidden(c): continue
|
if self.isColumnHidden(c): continue
|
||||||
label = self.hm.headerData(c, Qt.Horizontal, Qt.DisplayRole)
|
label = self.hm.headerData(c, Qt.Horizontal, Qt.DisplayRole)
|
||||||
# TODO use siblingAtColumn when min Qt version is >=5.11
|
# TODO use siblingAtColumn when min Qt version is >=5.11
|
||||||
persistent = QPersistentModelIndex(org_idx.sibling(org_idx.row(), c))
|
persistent = QPersistentModelIndex(org_idx.sibling(org_idx.row(), c))
|
||||||
menu.addAction(_("Edit {}").format(label), lambda p=persistent: self.edit(QModelIndex(p)))
|
menu.addAction(_("Edit {}").format(label), lambda p=persistent: self.edit(QModelIndex(p)))
|
||||||
menu.addAction(_("View transaction"), lambda: self.show_transaction(tx_item, tx))
|
menu.addAction(_("View Transaction"), lambda: self.show_transaction(tx_item, tx))
|
||||||
channel_id = tx_item.get('channel_id')
|
channel_id = tx_item.get('channel_id')
|
||||||
if channel_id:
|
if channel_id:
|
||||||
menu.addAction(_("View channel"), lambda: self.parent.show_channel(bytes.fromhex(channel_id)))
|
menu.addAction(_("View Channel"), lambda: self.parent.show_channel(bytes.fromhex(channel_id)))
|
||||||
if is_unconfirmed and tx:
|
if is_unconfirmed and tx:
|
||||||
# note: the current implementation of RBF *needs* the old tx fee
|
# note: the current implementation of RBF *needs* the old tx fee
|
||||||
if tx_details.can_bump and tx_details.fee is not None:
|
if tx_details.can_bump and tx_details.fee is not None:
|
||||||
|
|
Loading…
Add table
Reference in a new issue