This commit is contained in:
ThomasV 2019-11-17 13:48:19 +01:00
parent cbd146ad15
commit e74f7e7b42
2 changed files with 9 additions and 8 deletions

View file

@ -1488,7 +1488,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger):
fee=fee_est,
is_sweep=is_sweep)
if self.config.get('advanced_preview'):
self.preview_tx_dialog(make_tx, outputs, is_sweep=is_sweep, invoice=invoice)
self.preview_tx_dialog(make_tx, outputs, external_keypairs=external_keypairs, invoice=invoice)
return
output_values = [x.value for x in outputs]
@ -1507,10 +1507,10 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger):
self.broadcast_or_show(tx, invoice=invoice)
self.sign_tx_with_password(tx, sign_done, password, external_keypairs)
else:
self.preview_tx_dialog(make_tx, outputs, is_sweep=is_sweep, invoice=invoice)
self.preview_tx_dialog(make_tx, outputs, external_keypairs=external_keypairs, invoice=invoice)
def preview_tx_dialog(self, make_tx, outputs, is_sweep=False, invoice=None):
d = PreviewTxDialog(make_tx, outputs, is_sweep, window=self, invoice=invoice)
def preview_tx_dialog(self, make_tx, outputs, external_keypairs=None, invoice=None):
d = PreviewTxDialog(make_tx, outputs, external_keypairs, window=self, invoice=invoice)
d.show()
def broadcast_or_show(self, tx, invoice=None):

View file

@ -92,13 +92,14 @@ def show_transaction(tx: Transaction, *, parent: 'ElectrumWindow', invoice=None,
class BaseTxDialog(QDialog, MessageBoxMixin):
def __init__(self, *, parent: 'ElectrumWindow', invoice, desc, prompt_if_unsaved, finalized: bool):
def __init__(self, *, parent: 'ElectrumWindow', invoice, desc, prompt_if_unsaved, finalized: bool, external_keypairs=None):
'''Transactions in the wallet will show their description.
Pass desc to give a description for txs not yet in the wallet.
'''
# We want to be a top-level window
QDialog.__init__(self, parent=None)
self.tx = None # type: Optional[Transaction]
self.external_keypairs = external_keypairs
self.finalized = finalized
self.main_window = parent
self.config = parent.config
@ -602,9 +603,9 @@ class TxDialog(BaseTxDialog):
class PreviewTxDialog(BaseTxDialog, TxEditor):
def __init__(self, make_tx, outputs, is_sweep, *, window: 'ElectrumWindow', invoice):
TxEditor.__init__(self, window, make_tx, outputs, is_sweep)
BaseTxDialog.__init__(self, parent=window, invoice=invoice, desc='', prompt_if_unsaved=False, finalized=False)
def __init__(self, make_tx, outputs, external_keypairs, *, window: 'ElectrumWindow', invoice):
TxEditor.__init__(self, window, make_tx, outputs, is_sweep=bool(external_keypairs))
BaseTxDialog.__init__(self, parent=window, invoice=invoice, desc='', prompt_if_unsaved=False, finalized=False, external_keypairs=external_keypairs)
self.update_tx()
self.update()