plugins dialog: fix is_available, do not show plugins that are not available
This commit is contained in:
@@ -340,6 +340,8 @@ class PluginsDialog(WindowModalDialog, MessageBoxMixin):
|
|||||||
display_name = metadata.get('fullname')
|
display_name = metadata.get('fullname')
|
||||||
if not display_name:
|
if not display_name:
|
||||||
continue
|
continue
|
||||||
|
if not self.plugins.is_available(name):
|
||||||
|
continue
|
||||||
label = IconLabel(text=display_name, reverse=True)
|
label = IconLabel(text=display_name, reverse=True)
|
||||||
icon_path = metadata.get('icon')
|
icon_path = metadata.get('icon')
|
||||||
if icon_path:
|
if icon_path:
|
||||||
|
|||||||
@@ -712,7 +712,7 @@ class Plugins(DaemonThread):
|
|||||||
def is_plugin_enabler_config_key(cls, key: str) -> bool:
|
def is_plugin_enabler_config_key(cls, key: str) -> bool:
|
||||||
return key.startswith('plugins.')
|
return key.startswith('plugins.')
|
||||||
|
|
||||||
def is_available(self, name: str, wallet: 'Abstract_Wallet') -> bool:
|
def is_available(self, name: str) -> bool:
|
||||||
d = self.descriptions.get(name)
|
d = self.descriptions.get(name)
|
||||||
if not d:
|
if not d:
|
||||||
return False
|
return False
|
||||||
@@ -723,8 +723,7 @@ class Plugins(DaemonThread):
|
|||||||
except ImportError as e:
|
except ImportError as e:
|
||||||
self.logger.warning(f'Plugin {name} unavailable: {repr(e)}')
|
self.logger.warning(f'Plugin {name} unavailable: {repr(e)}')
|
||||||
return False
|
return False
|
||||||
requires = d.get('requires_wallet_type', [])
|
return True
|
||||||
return not requires or wallet.wallet_type in requires
|
|
||||||
|
|
||||||
def get_hardware_support(self):
|
def get_hardware_support(self):
|
||||||
out = []
|
out = []
|
||||||
|
|||||||
Reference in New Issue
Block a user