tWrapper func to create and show a TxDialog - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit 6c25f637b90958f88526d366b44ad0cd740d1060 DIR parent f8b5c662849fd4066ac850a86beb225b0e07a652 HTML 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: M gui/qt/main_window.py | 5 ++--- M gui/qt/transaction_dialog.py | 7 +++++-- M plugins/cosigner_pool.py | 6 ++---- 3 files changed, 9 insertions(+), 9 deletions(-) --- DIR diff --git a/gui/qt/main_window.py b/gui/qt/main_window.py t@@ -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 t@@ -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) DIR diff --git a/gui/qt/transaction_dialog.py b/gui/qt/transaction_dialog.py t@@ -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. ''' t@@ -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) DIR diff --git a/plugins/cosigner_pool.py b/plugins/cosigner_pool.py t@@ -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 t@@ -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)