Revert "Work around plugins being garbage collected once enabled twice."
This reverts commit 2f71ef4264
.
This commit is contained in:
parent
221dea1f1a
commit
59f9d4e5cc
|
@ -97,7 +97,6 @@ class Component(object):
|
||||||
self._component_starting_deferred = None
|
self._component_starting_deferred = None
|
||||||
self._component_stopping_deferred = None
|
self._component_stopping_deferred = None
|
||||||
_ComponentRegistry.register(self)
|
_ComponentRegistry.register(self)
|
||||||
log.debug("Component '%s' initialized", self._component_name)
|
|
||||||
|
|
||||||
def __del__(self):
|
def __del__(self):
|
||||||
_ComponentRegistry.deregister(self._component_name)
|
_ComponentRegistry.deregister(self._component_name)
|
||||||
|
@ -251,18 +250,6 @@ class ComponentRegistry(object):
|
||||||
else:
|
else:
|
||||||
return succeed(None)
|
return succeed(None)
|
||||||
|
|
||||||
def registered(self, name):
|
|
||||||
"""
|
|
||||||
Check if a component is registered with the us
|
|
||||||
|
|
||||||
:param name: the Component name to check
|
|
||||||
:type name: string
|
|
||||||
|
|
||||||
:returns: True or False
|
|
||||||
:rtype: bolean
|
|
||||||
"""
|
|
||||||
return name in self.components
|
|
||||||
|
|
||||||
def start(self, names=[]):
|
def start(self, names=[]):
|
||||||
"""
|
"""
|
||||||
Starts Components that are currently in a Stopped state and their
|
Starts Components that are currently in a Stopped state and their
|
||||||
|
@ -405,9 +392,7 @@ class ComponentRegistry(object):
|
||||||
|
|
||||||
_ComponentRegistry = ComponentRegistry()
|
_ComponentRegistry = ComponentRegistry()
|
||||||
|
|
||||||
register = _ComponentRegistry.register
|
|
||||||
deregister = _ComponentRegistry.deregister
|
deregister = _ComponentRegistry.deregister
|
||||||
registered = _ComponentRegistry.registered
|
|
||||||
start = _ComponentRegistry.start
|
start = _ComponentRegistry.start
|
||||||
stop = _ComponentRegistry.stop
|
stop = _ComponentRegistry.stop
|
||||||
pause = _ComponentRegistry.pause
|
pause = _ComponentRegistry.pause
|
||||||
|
|
|
@ -166,13 +166,8 @@ class PluginManagerBase:
|
||||||
DeprecationWarning,
|
DeprecationWarning,
|
||||||
instance.__module__, 0
|
instance.__module__, 0
|
||||||
)
|
)
|
||||||
|
|
||||||
if not component.registered(instance.plugin._component_name):
|
|
||||||
component.register(instance.plugin)
|
|
||||||
|
|
||||||
if self._component_state == "Started":
|
if self._component_state == "Started":
|
||||||
component.start([instance.plugin._component_name])
|
component.start([instance.plugin._component_name])
|
||||||
|
|
||||||
plugin_name = plugin_name.replace("-", " ")
|
plugin_name = plugin_name.replace("-", " ")
|
||||||
self.plugins[plugin_name] = instance
|
self.plugins[plugin_name] = instance
|
||||||
if plugin_name not in self.config["enabled_plugins"]:
|
if plugin_name not in self.config["enabled_plugins"]:
|
||||||
|
|
|
@ -56,12 +56,12 @@ class CorePluginBase(PluginBase):
|
||||||
super(CorePluginBase, self).__init__("CorePlugin." + plugin_name)
|
super(CorePluginBase, self).__init__("CorePlugin." + plugin_name)
|
||||||
# Register RPC methods
|
# Register RPC methods
|
||||||
component.get("RPCServer").register_object(self, plugin_name.lower())
|
component.get("RPCServer").register_object(self, plugin_name.lower())
|
||||||
log.debug("CorePlugin '%s' initialized..", plugin_name)
|
log.debug("CorePlugin initialized..")
|
||||||
|
|
||||||
class GtkPluginBase(PluginBase):
|
class GtkPluginBase(PluginBase):
|
||||||
def __init__(self, plugin_name):
|
def __init__(self, plugin_name):
|
||||||
super(GtkPluginBase, self).__init__("GtkPlugin." + plugin_name)
|
super(GtkPluginBase, self).__init__("GtkPlugin." + plugin_name)
|
||||||
log.debug("GtkPlugin '%s' initialized..", plugin_name)
|
log.debug("GtkPlugin initialized..")
|
||||||
|
|
||||||
class WebPluginBase(PluginBase):
|
class WebPluginBase(PluginBase):
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ class WebPluginBase(PluginBase):
|
||||||
|
|
||||||
# Register JSON rpc methods
|
# Register JSON rpc methods
|
||||||
component.get("JSON").register_object(self, plugin_name.lower())
|
component.get("JSON").register_object(self, plugin_name.lower())
|
||||||
log.debug("WebPlugin '%s' initialized..", plugin_name)
|
log.debug("WebPlugin initialized..")
|
||||||
|
|
||||||
def enable(self):
|
def enable(self):
|
||||||
pass
|
pass
|
||||||
|
|
Loading…
Reference in New Issue