Plugins: pass wallet to settings_dialog
Also, remove settings_widget method. The widget should always be a button. nwc: is_initialized -> initialized
This commit is contained in:
@@ -48,10 +48,7 @@ class Plugin(BasePlugin):
|
||||
def requires_settings(self):
|
||||
return True
|
||||
|
||||
def settings_widget(self, window):
|
||||
return EnterButton(_('Settings'), partial(self.settings_dialog, window))
|
||||
|
||||
def settings_dialog(self, window):
|
||||
def settings_dialog(self, window, wallet):
|
||||
d = WindowModalDialog(window, _("Audio Modem Settings"))
|
||||
|
||||
layout = QGridLayout(d)
|
||||
|
||||
@@ -31,12 +31,7 @@ class Plugin(LabelsPlugin):
|
||||
def requires_settings(self):
|
||||
return True
|
||||
|
||||
def settings_widget(self, window: WindowModalDialog):
|
||||
return EnterButton(_('Settings'),
|
||||
partial(self.settings_dialog, window))
|
||||
|
||||
def settings_dialog(self, window: WindowModalDialog):
|
||||
wallet = window.parent().wallet
|
||||
def settings_dialog(self, window: WindowModalDialog, wallet: 'Abstract_Wallet'):
|
||||
if not wallet.get_fingerprint():
|
||||
window.show_error(_("{} plugin does not support this type of wallet.")
|
||||
.format("Label Sync"))
|
||||
|
||||
@@ -44,7 +44,7 @@ class NWCServerPlugin(BasePlugin):
|
||||
def start_plugin(self, wallet: 'Abstract_Wallet'):
|
||||
if not wallet.has_lightning():
|
||||
return
|
||||
if self.is_initialized:
|
||||
if self.initialized:
|
||||
# this might be called for several wallets. only use one.
|
||||
return
|
||||
storage = self.get_plugin_storage(wallet)
|
||||
|
||||
@@ -38,11 +38,12 @@ class Plugin(NWCServerPlugin):
|
||||
def requires_settings(self):
|
||||
return True
|
||||
|
||||
def settings_widget(self, window: WindowModalDialog):
|
||||
return EnterButton(_('Setup'),
|
||||
partial(self.settings_dialog, window))
|
||||
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"))
|
||||
return
|
||||
|
||||
def settings_dialog(self, window: WindowModalDialog):
|
||||
d = WindowModalDialog(window, _("Nostr Wallet Connect"))
|
||||
main_layout = QVBoxLayout(d)
|
||||
|
||||
|
||||
@@ -92,8 +92,8 @@ class Plugin(RevealerPlugin):
|
||||
def requires_settings(self):
|
||||
return True
|
||||
|
||||
def settings_widget(self, window):
|
||||
return EnterButton(_('Printer Calibration'), partial(self.calibration_dialog, window))
|
||||
def settings_dialog(self, window, wallet):
|
||||
return self.calibration_dialog(window)
|
||||
|
||||
def password_dialog(self, msg=None, parent=None):
|
||||
from electrum.gui.qt.password_dialog import PasswordDialog
|
||||
|
||||
Reference in New Issue
Block a user