mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-28 16:01:30 +00:00
lightning: display remote balance in gui
This commit is contained in:
parent
11ef5c4c4a
commit
3dc8c08f6b
3 changed files with 10 additions and 4 deletions
|
@ -980,7 +980,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
|
||||||
self.request_list.update()
|
self.request_list.update()
|
||||||
|
|
||||||
def create_lightning_request(self, amount, message, expiration):
|
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):
|
def create_bitcoin_request(self, amount, message, expiration):
|
||||||
addr = self.wallet.get_unused_address()
|
addr = self.wallet.get_unused_address()
|
||||||
|
|
|
@ -130,6 +130,7 @@ class RequestList(MyTreeWidget):
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
description = ''
|
description = ''
|
||||||
|
date = format_time(lnaddr.date)
|
||||||
item = QTreeWidgetItem([date, r, description, amount_str, ''])
|
item = QTreeWidgetItem([date, r, description, amount_str, ''])
|
||||||
item.setIcon(1, QIcon(":icons/lightning.png"))
|
item.setIcon(1, QIcon(":icons/lightning.png"))
|
||||||
self.addTopLevelItem(item)
|
self.addTopLevelItem(item)
|
||||||
|
|
|
@ -10,19 +10,24 @@ class ChannelsList(MyTreeWidget):
|
||||||
update_single_row = QtCore.pyqtSignal(OpenChannel)
|
update_single_row = QtCore.pyqtSignal(OpenChannel)
|
||||||
|
|
||||||
def __init__(self, parent):
|
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.main_window = parent
|
||||||
self.update_rows.connect(self.do_update_rows)
|
self.update_rows.connect(self.do_update_rows)
|
||||||
self.update_single_row.connect(self.do_update_single_row)
|
self.update_single_row.connect(self.do_update_single_row)
|
||||||
|
|
||||||
def format_fields(self, chan):
|
def format_fields(self, chan):
|
||||||
status = self.parent.wallet.lnworker.channel_state[chan.channel_id]
|
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):
|
def create_menu(self, position):
|
||||||
menu = QtWidgets.QMenu()
|
menu = QtWidgets.QMenu()
|
||||||
cur = self.currentItem()
|
cur = self.currentItem()
|
||||||
print('ID', cur.data(0, QtCore.Qt.UserRole))
|
print('ID', bh2u(cur.data(0, QtCore.Qt.UserRole)))
|
||||||
def close():
|
def close():
|
||||||
print("closechannel result", self.parent.wallet.lnworker.close_channel_from_other_thread(cur.di))
|
print("closechannel result", self.parent.wallet.lnworker.close_channel_from_other_thread(cur.di))
|
||||||
menu.addAction(_("Close channel"), close)
|
menu.addAction(_("Close channel"), close)
|
||||||
|
|
Loading…
Add table
Reference in a new issue