plugins: remove 'on_new_window' hook
This commit is contained in:
@@ -233,8 +233,6 @@ class ElectrumGui(Logger):
|
|||||||
w = ElectrumWindow(self, wallet)
|
w = ElectrumWindow(self, wallet)
|
||||||
self.windows.append(w)
|
self.windows.append(w)
|
||||||
self.build_tray_menu()
|
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_testnet()
|
||||||
w.warn_if_watching_only()
|
w.warn_if_watching_only()
|
||||||
return w
|
return w
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ from electrum.transaction import Transaction, PartialTransaction, tx_from_any
|
|||||||
from electrum.bip32 import BIP32Node
|
from electrum.bip32 import BIP32Node
|
||||||
from electrum.plugin import BasePlugin, hook
|
from electrum.plugin import BasePlugin, hook
|
||||||
from electrum.i18n import _
|
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.util import bh2u, bfh
|
||||||
|
|
||||||
from electrum.gui.qt.transaction_dialog import show_transaction, TxDialog
|
from electrum.gui.qt.transaction_dialog import show_transaction, TxDialog
|
||||||
@@ -114,10 +114,10 @@ class Plugin(BasePlugin):
|
|||||||
return
|
return
|
||||||
self._init_qt_received = True
|
self._init_qt_received = True
|
||||||
for window in gui.windows:
|
for window in gui.windows:
|
||||||
self.on_new_window(window)
|
self.load_wallet(window.wallet, window)
|
||||||
|
|
||||||
@hook
|
@hook
|
||||||
def on_new_window(self, window):
|
def load_wallet(self, wallet: 'Abstract_Wallet', window: 'ElectrumWindow'):
|
||||||
self.update(window)
|
self.update(window)
|
||||||
|
|
||||||
@hook
|
@hook
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ from functools import partial
|
|||||||
import threading
|
import threading
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
from PyQt5.QtGui import QPixmap
|
from PyQt5.QtGui import QPixmap
|
||||||
from PyQt5.QtCore import QObject, pyqtSignal
|
from PyQt5.QtCore import QObject, pyqtSignal
|
||||||
@@ -47,6 +48,10 @@ from electrum.base_wizard import GoBack
|
|||||||
|
|
||||||
from .trustedcoin import TrustedCoinPlugin, server
|
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):
|
class TOS(QTextEdit):
|
||||||
tos_signal = pyqtSignal()
|
tos_signal = pyqtSignal()
|
||||||
@@ -84,8 +89,7 @@ class Plugin(TrustedCoinPlugin):
|
|||||||
super().__init__(parent, config, name)
|
super().__init__(parent, config, name)
|
||||||
|
|
||||||
@hook
|
@hook
|
||||||
def on_new_window(self, window):
|
def load_wallet(self, wallet: 'Abstract_Wallet', window: 'ElectrumWindow'):
|
||||||
wallet = window.wallet
|
|
||||||
if not isinstance(wallet, self.wallet_class):
|
if not isinstance(wallet, self.wallet_class):
|
||||||
return
|
return
|
||||||
wallet.handler_2fa = HandlerTwoFactor(self, window)
|
wallet.handler_2fa = HandlerTwoFactor(self, window)
|
||||||
|
|||||||
Reference in New Issue
Block a user