-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathqt.py
32 lines (26 loc) · 1.15 KB
/
qt.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from typing import TYPE_CHECKING
from electrum.plugin import hook
from .bisq_plugin import BisqPlugin, read_QIcon
from .widgets.bisq_tab import BisqTab
if TYPE_CHECKING:
from electrum.gui.qt import ElectrumGui
from electrum.gui.qt.main_window import ElectrumWindow
from electrum.wallet import Abstract_Wallet
class Plugin(BisqPlugin):
def __init__(self, parent, config, name):
super().__init__(parent, config, name)
self._init_qt_received = False
@hook
def init_qt(self, gui: 'ElectrumGui'):
if self._init_qt_received: # only need/want the first signal
return
self._init_qt_received = True
# If the user just enabled the plugin, the 'load_wallet' hook would not
# get called for already loaded wallets, hence we call it manually for those:
for window in gui.windows:
self.load_wallet(window.wallet, window)
@hook
def load_wallet(self, wallet: 'Abstract_Wallet', window: 'ElectrumWindow'):
window.bisq_tab = BisqTab(window)
window.tabs.insertTab(0, window.bisq_tab, read_QIcon("bisq.png"), 'bisq')
window.tabs.setCurrentIndex(0)