Browse Source

improve channels_list menus (minor)

patch-4
ThomasV 3 years ago
parent
commit
3e0d7ff549
  1. 39
      electrum/gui/qt/channels_list.py
  2. 2
      electrum/gui/qt/util.py

39
electrum/gui/qt/channels_list.py

@ -234,37 +234,38 @@ class ChannelsList(MyTreeView):
return
chan = self.lnworker.channels[channel_id]
menu.addAction(_("Details..."), lambda: self.parent.show_channel(channel_id))
funding_tx = self.parent.wallet.db.get_transaction(chan.funding_outpoint.txid)
if funding_tx:
menu.addAction(_("View funding transaction"), lambda: self.parent.show_transaction(funding_tx))
if chan.is_closed():
item = chan.get_closing_height()
if item:
txid, height, timestamp = item
closing_tx = self.lnworker.lnwatcher.db.get_transaction(txid)
if closing_tx:
menu.addAction(_("View closing transaction"), lambda: self.parent.show_transaction(closing_tx))
menu.addSeparator()
cc = self.add_copy_menu(menu, idx)
cc.addAction(_("Node ID"), lambda: self.place_text_on_clipboard(
chan.node_id.hex(), title=_("Node ID")))
cc.addAction(_("Long Channel ID"), lambda: self.place_text_on_clipboard(
channel_id.hex(), title=_("Long Channel ID")))
if not chan.is_closed():
fm = menu.addMenu(_("Freeze"))
if not chan.is_frozen_for_sending():
menu.addAction(_("Freeze (for sending)"), lambda: self.freeze_channel_for_sending(chan, True)) #
fm.addAction(_("Freeze for sending"), lambda: self.freeze_channel_for_sending(chan, True))
else:
menu.addAction(_("Unfreeze (for sending)"), lambda: self.freeze_channel_for_sending(chan, False))
fm.addAction(_("Unfreeze for sending"), lambda: self.freeze_channel_for_sending(chan, False))
if not chan.is_frozen_for_receiving():
menu.addAction(_("Freeze (for receiving)"), lambda: chan.set_frozen_for_receiving(True))
fm.addAction(_("Freeze for receiving"), lambda: chan.set_frozen_for_receiving(True))
else:
menu.addAction(_("Unfreeze (for receiving)"), lambda: chan.set_frozen_for_receiving(False))
funding_tx = self.parent.wallet.db.get_transaction(chan.funding_outpoint.txid)
if funding_tx:
menu.addAction(_("View funding transaction"), lambda: self.parent.show_transaction(funding_tx))
fm.addAction(_("Unfreeze for receiving"), lambda: chan.set_frozen_for_receiving(False))
if not chan.is_closed():
menu.addSeparator()
cm = menu.addMenu(_("Close"))
if chan.peer_state == PeerState.GOOD:
menu.addAction(_("Close channel"), lambda: self.close_channel(channel_id))
menu.addAction(_("Force-close channel"), lambda: self.force_close(channel_id))
else:
item = chan.get_closing_height()
if item:
txid, height, timestamp = item
closing_tx = self.lnworker.lnwatcher.db.get_transaction(txid)
if closing_tx:
menu.addAction(_("View closing transaction"), lambda: self.parent.show_transaction(closing_tx))
menu.addSeparator()
cm.addAction(_("Cooperative close"), lambda: self.close_channel(channel_id))
cm.addAction(_("Force-close"), lambda: self.force_close(channel_id))
menu.addAction(_("Export backup"), lambda: self.export_channel_backup(channel_id))
if chan.can_be_deleted():
menu.addSeparator()

2
electrum/gui/qt/util.py

@ -757,7 +757,7 @@ class MyTreeView(QTreeView):
self.show_toolbar(not self.toolbar_shown, config)
def add_copy_menu(self, menu: QMenu, idx) -> QMenu:
cc = menu.addMenu(_("Copy"))
cc = menu.addMenu(_("Copy Column"))
for column in self.Columns:
column_title = self.original_model().horizontalHeaderItem(column).text()
if not column_title:

Loading…
Cancel
Save