Browse Source

lightning: display remote balance in gui

dependabot/pip/contrib/deterministic-build/ecdsa-0.13.3
ThomasV 7 years ago
parent
commit
40fcf58fec
  1. 2
      electrum/gui/qt/main_window.py
  2. 1
      electrum/gui/qt/request_list.py
  3. 11
      gui/qt/channels_list.py

2
electrum/gui/qt/main_window.py

@ -1055,7 +1055,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger):
self.request_list.update()
def create_lightning_request(self, amount, message, expiration):
req = self.wallet.lnworker.add_invoice(amount)
req = self.wallet.lnworker.add_invoice(amount, message)
def create_bitcoin_request(self, amount, message, expiration):
addr = self.wallet.get_unused_address()

1
electrum/gui/qt/request_list.py

@ -157,6 +157,7 @@ class RequestList(MyTreeView):
break
else:
description = ''
date = format_time(lnaddr.date)
labels = [date, r, '', description, amount_str, '']
items = [QStandardItem(e) for e in labels]
items.setIcon(2, QIcon(":icons/lightning.png"))

11
gui/qt/channels_list.py

@ -10,19 +10,24 @@ class ChannelsList(MyTreeWidget):
update_single_row = QtCore.pyqtSignal(OpenChannel)
def __init__(self, parent):
MyTreeWidget.__init__(self, parent, self.create_menu, [_('Node ID'), _('Capacity'), _('Balance'), _('Status')], 0)
MyTreeWidget.__init__(self, parent, self.create_menu, [_('Node ID'), _('Balance'), _('Remote'), _('Status')], 0)
self.main_window = parent
self.update_rows.connect(self.do_update_rows)
self.update_single_row.connect(self.do_update_single_row)
def format_fields(self, chan):
status = self.parent.wallet.lnworker.channel_state[chan.channel_id]
return [bh2u(chan.node_id), self.parent.format_amount(chan.constraints.capacity), self.parent.format_amount(chan.local_state.amount_msat//1000), status]
return [
bh2u(chan.node_id),
self.parent.format_amount(chan.local_state.amount_msat//1000),
self.parent.format_amount(chan.remote_state.amount_msat//1000),
status
]
def create_menu(self, position):
menu = QtWidgets.QMenu()
cur = self.currentItem()
print('ID', cur.data(0, QtCore.Qt.UserRole))
print('ID', bh2u(cur.data(0, QtCore.Qt.UserRole)))
def close():
print("closechannel result", self.parent.wallet.lnworker.close_channel_from_other_thread(cur.di))
menu.addAction(_("Close channel"), close)

Loading…
Cancel
Save