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

@ -2,19 +2,19 @@
# gtkui.py # gtkui.py
# #
# Copyright (C) 2007 Andrew Resch ('andar') <andrewresch@gmail.com> # Copyright (C) 2007 Andrew Resch ('andar') <andrewresch@gmail.com>
# #
# Deluge is free software. # Deluge is free software.
# #
# You may redistribute it and/or modify it under the terms of the # You may redistribute it and/or modify it under the terms of the
# GNU General Public License, as published by the Free Software # GNU General Public License, as published by the Free Software
# Foundation; either version 3 of the License, or (at your option) # Foundation; either version 3 of the License, or (at your option)
# any later version. # any later version.
# #
# deluge is distributed in the hope that it will be useful, # deluge is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU General Public License for more details. # See the GNU General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with deluge. If not, write to: # along with deluge. If not, write to:
# The Free Software Foundation, Inc., # The Free Software Foundation, Inc.,
@ -34,18 +34,22 @@
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)
def disable(self): def disable(self):
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>