electrum

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

commit 150cbb5d9cf4b03549969dec616e09a6b2967387
parent 7bcc55ae572fd20f2d46d2abc0c5b4c8ecbe5516
Author: SomberNight <somber.night@protonmail.com>
Date:   Mon, 14 May 2018 17:00:29 +0200

fix #4356: qt/tx_dialog - move save local button to left.

also: properly parent popup, and add extra note re what local tx ('save') means

Diffstat:
Mgui/qt/main_window.py | 12++++++++----
Mgui/qt/transaction_dialog.py | 23+++++++++++++++--------
2 files changed, 23 insertions(+), 12 deletions(-)

diff --git a/gui/qt/main_window.py b/gui/qt/main_window.py @@ -3167,17 +3167,21 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError): self.show_transaction(new_tx, tx_label) def save_transaction_into_wallet(self, tx): + win = self.top_level_window() try: if not self.wallet.add_transaction(tx.txid(), tx): - self.show_error(_("Transaction could not be saved.") + "\n" + - _("It conflicts with current history.")) + win.show_error(_("Transaction could not be saved.") + "\n" + + _("It conflicts with current history.")) return False except AddTransactionException as e: - self.show_error(e) + win.show_error(e) return False else: self.wallet.save_transactions(write=True) # need to update at least: history_list, utxo_list, address_list self.need_update.set() - self.msg_box(QPixmap(":icons/offline_tx.png"), None, _('Success'), _("Transaction added to wallet history")) + msg = (_("Transaction added to wallet history.") + '\n\n' + + _("Note: this is an offline transaction, if you want the network " + "to see it, you need to broadcast it.")) + win.msg_box(QPixmap(":icons/offline_tx.png"), None, _('Success'), msg) return True diff --git a/gui/qt/transaction_dialog.py b/gui/qt/transaction_dialog.py @@ -42,6 +42,11 @@ from electrum.transaction import SerializationError from .util import * + +SAVE_BUTTON_ENABLED_TOOLTIP = _("Save transaction offline") +SAVE_BUTTON_DISABLED_TOOLTIP = _("Please sign this transaction in order to save it") + + dialogs = [] # Otherwise python randomly garbage collects the dialogs... @@ -113,14 +118,14 @@ class TxDialog(QDialog, MessageBoxMixin): self.broadcast_button = b = QPushButton(_("Broadcast")) b.clicked.connect(self.do_broadcast) - self.save_button = QPushButton(_("Save")) + self.save_button = b = QPushButton(_("Save")) save_button_disabled = not tx.is_complete() - self.save_button.setDisabled(save_button_disabled) + b.setDisabled(save_button_disabled) if save_button_disabled: - self.save_button.setToolTip(_("Please sign this transaction in order to save it")) + b.setToolTip(SAVE_BUTTON_DISABLED_TOOLTIP) else: - self.save_button.setToolTip("") - self.save_button.clicked.connect(self.save) + b.setToolTip(SAVE_BUTTON_ENABLED_TOOLTIP) + b.clicked.connect(self.save) self.export_button = b = QPushButton(_("Export")) b.clicked.connect(self.export) @@ -136,9 +141,9 @@ class TxDialog(QDialog, MessageBoxMixin): self.copy_button = CopyButton(lambda: str(self.tx), parent.app) # Action buttons - self.buttons = [self.sign_button, self.broadcast_button, self.save_button, self.cancel_button] + self.buttons = [self.sign_button, self.broadcast_button, self.cancel_button] # Transaction sharing buttons - self.sharing_buttons = [self.copy_button, self.qr_button, self.export_button] + self.sharing_buttons = [self.copy_button, self.qr_button, self.export_button, self.save_button] run_hook('transaction_dialog', self) @@ -184,7 +189,7 @@ class TxDialog(QDialog, MessageBoxMixin): self.prompt_if_unsaved = True self.saved = False self.save_button.setDisabled(False) - self.save_button.setToolTip("") + self.save_button.setToolTip(SAVE_BUTTON_ENABLED_TOOLTIP) self.update() self.main_window.pop_top_level_window(self) @@ -193,9 +198,11 @@ class TxDialog(QDialog, MessageBoxMixin): self.main_window.sign_tx(self.tx, sign_done) def save(self): + self.main_window.push_top_level_window(self) if self.main_window.save_transaction_into_wallet(self.tx): self.save_button.setDisabled(True) self.saved = True + self.main_window.pop_top_level_window(self) def export(self):