Browse Source

do not pass channel list to update_rows signal, as it is sent to all windows

regtest_lnd
ThomasV 7 years ago
committed by SomberNight
parent
commit
1206dc9419
No known key found for this signature in database GPG Key ID: B33B5F232C6271E9
  1. 11
      gui/qt/channels_list.py
  2. 2
      lib/lnworker.py

11
gui/qt/channels_list.py

@ -6,7 +6,7 @@ from electrum.lnbase import OpenChannel
from .util import MyTreeWidget, SortableTreeWidgetItem from .util import MyTreeWidget, SortableTreeWidgetItem
class ChannelsList(MyTreeWidget): class ChannelsList(MyTreeWidget):
update_rows = QtCore.pyqtSignal(list) update_rows = QtCore.pyqtSignal()
update_single_row = QtCore.pyqtSignal(OpenChannel) update_single_row = QtCore.pyqtSignal(OpenChannel)
def __init__(self, parent): def __init__(self, parent):
@ -36,10 +36,10 @@ class ChannelsList(MyTreeWidget):
for i, v in enumerate(self.format_fields(chan)): for i, v in enumerate(self.format_fields(chan)):
item.setData(i, QtCore.Qt.DisplayRole, v) item.setData(i, QtCore.Qt.DisplayRole, v)
@QtCore.pyqtSlot(list) @QtCore.pyqtSlot()
def do_update_rows(self, channels): def do_update_rows(self):
self.clear() self.clear()
for chan in channels: for chan in self.parent.wallet.lnworker.channels.values():
item = SortableTreeWidgetItem(self.format_fields(chan)) item = SortableTreeWidgetItem(self.format_fields(chan))
item.setData(0, QtCore.Qt.UserRole, chan.channel_id) item.setData(0, QtCore.Qt.UserRole, chan.channel_id)
self.insertTopLevelItem(0, item) self.insertTopLevelItem(0, item)
@ -50,8 +50,7 @@ class ChannelsList(MyTreeWidget):
push_amt_inp = QtWidgets.QLineEdit(self, text='0') push_amt_inp = QtWidgets.QLineEdit(self, text='0')
button = QtWidgets.QPushButton(_('Open channel'), self) button = QtWidgets.QPushButton(_('Open channel'), self)
button.clicked.connect(lambda: self.main_window.protect(self.open_channel, (nodeid_inp, local_amt_inp, push_amt_inp))) button.clicked.connect(lambda: self.main_window.protect(self.open_channel, (nodeid_inp, local_amt_inp, push_amt_inp)))
l=QtWidgets.QVBoxLayout(self) h = QtWidgets.QGridLayout()
h=QtWidgets.QGridLayout(self)
nodeid_label = QtWidgets.QLabel(self) nodeid_label = QtWidgets.QLabel(self)
nodeid_label.setText(_("Node ID")) nodeid_label.setText(_("Node ID"))
local_amt_label = QtWidgets.QLabel(self) local_amt_label = QtWidgets.QLabel(self)

2
lib/lnworker.py

@ -176,7 +176,7 @@ class LNWorker(PrintError):
self.on_channels_updated() self.on_channels_updated()
def on_channels_updated(self): def on_channels_updated(self):
self.network.trigger_callback('channels', list(self.channels.values())) self.network.trigger_callback('channels')
def open_channel(self, node_id, local_amt_sat, push_amt_sat, pw): def open_channel(self, node_id, local_amt_sat, push_amt_sat, pw):
coro = self._open_channel_coroutine(node_id, local_amt_sat, push_amt_sat, None if pw == "" else pw) coro = self._open_channel_coroutine(node_id, local_amt_sat, push_amt_sat, None if pw == "" else pw)

Loading…
Cancel
Save