diff --git a/gui/qt/main_window.py b/gui/qt/main_window.py index ced039688..8874a5ec0 100644 --- a/gui/qt/main_window.py +++ b/gui/qt/main_window.py @@ -1101,9 +1101,11 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError): password = None while self.wallet.has_password(): password = self.password_dialog(parent=parent) + if password is None: + # User cancelled password input + return try: - if password: - self.wallet.check_password(password) + self.wallet.check_password(password) break except Exception as e: self.show_error(str(e), parent=parent) @@ -1234,10 +1236,6 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError): '''Sign the transaction in a separate thread. When done, calls the callback with a success code of True or False. ''' - if self.wallet.has_password() and not password: - callback(False) # User cancelled password input - return - # call hook to see if plugin needs gui interaction run_hook('sign_tx', self, tx) @@ -1689,9 +1687,6 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError): @protected def show_seed_dialog(self, password): - if self.wallet.has_password() and password is None: - # User cancelled password input - return if not self.wallet.has_seed(): self.show_message(_('This wallet has no seed')) return @@ -1736,7 +1731,8 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError): @protected def show_private_key(self, address, password): - if not address: return + if not address: + return try: pk_list = self.wallet.get_private_key(address, password) except Exception as e: @@ -1817,7 +1813,6 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError): layout.addLayout(hbox, 4, 1) d.exec_() - @protected def do_decrypt(self, message_e, pubkey_e, encrypted_e, password): cyphertext = str(encrypted_e.toPlainText()) @@ -1968,17 +1963,11 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError): tx = transaction.Transaction(r) self.show_transaction(tx) - @protected def export_privkeys_dialog(self, password): if self.wallet.is_watching_only(): self.show_message(_("This is a watching-only wallet")) return - try: - self.wallet.check_password(password) - except Exception as e: - self.show_error(str(e)) - return d = WindowModalDialog(self, _('Private keys')) d.setMinimumSize(850, 300) @@ -2228,7 +2217,6 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError): title, msg = _('Import private keys'), _("Enter private keys") self._do_import(title, msg, lambda x: self.wallet.import_key(x, password)) - def settings_dialog(self): self.need_restart = False d = WindowModalDialog(self, _('Preferences')) diff --git a/gui/qt/transaction_dialog.py b/gui/qt/transaction_dialog.py index e08db2c59..ab85e70b9 100644 --- a/gui/qt/transaction_dialog.py +++ b/gui/qt/transaction_dialog.py @@ -153,8 +153,6 @@ class TxDialog(QDialog, MessageBoxMixin): def sign(self): def sign_done(success): - self.sign_button.setDisabled(False) - self.main_window.pop_top_level_window(self) if success: self.prompt_if_unsaved = True self.saved = False @@ -163,6 +161,8 @@ class TxDialog(QDialog, MessageBoxMixin): self.sign_button.setDisabled(True) self.main_window.push_top_level_window(self) self.main_window.sign_tx(self.tx, sign_done) + self.sign_button.setDisabled(False) + self.main_window.pop_top_level_window(self) def save(self): name = 'signed_%s.txn' % (self.tx.hash()[0:8]) if self.tx.is_complete() else 'unsigned.txn'