electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit 6c25f637b90958f88526d366b44ad0cd740d1060
parent f8b5c662849fd4066ac850a86beb225b0e07a652
Author: Neil Booth <kyuupichan@gmail.com>
Date:   Sat, 27 Jun 2015 10:56:01 +0900

Wrapper func to create and show a TxDialog

Add prompt_if_unsaved as explicit argument.
Tested with cosigner pool plugin.

Diffstat:
Mgui/qt/main_window.py | 5++---
Mgui/qt/transaction_dialog.py | 7+++++--
Mplugins/cosigner_pool.py | 6++----
3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/gui/qt/main_window.py b/gui/qt/main_window.py @@ -46,6 +46,7 @@ from amountedit import AmountEdit, BTCAmountEdit, MyLineEdit from network_dialog import NetworkDialog from qrcodewidget import QRCodeWidget, QRDialog from qrtextedit import ScanQRTextEdit, ShowQRTextEdit +from transaction_dialog import show_transaction from decimal import Decimal @@ -570,9 +571,7 @@ class ElectrumWindow(QMainWindow): def show_transaction(self, tx, tx_desc = None): '''tx_desc is set only for txs created in the Send tab''' - import transaction_dialog - d = transaction_dialog.TxDialog(tx, self, tx_desc) - d.show() + show_transaction(tx, self, tx_desc) def update_history_tab(self): domain = self.wallet.get_account_addresses(self.current_account) diff --git a/gui/qt/transaction_dialog.py b/gui/qt/transaction_dialog.py @@ -31,10 +31,13 @@ from electrum.plugins import run_hook 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): - def __init__(self, tx, parent, desc=None): + def __init__(self, tx, parent, desc, prompt_if_unsaved): '''Transactions in the wallet will show their description. 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() self.parent = parent self.wallet = parent.wallet - self.saved = True + self.saved = not prompt_if_unsaved self.desc = desc QWidget.__init__(self) diff --git a/plugins/cosigner_pool.py b/plugins/cosigner_pool.py @@ -29,7 +29,7 @@ from electrum import transaction from electrum.plugins import BasePlugin, hook from electrum.i18n import _ -from electrum_gui.qt import transaction_dialog +from electrum_gui.qt.transaction_dialog import show_transaction import sys import traceback @@ -180,6 +180,4 @@ class Plugin(BasePlugin): self.listener.clear() tx = transaction.Transaction(message) - d = transaction_dialog.TxDialog(tx, self.win) - d.saved = False - d.show() + show_transaction(tx, self.win, prompt_if_unsaved=True)