electrum

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

commit 95b08e9961242aabfe0501b4b7a3102fce2dd03d
parent 933d8861ce2538c21d26a1e1f6c4d48f31044a93
Author: SomberNight <somber.night@protonmail.com>
Date:   Tue,  8 Dec 2020 10:33:43 +0100

plugins: remove 'on_new_window' hook

Diffstat:
Melectrum/gui/qt/__init__.py | 2--
Melectrum/plugins/cosigner_pool/qt.py | 6+++---
Melectrum/plugins/trustedcoin/qt.py | 8++++++--
3 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/electrum/gui/qt/__init__.py b/electrum/gui/qt/__init__.py @@ -233,8 +233,6 @@ class ElectrumGui(Logger): w = ElectrumWindow(self, wallet) self.windows.append(w) self.build_tray_menu() - # FIXME: Remove in favour of the load_wallet hook - run_hook('on_new_window', w) w.warn_if_testnet() w.warn_if_watching_only() return w diff --git a/electrum/plugins/cosigner_pool/qt.py b/electrum/plugins/cosigner_pool/qt.py @@ -38,7 +38,7 @@ from electrum.transaction import Transaction, PartialTransaction, tx_from_any from electrum.bip32 import BIP32Node from electrum.plugin import BasePlugin, hook from electrum.i18n import _ -from electrum.wallet import Multisig_Wallet +from electrum.wallet import Multisig_Wallet, Abstract_Wallet from electrum.util import bh2u, bfh from electrum.gui.qt.transaction_dialog import show_transaction, TxDialog @@ -114,10 +114,10 @@ class Plugin(BasePlugin): return self._init_qt_received = True for window in gui.windows: - self.on_new_window(window) + self.load_wallet(window.wallet, window) @hook - def on_new_window(self, window): + def load_wallet(self, wallet: 'Abstract_Wallet', window: 'ElectrumWindow'): self.update(window) @hook diff --git a/electrum/plugins/trustedcoin/qt.py b/electrum/plugins/trustedcoin/qt.py @@ -27,6 +27,7 @@ from functools import partial import threading import sys import os +from typing import TYPE_CHECKING from PyQt5.QtGui import QPixmap from PyQt5.QtCore import QObject, pyqtSignal @@ -47,6 +48,10 @@ from electrum.base_wizard import GoBack from .trustedcoin import TrustedCoinPlugin, server +if TYPE_CHECKING: + from electrum.gui.qt.main_window import ElectrumWindow + from electrum.wallet import Abstract_Wallet + class TOS(QTextEdit): tos_signal = pyqtSignal() @@ -84,8 +89,7 @@ class Plugin(TrustedCoinPlugin): super().__init__(parent, config, name) @hook - def on_new_window(self, window): - wallet = window.wallet + def load_wallet(self, wallet: 'Abstract_Wallet', window: 'ElectrumWindow'): if not isinstance(wallet, self.wallet_class): return wallet.handler_2fa = HandlerTwoFactor(self, window)