1
0

Add/remove plugins from GUI

- both internal and external plugins require GUI install
   (except internal HW plugins, which are 'auto-loaded' and hidden)
 - remove init_qt hook
 - in Qt, reload wallet windows if plugin enabled/disabled
 - add 'uninstall' button to PluginDialog
 - add 'add plugins' button to wizard hw screen
 - add icons to the plugin list
This commit is contained in:
ThomasV
2025-04-14 12:08:32 +02:00
parent d1e1ca7fd2
commit 8c028f7528
13 changed files with 240 additions and 141 deletions

View File

@@ -3,5 +3,6 @@
"fullname": "Blockstream Jade Wallet",
"description": "Provides support for the Blockstream Jade hardware wallet",
"registers_keystore": ["hardware", "jade", "Jade wallet"],
"icon":"jade.png",
"available_for": ["qt", "cmdline"]
}

View File

@@ -67,16 +67,6 @@ class Plugin(LabelsPlugin):
self.logger.error("Error synchronising labels", exc_info=exc_info)
dialog.show_error(_("Error synchronising labels") + f':\n{repr(exc_info[1])}')
@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'):
self.obj.labels_changed_signal.connect(window.update_tabs)

View File

@@ -25,27 +25,23 @@ class Plugin(NWCServerPlugin):
@hook
def load_wallet(self, wallet: 'Abstract_Wallet', window: 'ElectrumWindow'):
self.start_plugin(wallet)
@hook
def init_qt(self, gui: 'ElectrumGui'):
if self._init_qt_received:
if not wallet.has_lightning():
return
self._init_qt_received = True
for w in gui.windows:
self.start_plugin(w.wallet)
self.start_plugin(wallet)
def requires_settings(self):
return True
def settings_dialog(self, window: WindowModalDialog, wallet: 'Abstract_Wallet'):
if not wallet.has_lightning():
window.show_error(_("{} plugin requires a lightning enabled wallet. Setup lightning first.")
.format("NWC"))
if not self.initialized:
window.show_error(
_("{} plugin requires a lightning enabled wallet. Open a lightning-enabled wallet first.")
.format("NWC"))
return
d = WindowModalDialog(window, _("Nostr Wallet Connect"))
main_layout = QVBoxLayout(d)
main_layout.addWidget(QLabel(_("Using wallet:") + ' ' + self.nwc_server.wallet.basename()))
# Connections list
main_layout.addWidget(QLabel(_("Existing Connections:")))

View File

@@ -70,14 +70,6 @@ class Plugin(BasePlugin):
self.cosigner_wallets = {} # type: Dict[Abstract_Wallet, CosignerWallet]
@hook
def init_qt(self, gui: 'ElectrumGui'):
if self._init_qt_received: # only need/want the first signal
return
self._init_qt_received = True
for window in gui.windows:
self.load_wallet(window.wallet, window)
@hook
def load_wallet(self, wallet: 'Abstract_Wallet', window: 'ElectrumWindow'):
if type(wallet) != Multisig_Wallet:

View File

@@ -1,6 +1,7 @@
{
"name": "revealer",
"fullname": "Revealer Backup Utility",
"description": "This plug-in allows you to create a visually encrypted backup of your wallet seeds, or of custom alphanumeric secrets.",
"available_for": ["qt"]
"name": "revealer",
"fullname": "Revealer Backup Utility",
"description": "This plug-in allows you to create a visually encrypted backup of your wallet seeds, or of custom alphanumeric secrets.",
"icon": "revealer.png",
"available_for": ["qt"]
}

View File

@@ -73,7 +73,7 @@ class Plugin(RevealerPlugin):
self.icon_bytes = self.read_file("revealer.png")
@hook
def init_qt(self, gui: 'ElectrumGui'):
def load_wallet(self, wallet, window):
if self._init_qt_received: # only need/want the first signal
return
self._init_qt_received = True