From ca69c978a7b6a36a739f2bacde7d77dffd8eb994 Mon Sep 17 00:00:00 2001 From: Zach Tibbitts Date: Sun, 18 Mar 2007 16:23:08 +0000 Subject: [PATCH] plugin api update --- plugins/ExamplePlugin/plugin.py | 5 +---- plugins/HelloWorld/plugin.py | 4 ++-- plugins/NetworkGraph/plugin.py | 7 ++----- plugins/NetworkHealth/plugin.py | 7 ++----- plugins/TorrentSearch/plugin.py | 8 +++----- src/delugegtk.py | 5 +++-- src/delugeplugins.py | 8 ++------ 7 files changed, 15 insertions(+), 29 deletions(-) diff --git a/plugins/ExamplePlugin/plugin.py b/plugins/ExamplePlugin/plugin.py index 312cc87e2..d0a789dc2 100644 --- a/plugins/ExamplePlugin/plugin.py +++ b/plugins/ExamplePlugin/plugin.py @@ -94,11 +94,8 @@ class plugin_Example: # The plugin's class register_plugin("Example Plugin", # The name of the plugin plugin_Example, # The plugin's class + "Zach Tibbitts", # The author's Name "0.5.0", # The plugin's version number "An example plugin", # A description of the plugin config=True, # If the plugin can be configured - default=False, # If the plugin should be loaded by default - requires="0.5.0", # Required version of Deluge - interface="gtk", # Required Deluge interface - required_plugins=None # Any plugins that must be loaded before this ) diff --git a/plugins/HelloWorld/plugin.py b/plugins/HelloWorld/plugin.py index 232e3a417..f112d326a 100644 --- a/plugins/HelloWorld/plugin.py +++ b/plugins/HelloWorld/plugin.py @@ -14,6 +14,6 @@ class plugin_Hello: register_plugin("Hello World", plugin_Hello, + "Zach Tibbitts", "1.0", - 'Displays "Hello, World"', - requires="0.5.0") + 'Displays "Hello, World"') diff --git a/plugins/NetworkGraph/plugin.py b/plugins/NetworkGraph/plugin.py index fa9724378..575f31e91 100644 --- a/plugins/NetworkGraph/plugin.py +++ b/plugins/NetworkGraph/plugin.py @@ -20,7 +20,7 @@ class plugin_NetGraph: self.parentNotebook = self.parent.notebook # print "Parent NOTEBOOK:", self.parentNotebook - self.parentNotebook.append_page(self.topWidget, gtk.Label("NetGraph")) + self.parentNotebook.append_page(self.topWidget, gtk.Label("Graph")) # print "My INDEX in parentNoteBook:", self.index self.image.show() @@ -162,11 +162,8 @@ class plugin_NetGraph: register_plugin("Network Activity Graph", # The name of the plugin plugin_NetGraph, # The plugin's class + "Alon Zakai, Zach Tibbitts", # Authors "0.2", # The plugin's version number "Network Activity Graph plugin\n\nWritten by Kripkenstein", # A description of the plugin config=False, # If the plugin can be configured - default=False, # If the plugin should be loaded by default - requires="0.5.0", # Required version of Deluge - interface="gtk", # Required Deluge interface - required_plugins=None # Any plugins that must be loaded before this ) diff --git a/plugins/NetworkHealth/plugin.py b/plugins/NetworkHealth/plugin.py index b96d0cb72..a1094ebe9 100644 --- a/plugins/NetworkHealth/plugin.py +++ b/plugins/NetworkHealth/plugin.py @@ -32,11 +32,8 @@ class plugin_NetworkHealth: ### Register plugin with Deluge register_plugin("Network Health Monitor", # The name of the plugin plugin_NetworkHealth, # The plugin's class + "Alon Zakai, Zach Tibbitts", # Authors "0.2", # The plugin's version number "Network Health Monitor plugin\n\nWritten by Kripkenstein", # A description of the plugin - config=False, # If the plugin can be configured - default=False, # If the plugin should be loaded by default - requires="0.5.0", # Required version of Deluge - interface="gtk", # Required Deluge interface - required_plugins=None # Any plugins that must be loaded before this + config=False # If the plugin can be configured\ ) diff --git a/plugins/TorrentSearch/plugin.py b/plugins/TorrentSearch/plugin.py index cf3f97105..9b59193ce 100644 --- a/plugins/TorrentSearch/plugin.py +++ b/plugins/TorrentSearch/plugin.py @@ -154,10 +154,8 @@ class plugin_Search: register_plugin("Torrent Search", plugin_Search, + "Zach Tibbitts", "0.5", "A searchbar for torrent search engines", - config=True, - default=False, - requires="0.5.0", - interface="gtk", - required_plugins=None) + config=True + ) diff --git a/src/delugegtk.py b/src/delugegtk.py index 28b7d0081..4978d85b0 100644 --- a/src/delugegtk.py +++ b/src/delugegtk.py @@ -261,6 +261,7 @@ class DelugeGTK: return True name = model.get_value(model.get_iter(path), 0) plugin = self.plugins.get_plugin(name) + author = plugin['author'] version = plugin['version'] config = plugin['config'] description = plugin['description'] @@ -269,8 +270,8 @@ class DelugeGTK: else: self.prf_glade.get_widget("plugin_conf").set_sensitive(False) self.prf_glade.get_widget("plugin_text").get_buffer( - ).set_text("%s\nVersion: %s\n\n%s"% - (name, version, description)) + ).set_text("%s\nBy: %s\nVersion: %s\n\n%s"% + (name, author, version, description)) return True def plugin_toggled(self, renderer, path): diff --git a/src/delugeplugins.py b/src/delugeplugins.py index 353ff85be..7c9c62230 100644 --- a/src/delugeplugins.py +++ b/src/delugeplugins.py @@ -71,16 +71,12 @@ class PluginManager: self.enabled_plugins[name].unload() self.enabled_plugins.clear() - def register_plugin(self, name, plugin_class, version, description, config=False, - default=False, requires=None, interface=None, required_plugins=None): + def register_plugin(self, name, plugin_class, author, version, description, config=False): self.available_plugins[name] = {'class': plugin_class, + 'author': author, 'version': version, 'description': description, 'config': config, - 'default': default, - 'requires': requires, - 'interface': interface, - 'req plugins': required_plugins, 'path': self.path} ## Few lines of code to test functionality