qt open channel: minor dialog fixes

This commit is contained in:
SomberNight 2019-11-20 18:00:45 +01:00
parent cd9477c0da
commit fec9677508
No known key found for this signature in database
GPG key ID: B33B5F232C6271E9
3 changed files with 10 additions and 8 deletions

View file

@ -13,7 +13,7 @@ from electrum.util import (format_satoshis_plain, decimal_point_to_base_unit_nam
FEERATE_PRECISION, quantize_feerate)
class MyLineEdit(QLineEdit):
class FreezableLineEdit(QLineEdit):
frozen = pyqtSignal()
def setFrozen(self, b):
@ -21,7 +21,7 @@ class MyLineEdit(QLineEdit):
self.setFrame(not b)
self.frozen.emit()
class AmountEdit(MyLineEdit):
class AmountEdit(FreezableLineEdit):
shortcut = pyqtSignal()
def __init__(self, base_unit, is_int=False, parent=None):

View file

@ -13,7 +13,7 @@ from electrum.wallet import Abstract_Wallet
from electrum.lnutil import LOCAL, REMOTE, format_short_channel_id, LN_MAX_FUNDING_SAT
from .util import MyTreeView, WindowModalDialog, Buttons, OkButton, CancelButton, EnterButton, WaitingDialog
from .amountedit import BTCAmountEdit
from .amountedit import BTCAmountEdit, FreezableLineEdit
from .channel_details import ChannelDetailsDialog
@ -163,22 +163,24 @@ class ChannelsList(MyTreeView):
d = WindowModalDialog(self.parent, _('Open Channel'))
vbox = QVBoxLayout(d)
vbox.addWidget(QLabel(_('Enter Remote Node ID or connection string or invoice')))
local_nodeid = QLineEdit()
local_nodeid = FreezableLineEdit()
local_nodeid.setMinimumWidth(700)
local_nodeid.setText(bh2u(lnworker.node_keypair.pubkey))
local_nodeid.setReadOnly(True)
local_nodeid.setFrozen(True)
local_nodeid.setCursorPosition(0)
remote_nodeid = QLineEdit()
remote_nodeid.setMinimumWidth(700)
amount_e = BTCAmountEdit(self.parent.get_decimal_point)
# max button
def spend_max():
amount_e.setFrozen(max_button.isChecked())
if not max_button.isChecked():
return
make_tx = self.parent.mktx_for_open_channel('!')
tx = make_tx(None)
amount = tx.output_value()
amount = min(amount, LN_MAX_FUNDING_SAT)
amount_e.setAmount(amount)
amount_e.setFrozen(True)
max_button = EnterButton(_("Max"), spend_max)
max_button.setFixedWidth(100)
max_button.setCheckable(True)

View file

@ -77,7 +77,7 @@ from electrum.util import pr_expiration_values
from electrum.lnutil import ln_dummy_address
from .exception_window import Exception_Hook
from .amountedit import AmountEdit, BTCAmountEdit, MyLineEdit, FeerateEdit
from .amountedit import AmountEdit, BTCAmountEdit, FreezableLineEdit, FeerateEdit
from .qrcodewidget import QRCodeWidget, QRDialog
from .qrtextedit import ShowQRTextEdit, ScanQRTextEdit
from .transaction_dialog import show_transaction
@ -1212,7 +1212,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger):
+ _('The description is not sent to the recipient of the funds. It is stored in your wallet file, and displayed in the \'History\' tab.')
description_label = HelpLabel(_('Description'), msg)
grid.addWidget(description_label, 2, 0)
self.message_e = MyLineEdit()
self.message_e = FreezableLineEdit()
self.message_e.setMinimumWidth(700)
grid.addWidget(self.message_e, 2, 1, 1, -1)