Browse Source

Qt lists: consistently show Details as first item in the contextual menu

master
ThomasV 3 years ago
parent
commit
b431d39a8e
  1. 2
      electrum/gui/qt/address_list.py
  2. 2
      electrum/gui/qt/channels_list.py
  3. 4
      electrum/gui/qt/history_list.py
  4. 2
      electrum/gui/qt/invoice_list.py
  5. 6
      electrum/gui/qt/utxo_list.py

2
electrum/gui/qt/address_list.py

@ -282,10 +282,10 @@ class AddressList(MyTreeView):
if not item: if not item:
return return
addr = addrs[0] addr = addrs[0]
menu.addAction(_('Details'), lambda: self.main_window.show_address(addr))
addr_column_title = self.std_model.horizontalHeaderItem(self.Columns.LABEL).text() addr_column_title = self.std_model.horizontalHeaderItem(self.Columns.LABEL).text()
addr_idx = idx.sibling(idx.row(), self.Columns.LABEL) addr_idx = idx.sibling(idx.row(), self.Columns.LABEL)
self.add_copy_menu(menu, idx) self.add_copy_menu(menu, idx)
menu.addAction(_('Details'), lambda: self.main_window.show_address(addr))
persistent = QPersistentModelIndex(addr_idx) persistent = QPersistentModelIndex(addr_idx)
menu.addAction(_("Edit {}").format(addr_column_title), lambda p=persistent: self.edit(QModelIndex(p))) menu.addAction(_("Edit {}").format(addr_column_title), lambda p=persistent: self.edit(QModelIndex(p)))
#menu.addAction(_("Request payment"), lambda: self.main_window.receive_at(addr)) #menu.addAction(_("Request payment"), lambda: self.main_window.receive_at(addr))

2
electrum/gui/qt/channels_list.py

