Wrapper func to create and show a TxDialog
Add prompt_if_unsaved as explicit argument. Tested with cosigner pool plugin.
This commit is contained in:
parent
f8b5c66284
commit
6c25f637b9
@ -46,6 +46,7 @@ from amountedit import AmountEdit, BTCAmountEdit, MyLineEdit
|
|||||||
from network_dialog import NetworkDialog
|
from network_dialog import NetworkDialog
|
||||||
from qrcodewidget import QRCodeWidget, QRDialog
|
from qrcodewidget import QRCodeWidget, QRDialog
|
||||||
from qrtextedit import ScanQRTextEdit, ShowQRTextEdit
|
from qrtextedit import ScanQRTextEdit, ShowQRTextEdit
|
||||||
|
from transaction_dialog import show_transaction
|
||||||
|
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
|
|
||||||
@ -570,9 +571,7 @@ class ElectrumWindow(QMainWindow):
|
|||||||
|
|
||||||
def show_transaction(self, tx, tx_desc = None):
|
def show_transaction(self, tx, tx_desc = None):
|
||||||
'''tx_desc is set only for txs created in the Send tab'''
|
'''tx_desc is set only for txs created in the Send tab'''
|
||||||
import transaction_dialog
|
show_transaction(tx, self, tx_desc)
|
||||||
d = transaction_dialog.TxDialog(tx, self, tx_desc)
|
|
||||||
d.show()
|
|
||||||
|
|
||||||
def update_history_tab(self):
|
def update_history_tab(self):
|
||||||
domain = self.wallet.get_account_addresses(self.current_account)
|
domain = self.wallet.get_account_addresses(self.current_account)
|
||||||
|
|||||||
@ -31,10 +31,13 @@ from electrum.plugins import run_hook
|
|||||||
|
|
||||||
from util import *
|
from util import *
|
||||||
|
|
||||||
|
def show_transaction(tx, parent, desc=None, prompt_if_unsaved=False):
|
||||||
|
d = TxDialog(tx, parent, desc, prompt_if_unsaved)
|
||||||
|
d.show()
|
||||||
|
|
||||||
class TxDialog(QWidget):
|
class TxDialog(QWidget):
|
||||||
|
|
||||||
def __init__(self, tx, parent, desc=None):
|
def __init__(self, tx, parent, desc, prompt_if_unsaved):
|
||||||
'''Transactions in the wallet will show their description.
|
'''Transactions in the wallet will show their description.
|
||||||
Pass desc to give a description for txs not yet in the wallet.
|
Pass desc to give a description for txs not yet in the wallet.
|
||||||
'''
|
'''
|
||||||
@ -42,7 +45,7 @@ class TxDialog(QWidget):
|
|||||||
tx_dict = tx.as_dict()
|
tx_dict = tx.as_dict()
|
||||||
self.parent = parent
|
self.parent = parent
|
||||||
self.wallet = parent.wallet
|
self.wallet = parent.wallet
|
||||||
self.saved = True
|
self.saved = not prompt_if_unsaved
|
||||||
self.desc = desc
|
self.desc = desc
|
||||||
|
|
||||||
QWidget.__init__(self)
|
QWidget.__init__(self)
|
||||||
|
|||||||
@ -29,7 +29,7 @@ from electrum import transaction
|
|||||||
from electrum.plugins import BasePlugin, hook
|
from electrum.plugins import BasePlugin, hook
|
||||||
from electrum.i18n import _
|
from electrum.i18n import _
|
||||||
|
|
||||||
from electrum_gui.qt import transaction_dialog
|
from electrum_gui.qt.transaction_dialog import show_transaction
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import traceback
|
import traceback
|
||||||
@ -180,6 +180,4 @@ class Plugin(BasePlugin):
|
|||||||
|
|
||||||
self.listener.clear()
|
self.listener.clear()
|
||||||
tx = transaction.Transaction(message)
|
tx = transaction.Transaction(message)
|
||||||
d = transaction_dialog.TxDialog(tx, self.win)
|
show_transaction(tx, self.win, prompt_if_unsaved=True)
|
||||||
d.saved = False
|
|
||||||
d.show()
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user