Browse Source

PreviewTxDialog: small UI changes

ln-negative-red
SomberNight 5 years ago
parent
commit
05c496edd1
No known key found for this signature in database GPG Key ID: B33B5F232C6271E9
  1. 7
      electrum/gui/qt/main_window.py
  2. 10
      electrum/gui/qt/transaction_dialog.py

7
electrum/gui/qt/main_window.py

@ -1451,9 +1451,12 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger):
raise Exception('unknown invoice type')
def get_coins(self):
coins = self.utxo_list.get_spend_list()
coins = self.get_manually_selected_coins()
return coins or self.wallet.get_spendable_coins(None)
def get_manually_selected_coins(self) -> Sequence[PartialTxInput]:
return self.utxo_list.get_spend_list()
def pay_onchain_dialog(self, inputs, outputs, invoice=None, external_keypairs=None):
# trustedcoin requires this
if run_hook('abort_send', self):
@ -1563,7 +1566,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger):
def open_channel(self, connect_str, local_amt, push_amt):
# use ConfirmTxDialog
# we need to know the fee before we broadcast, because the txid is required
# however, the user must be allowed to broadcast early
# however, the user must not be allowed to broadcast early
funding_sat = local_amt + push_amt
inputs = self.get_coins
outputs = [PartialTxOutput.from_address_and_value(self.wallet.dummy_address(), funding_sat)]

10
electrum/gui/qt/transaction_dialog.py

@ -444,7 +444,12 @@ class BaseTxDialog(QDialog, MessageBoxMixin):
run_hook('transaction_dialog_update', self)
def update_io(self):
self.inputs_header.setText(_("Inputs") + ' (%d)'%len(self.tx.inputs()))
inputs_header_text = _("Inputs") + ' (%d)'%len(self.tx.inputs())
if not self.finalized:
num_utxos = len(self.main_window.get_manually_selected_coins())
if num_utxos > 0:
inputs_header_text += f" - " + _("Coin selection active ({} UTXOs selected)").format(num_utxos)
self.inputs_header.setText(inputs_header_text)
ext = QTextCharFormat()
rec = QTextCharFormat()
rec.setBackground(QBrush(ColorScheme.GREEN.as_color(background=True)))
@ -481,7 +486,7 @@ class BaseTxDialog(QDialog, MessageBoxMixin):
addr = self.wallet.get_txin_address(txin)
if addr is None:
addr = ''
#cursor.insertText(addr, text_format(addr))
cursor.insertText(addr, text_format(addr))
if isinstance(txin, PartialTxInput) and txin.value_sats() is not None:
cursor.insertText(format_amount(txin.value_sats()), ext)
cursor.insertBlock()
@ -644,6 +649,7 @@ class PreviewTxDialog(BaseTxDialog, TxEditor):
self.feecontrol_fields = QWidget()
vbox_feecontrol = QVBoxLayout(self.feecontrol_fields)
vbox_feecontrol.setContentsMargins(0, 0, 0, 0)
vbox_feecontrol.addWidget(QLabel(_("Target fee:")))
vbox_feecontrol.addWidget(self.fee_adv_controls)
vbox_feecontrol.addWidget(self.fee_slider)

Loading…
Cancel
Save