mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-09-02 10:15:20 +00:00
Qt: ask confirmation before closing channel.
This commit is contained in:
parent
938d918e55
commit
4e73318fad
2 changed files with 6 additions and 1 deletions
|
@ -11,6 +11,8 @@ from electrum.lnchannel import htlcsum
|
||||||
from electrum.lnaddr import LnAddr, lndecode
|
from electrum.lnaddr import LnAddr, lndecode
|
||||||
from electrum.bitcoin import COIN
|
from electrum.bitcoin import COIN
|
||||||
|
|
||||||
|
from .util import Buttons, CloseButton
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from .main_window import ElectrumWindow
|
from .main_window import ElectrumWindow
|
||||||
|
|
||||||
|
@ -151,6 +153,6 @@ class ChannelDetailsDialog(QtWidgets.QDialog):
|
||||||
w.setModel(self.make_model(htlc_dict))
|
w.setModel(self.make_model(htlc_dict))
|
||||||
w.header().setSectionResizeMode(0, QtWidgets.QHeaderView.ResizeToContents)
|
w.header().setSectionResizeMode(0, QtWidgets.QHeaderView.ResizeToContents)
|
||||||
vbox.addWidget(w)
|
vbox.addWidget(w)
|
||||||
|
vbox.addLayout(Buttons(CloseButton(self)))
|
||||||
# initialize sent/received fields
|
# initialize sent/received fields
|
||||||
self.update_sent_received()
|
self.update_sent_received()
|
||||||
|
|
|
@ -81,6 +81,9 @@ class ChannelsList(MyTreeView):
|
||||||
self.main_window.show_error('Failed to close channel:\n{}'.format(repr(e)))
|
self.main_window.show_error('Failed to close channel:\n{}'.format(repr(e)))
|
||||||
|
|
||||||
def close_channel(self, channel_id):
|
def close_channel(self, channel_id):
|
||||||
|
msg = _('Close channel?')
|
||||||
|
if not self.parent.question(msg):
|
||||||
|
return
|
||||||
def task():
|
def task():
|
||||||
coro = self.lnworker.close_channel(channel_id)
|
coro = self.lnworker.close_channel(channel_id)
|
||||||
return self.network.run_from_another_thread(coro)
|
return self.network.run_from_another_thread(coro)
|
||||||
|
|
Loading…
Add table
Reference in a new issue