Pass plugins object to plugin constructor
This commit is contained in:
@@ -67,7 +67,7 @@ class Plugins:
|
|||||||
p = imp.load_source(full_name, path)
|
p = imp.load_source(full_name, path)
|
||||||
else:
|
else:
|
||||||
p = __import__(full_name, fromlist=['electrum_plugins'])
|
p = __import__(full_name, fromlist=['electrum_plugins'])
|
||||||
plugin = p.Plugin(config, name)
|
plugin = p.Plugin(self, config, name)
|
||||||
self.plugins[name] = plugin
|
self.plugins[name] = plugin
|
||||||
self.print_error("loaded", name)
|
self.print_error("loaded", name)
|
||||||
return plugin
|
return plugin
|
||||||
@@ -155,7 +155,8 @@ def _run_hook(name, always, *args):
|
|||||||
|
|
||||||
class BasePlugin:
|
class BasePlugin:
|
||||||
|
|
||||||
def __init__(self, config, name):
|
def __init__(self, parent, config, name):
|
||||||
|
self.parent = parent # The plugins object
|
||||||
self.name = name
|
self.name = name
|
||||||
self.config = config
|
self.config = config
|
||||||
self.wallet = None
|
self.wallet = None
|
||||||
|
|||||||
@@ -27,8 +27,8 @@ except ImportError:
|
|||||||
|
|
||||||
class Plugin(BasePlugin):
|
class Plugin(BasePlugin):
|
||||||
|
|
||||||
def __init__(self, config, name):
|
def __init__(self, parent, config, name):
|
||||||
BasePlugin.__init__(self, config, name)
|
BasePlugin.__init__(self, parent, config, name)
|
||||||
if self.is_available():
|
if self.is_available():
|
||||||
self.modem_config = amodem.config.slowest()
|
self.modem_config = amodem.config.slowest()
|
||||||
self.library_name = {
|
self.library_name = {
|
||||||
@@ -141,5 +141,3 @@ class Plugin(BasePlugin):
|
|||||||
msg = 'Receiving from Audio MODEM ({0:.1f} kbps)...'.format(kbps)
|
msg = 'Receiving from Audio MODEM ({0:.1f} kbps)...'.format(kbps)
|
||||||
return WaitingDialog(parent=parent, message=msg,
|
return WaitingDialog(parent=parent, message=msg,
|
||||||
run_task=receiver_thread, on_success=on_success)
|
run_task=receiver_thread, on_success=on_success)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -34,8 +34,8 @@ except ImportError:
|
|||||||
|
|
||||||
class Plugin(BasePlugin):
|
class Plugin(BasePlugin):
|
||||||
|
|
||||||
def __init__(self, gui, name):
|
def __init__(self, parent, config, name):
|
||||||
BasePlugin.__init__(self, gui, name)
|
BasePlugin.__init__(self, parent, config, name)
|
||||||
self._is_available = self._init()
|
self._is_available = self._init()
|
||||||
self.wallet = None
|
self.wallet = None
|
||||||
self.handler = None
|
self.handler = None
|
||||||
|
|||||||
@@ -114,8 +114,8 @@ class Plugin(BasePlugin):
|
|||||||
def is_available(self):
|
def is_available(self):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def __init__(self, a, b):
|
def __init__(self, parent, config, name)
|
||||||
BasePlugin.__init__(self, a, b)
|
BasePlugin.__init__(self, parent, config, name)
|
||||||
self.imap_server = self.config.get('email_server', '')
|
self.imap_server = self.config.get('email_server', '')
|
||||||
self.username = self.config.get('email_username', '')
|
self.username = self.config.get('email_username', '')
|
||||||
self.password = self.config.get('email_password', '')
|
self.password = self.config.get('email_password', '')
|
||||||
@@ -215,5 +215,3 @@ class Plugin(BasePlugin):
|
|||||||
|
|
||||||
password = str(password_e.text())
|
password = str(password_e.text())
|
||||||
self.config.set_key('email_password', password)
|
self.config.set_key('email_password', password)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -162,8 +162,8 @@ class Exchanger(ThreadJob):
|
|||||||
|
|
||||||
class Plugin(BasePlugin):
|
class Plugin(BasePlugin):
|
||||||
|
|
||||||
def __init__(self,a,b):
|
def __init__(self, parent, config, name):
|
||||||
BasePlugin.__init__(self,a,b)
|
BasePlugin.__init__(self, parent, config, name)
|
||||||
self.exchange = self.config.get('use_exchange', "Blockchain")
|
self.exchange = self.config.get('use_exchange', "Blockchain")
|
||||||
self.currencies = [self.fiat_unit()]
|
self.currencies = [self.fiat_unit()]
|
||||||
self.exchanger = Exchanger(self)
|
self.exchanger = Exchanger(self)
|
||||||
|
|||||||
@@ -48,8 +48,8 @@ def give_error(message):
|
|||||||
|
|
||||||
class Plugin(BasePlugin):
|
class Plugin(BasePlugin):
|
||||||
|
|
||||||
def __init__(self, config, name):
|
def __init__(self, parent, config, name):
|
||||||
BasePlugin.__init__(self, config, name)
|
BasePlugin.__init__(self, parent, config, name)
|
||||||
self._is_available = self._init()
|
self._is_available = self._init()
|
||||||
self.wallet = None
|
self.wallet = None
|
||||||
self.handler = None
|
self.handler = None
|
||||||
|
|||||||
@@ -48,8 +48,8 @@ def give_error(message):
|
|||||||
|
|
||||||
class Plugin(BasePlugin):
|
class Plugin(BasePlugin):
|
||||||
|
|
||||||
def __init__(self, config, name):
|
def __init__(self, parent, config, name):
|
||||||
BasePlugin.__init__(self, config, name)
|
BasePlugin.__init__(self, parent, config, name)
|
||||||
self._is_available = self._init()
|
self._is_available = self._init()
|
||||||
self.wallet = None
|
self.wallet = None
|
||||||
self.handler = None
|
self.handler = None
|
||||||
|
|||||||
@@ -212,8 +212,8 @@ class Plugin(BasePlugin):
|
|||||||
|
|
||||||
wallet = None
|
wallet = None
|
||||||
|
|
||||||
def __init__(self, x, y):
|
def __init__(self, parent, config, name):
|
||||||
BasePlugin.__init__(self, x, y)
|
BasePlugin.__init__(self, parent, config, name)
|
||||||
self.seed_func = lambda x: bitcoin.is_new_seed(x, SEED_PREFIX)
|
self.seed_func = lambda x: bitcoin.is_new_seed(x, SEED_PREFIX)
|
||||||
self.billing_info = None
|
self.billing_info = None
|
||||||
self.is_billing = False
|
self.is_billing = False
|
||||||
|
|||||||
Reference in New Issue
Block a user