minor fixes

This commit is contained in:
Martijn Voncken 2008-08-09 08:12:22 +00:00
parent faeddbdf46
commit 6dbbb254e2
2 changed files with 23 additions and 19 deletions

View File

@ -34,12 +34,16 @@
from deluge.log import LOG as log from deluge.log import LOG as log
import ui import ui
class GtkUI(ui.UI): class GtkUI(object):
def __init__(self, plugin_api, plugin_name): def __init__(self, plugin_api, plugin_name):
log.debug("Calling UI init") log.debug("Calling UI init")
# Call UI constructor self.plugin = plugin_api
ui.UI.__init__(self, plugin_api, plugin_name)
log.debug("test plugin initialized..") def enable(self):
pass
def disable(self):
pass
def enable(self): def enable(self):
self.plugin.register_hook("on_apply_prefs", self.apply_prefs) self.plugin.register_hook("on_apply_prefs", self.apply_prefs)
@ -48,4 +52,4 @@ class GtkUI(ui.UI):
self.plugin.deregister_hook("on_apply_prefs", self.apply_prefs) self.plugin.deregister_hook("on_apply_prefs", self.apply_prefs)
def apply_prefs(self): def apply_prefs(self):
log.debug("applying prefs in test plugin!!") log.debug("applying prefs")

View File

@ -1,9 +1,9 @@
""" """
creates an empty plugin and links it from ~/.config/deluge/plugins Creates an empty plugin and links it from ~/.config/deluge/plugins
This plugin includes the framework for using the preferences dialog
usage : python create_plugin.py --name <p> --path --add-dev-link Example:
python create_plugin.py --name MyPlugin2 --basepath . --author-name "Your Name" --author-email "yourname@example.com"
creates an empty plugin.
""" """
@ -89,7 +89,7 @@ import deluge
from deluge.log import LOG as log from deluge.log import LOG as log
from deluge.plugins.corepluginbase import CorePluginBase from deluge.plugins.corepluginbase import CorePluginBase
from deluge import component from deluge import component
from deluge.plugins.coreclient import client #from deluge.plugins.coreclient import client #1.1 and later only
#client: see http://dev.deluge-torrent.org/wiki/Development/UiClient#Remoteapi #client: see http://dev.deluge-torrent.org/wiki/Development/UiClient#Remoteapi
DEFAULT_PREFS = { DEFAULT_PREFS = {
@ -99,7 +99,7 @@ DEFAULT_PREFS = {
class Core(CorePluginBase): class Core(CorePluginBase):
def enable(self): def enable(self):
self.config = deluge.configmanager.ConfigManager("%(name)s.conf", DEFAULT_PREFS) self.config = deluge.configmanager.ConfigManager("%(safe_name)s.conf", DEFAULT_PREFS)
def disable(self): def disable(self):
pass pass
@ -187,6 +187,7 @@ class GtkUI(object):
self.plugin.add_preferences_page("%(name)s", self.glade.get_widget("prefs_box")) self.plugin.add_preferences_page("%(name)s", self.glade.get_widget("prefs_box"))
self.plugin.register_hook("on_apply_prefs", self.on_apply_prefs) self.plugin.register_hook("on_apply_prefs", self.on_apply_prefs)
self.plugin.register_hook("on_show_prefs", self.on_show_prefs) self.plugin.register_hook("on_show_prefs", self.on_show_prefs)
self.on_show_prefs()
def disable(self): def disable(self):
self.plugin.remove_preferences_page("%(name)s") self.plugin.remove_preferences_page("%(name)s")
@ -278,8 +279,7 @@ class WebUI(object):
api.config_page_manager.unregister('%(safe_name)s') api.config_page_manager.unregister('%(safe_name)s')
""" """
GPL = """ GPL = """#
#
# %(filename)s # %(filename)s
# #
# Copyright (C) 2008 %(author_name)s <%(author_email)s> # Copyright (C) 2008 %(author_name)s <%(author_email)s>