Author: damoxc
Revision: 5067
Log:
begin messing about with the plugin manager
Diff:
Modified: trunk/deluge/ui/web/json_api.py
===================================================================
--- trunk/deluge/ui/web/json_api.py 2009-04-16 20:00:27 UTC (rev 5066)
+++ trunk/deluge/ui/web/json_api.py 2009-04-16 22:03:50 UTC (rev 5067)
@@ -81,6 +81,7 @@
component.Component.__init__(self, "JSON")
self._remote_methods = []
self._local_methods = {}
+ client.disconnect_callback = self._on_client_disconnect
def connect(self, host="localhost", port=58846, username="", password=""):
"""
@@ -105,9 +106,13 @@
"""
d = client.daemon.get_method_list()
d.addCallback(on_get_methods)
+ component.get("PluginManager").start()
_d.addCallback(on_client_connected)
return d
+ def _on_client_disconnect(self, *args):
+ component.get("PluginManager").stop()
+
def _exec_local(self, method, params):
"""
Handles executing all local methods.
Added: trunk/deluge/ui/web/pluginmanager.py
===================================================================
--- trunk/deluge/ui/web/pluginmanager.py (rev 0)
+++ trunk/deluge/ui/web/pluginmanager.py 2009-04-16 22:03:50 UTC (rev
5067)
@@ -0,0 +1,51 @@
+#
+# pluginmanager.py
+#
+# Copyright (C) 2009 Damien Churchill <[email protected]>
+#
+# Deluge is free software.
+#
+# You may redistribute it and/or modify it under the terms of the
+# GNU General Public License, as published by the Free Software
+# Foundation; either version 3 of the License, or (at your option)
+# any later version.
+#
+# deluge is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with deluge. If not, write to:
+# The Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor
+# Boston, MA 02110-1301, USA.
+#
+
+import logging
+
+from deluge.component import Component
+from deluge.pluginmanagerbase import PluginManagerBase
+from deluge.ui.client import client
+from deluge.configmanager import ConfigManager
+
+log = logging.getLogger(__name__)
+
+class PluginManager(PluginManagerBase, Component):
+ def __init__(self):
+ Component.__init__(self, "PluginManager")
+ self.config = ConfigManager("web.conf")
+ PluginManagerBase.__init__(self, "web.conf", "deluge.plugin.web")
+
+ def start(self):
+ """Start up the plugin manager"""
+
+ # Update the enabled plugins from the core
+ d = client.core.get_enabled_plugins()
+ d.addCallback(self._on_get_enabled_plugins)
+
+ def stop(self):
+ self.disable_plugins()
+
+ def update(self):
+ pass
\ No newline at end of file
Modified: trunk/deluge/ui/web/server.py
===================================================================
--- trunk/deluge/ui/web/server.py 2009-04-16 20:00:27 UTC (rev 5066)
+++ trunk/deluge/ui/web/server.py 2009-04-16 22:03:50 UTC (rev 5067)
@@ -46,6 +46,7 @@
from deluge.ui.tracker_icons import TrackerIcons
from deluge.ui.web.common import Template
from deluge.ui.web.json_api import JSON, WebApi
+from deluge.ui.web.pluginmanager import PluginManager
log = logging.getLogger(__name__)
# Initialize gettext
@@ -303,6 +304,9 @@
self.__shutdown()
return 1
SetConsoleCtrlHandler(win_handler)
+
+ # Initalize the plugins
+ self.plugins = PluginManager()
def start(self):
log.info("%s %s.", _("Starting server in PID"), os.getpid())
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"deluge-commit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/deluge-commit?hl=en
-~----------~----~----~----~------~----~------~--~---