@ -245,7 +245,7 @@ class ChannelsList(MyTreeView):
return return
channel_id = idx.sibling(idx.row(), self.Columns.NODE_ALIAS).data(ROLE_CHANNEL_ID) channel_id = idx.sibling(idx.row(), self.Columns.NODE_ALIAS).data(ROLE_CHANNEL_ID)
chan = self.lnworker.get_channel_by_id(channel_id) or self.lnworker.channel_backups[channel_id] chan = self.lnworker.get_channel_by_id(channel_id) or self.lnworker.channel_backups[channel_id]
menu.addAction(_("Details..."), lambda: self.main_window.show_channel_details(chan)) menu.addAction(_("Details"), lambda: self.main_window.show_channel_details(chan))
menu.addSeparator() menu.addSeparator()
cc = self.add_copy_menu(menu, idx) cc = self.add_copy_menu(menu, idx)
cc.addAction(_("Node ID"), lambda: self.place_text_on_clipboard( cc.addAction(_("Node ID"), lambda: self.place_text_on_clipboard(

4
electrum/gui/qt/history_list.py

@ -743,7 +743,7 @@ class HistoryList(MyTreeView, AcceptFileDragDrop):
tx_item = idx.internalPointer().get_data() tx_item = idx.internalPointer().get_data()
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.main_window.show_lightning_transaction(tx_item)) menu.addAction(_("Details"), lambda: self.main_window.show_lightning_transaction(tx_item))
cc = 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(_("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")) cc.addAction(_("Preimage"), lambda: self.place_text_on_clipboard(tx_item['preimage'], title="Preimage"))
@ -761,6 +761,7 @@ class HistoryList(MyTreeView, AcceptFileDragDrop):
tx_details = self.wallet.get_tx_info(tx) tx_details = self.wallet.get_tx_info(tx)
is_unconfirmed = tx_details.tx_mined_status.height <= 0 is_unconfirmed = tx_details.tx_mined_status.height <= 0
menu = QMenu() menu = QMenu()
menu.addAction(_("Details"), lambda: self.main_window.show_transaction(tx))
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))
copy_menu = self.add_copy_menu(menu, idx) copy_menu = self.add_copy_menu(menu, idx)
@ -772,7 +773,6 @@ class HistoryList(MyTreeView, AcceptFileDragDrop):
# 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_edit.addAction(_("{}").format(label), lambda p=persistent: self.edit(QModelIndex(p))) menu_edit.addAction(_("{}").format(label), lambda p=persistent: self.edit(QModelIndex(p)))
menu.addAction(_("View Transaction"), lambda: self.main_window.show_transaction(tx))
channel_id = tx_item.get('channel_id') channel_id = tx_item.get('channel_id')
if channel_id and self.wallet.lnworker and (chan := self.wallet.lnworker.get_channel_by_id(bytes.fromhex(channel_id))): if channel_id and self.wallet.lnworker and (chan := self.wallet.lnworker.get_channel_by_id(bytes.fromhex(channel_id))):
menu.addAction(_("View Channel"), lambda: self.main_window.show_channel_details(chan)) menu.addAction(_("View Channel"), lambda: self.main_window.show_channel_details(chan))

2
electrum/gui/qt/invoice_list.py

@ -170,11 +170,11 @@ class InvoiceList(MyTreeView):
key = item_col0.data(ROLE_REQUEST_ID) key = item_col0.data(ROLE_REQUEST_ID)
invoice = self.wallet.get_invoice(key) invoice = self.wallet.get_invoice(key)
menu = QMenu(self) menu = QMenu(self)
menu.addAction(_("Details"), lambda: self.show_invoice(key))
copy_menu = self.add_copy_menu(menu, idx) copy_menu = self.add_copy_menu(menu, idx)
address = invoice.get_address() address = invoice.get_address()
if address: if address:
copy_menu.addAction(_("Address"), lambda: self.main_window.do_copy(invoice.get_address(), title='Bitcoin Address')) copy_menu.addAction(_("Address"), lambda: self.main_window.do_copy(invoice.get_address(), title='Bitcoin Address'))
menu.addAction(_("Details"), lambda: self.show_invoice(key))
status = wallet.get_invoice_status(invoice) status = wallet.get_invoice_status(invoice)
if status == PR_UNPAID: if status == PR_UNPAID:
menu.addAction(_("Pay") + "...", lambda: self.send_tab.do_pay_invoice(invoice)) menu.addAction(_("Pay") + "...", lambda: self.send_tab.do_pay_invoice(invoice))

6
electrum/gui/qt/utxo_list.py

@ -281,13 +281,13 @@ class UTXOList(MyTreeView):
return return
utxo = coins[0] utxo = coins[0]
txid = utxo.prevout.txid.hex() txid = utxo.prevout.txid.hex()
cc = self.add_copy_menu(menu, idx)
cc.addAction(_("Long Output point"), lambda: self.place_text_on_clipboard(utxo.prevout.to_str(), title="Long Output point"))
# "Details" # "Details"
tx = self.wallet.adb.get_transaction(txid) tx = self.wallet.adb.get_transaction(txid)
if tx: if tx:
label = self.wallet.get_label_for_txid(txid) label = self.wallet.get_label_for_txid(txid)
menu.addAction(_("Privacy analysis"), lambda: self.main_window.show_utxo(utxo)) menu.addAction(_("Details"), lambda: self.main_window.show_utxo(utxo))
cc = self.add_copy_menu(menu, idx)
cc.addAction(_("Long Output point"), lambda: self.place_text_on_clipboard(utxo.prevout.to_str(), title="Long Output point"))
# fully spend # fully spend
menu_spend = menu.addMenu(_("Fully spend") + '') menu_spend = menu.addMenu(_("Fully spend") + '')
m = menu_spend.addAction(_("send to address in clipboard"), lambda: self.pay_to_clipboard_address(coins)) m = menu_spend.addAction(_("send to address in clipboard"), lambda: self.pay_to_clipboard_address(coins))

Loading…
Cancel
Save