1
0

Improved new_window handling.

Remove new_window hook.
Plugin informed of all windows via events when first loaded.
init_qt no longer needed for exchange_rate plugin.
This commit is contained in:
Neil Booth
2015-09-04 09:53:16 +09:00
parent fcc452d7b0
commit 77a029082a
4 changed files with 14 additions and 14 deletions

View File

@@ -69,6 +69,9 @@ class Plugins:
else:
p = __import__(full_name, fromlist=['electrum_plugins'])
plugin = p.Plugin(self, config, name)
# Inform the plugin of our windows
for window in self.windows:
plugin.on_new_window(window)
self.plugins[name] = plugin
self.print_error("loaded", name)
return plugin
@@ -115,8 +118,13 @@ class Plugins:
x += (lambda: self.wallet_plugin_loader(config, name),)
wallet.wallet_types.append(x)
def trigger(self, event, *args, **kwargs):
for plugin in self.plugins.values():
getattr(plugin, event)(*args, **kwargs)
def on_new_window(self, window):
self.windows.append(window)
self.trigger('on_new_window', window)
def on_close_window(self, window):
self.windows.remove(window)
@@ -194,8 +202,6 @@ class BasePlugin:
@hook
def close_wallet(self): pass
#def init(self): pass
def is_enabled(self):
return self.is_available() and self.config.get('use_'+self.name) is True
@@ -204,3 +210,7 @@ class BasePlugin:
def settings_dialog(self):
pass
# Events
def on_new_window(self, window):
pass