plugin api update

This commit is contained in:
Zach Tibbitts 2007-03-18 16:23:08 +00:00
parent c54d87b69c
commit ca69c978a7
7 changed files with 15 additions and 29 deletions

View File

@ -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
)

View File

@ -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"')

View File

@ -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
)

View File

@ -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\
)

View File

@ -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
)

View File

@ -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):

View File

@ -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