mirror of
https://github.com/codex-storage/deluge.git
synced 2025-02-18 14:26:24 +00:00
Some changes to the create_plugin script to work properly with 1.2
This commit is contained in:
parent
5b87af0e46
commit
9a94b3719d
@ -86,6 +86,7 @@ def create_plugin():
|
|||||||
write_file(src,"gtkui.py", GTKUI)
|
write_file(src,"gtkui.py", GTKUI)
|
||||||
write_file(src,"webui.py", WEBUI)
|
write_file(src,"webui.py", WEBUI)
|
||||||
write_file(src,"core.py", CORE)
|
write_file(src,"core.py", CORE)
|
||||||
|
write_file(src, "common.py", COMMON)
|
||||||
write_file(os.path.join(src,"data"),"config.glade", GLADE)
|
write_file(os.path.join(src,"data"),"config.glade", GLADE)
|
||||||
write_file(template_dir,"default.html", DEFAULT_HTML)
|
write_file(template_dir,"default.html", DEFAULT_HTML)
|
||||||
|
|
||||||
@ -175,7 +176,7 @@ setup(
|
|||||||
author_email=__author_email__,
|
author_email=__author_email__,
|
||||||
url=__url__,
|
url=__url__,
|
||||||
license=__license__,
|
license=__license__,
|
||||||
long_description=__long_description__,
|
long_description=__long_description__ if __long_description__ else __description__,
|
||||||
|
|
||||||
packages=[__plugin_name__.lower()],
|
packages=[__plugin_name__.lower()],
|
||||||
package_data = __pkg_data__,
|
package_data = __pkg_data__,
|
||||||
@ -191,6 +192,12 @@ setup(
|
|||||||
)
|
)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
COMMON = """
|
||||||
|
def get_resource(filename):
|
||||||
|
import pkg_resources, os
|
||||||
|
return pkg_resources.resource_filename("extractor", os.path.join("data", filename))
|
||||||
|
"""
|
||||||
|
|
||||||
GTKUI = """
|
GTKUI = """
|
||||||
import gtk
|
import gtk
|
||||||
|
|
||||||
@ -200,19 +207,20 @@ from deluge.plugins.pluginbase import GtkPluginBase
|
|||||||
import deluge.component as component
|
import deluge.component as component
|
||||||
import deluge.common
|
import deluge.common
|
||||||
|
|
||||||
|
from common import get_resource
|
||||||
|
|
||||||
class GtkUI(GtkPluginBase):
|
class GtkUI(GtkPluginBase):
|
||||||
def enable(self):
|
def enable(self):
|
||||||
self.glade = gtk.glade.XML(self.get_resource("config.glade"))
|
self.glade = gtk.glade.XML(get_resource("config.glade"))
|
||||||
|
|
||||||
self.plugin.add_preferences_page("%(name)s", self.glade.get_widget("prefs_box"))
|
component.get("Preferences").add_page("%(name)s", self.glade.get_widget("prefs_box"))
|
||||||
self.plugin.register_hook("on_apply_prefs", self.on_apply_prefs)
|
component.get("PluginManager").register_hook("on_apply_prefs", self.on_apply_prefs)
|
||||||
self.plugin.register_hook("on_show_prefs", self.on_show_prefs)
|
component.get("PluginManager").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")
|
component.get("Preferences").remove_page("%(name)s")
|
||||||
self.plugin.deregister_hook("on_apply_prefs", self.on_apply_prefs)
|
component.get("PluginManager").deregister_hook("on_apply_prefs", self.on_apply_prefs)
|
||||||
self.plugin.deregister_hook("on_show_prefs", self.on_show_prefs)
|
component.get("PluginManager").deregister_hook("on_show_prefs", self.on_show_prefs)
|
||||||
|
|
||||||
def on_apply_prefs(self):
|
def on_apply_prefs(self):
|
||||||
log.debug("applying prefs for %(name)s")
|
log.debug("applying prefs for %(name)s")
|
||||||
@ -227,10 +235,6 @@ class GtkUI(GtkPluginBase):
|
|||||||
def cb_get_config(self, config):
|
def cb_get_config(self, config):
|
||||||
"callback for on show_prefs"
|
"callback for on show_prefs"
|
||||||
self.glade.get_widget("txt_test").set_text(config["test"])
|
self.glade.get_widget("txt_test").set_text(config["test"])
|
||||||
|
|
||||||
def get_resource(self, filename):
|
|
||||||
import pkg_resources, os
|
|
||||||
return pkg_resources.resource_filename("%(safe_name)s", os.path.join("data", filename))
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
GLADE = """<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
GLADE = """<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
@ -315,6 +319,16 @@ GPL = """#
|
|||||||
# 51 Franklin Street, Fifth Floor
|
# 51 Franklin Street, Fifth Floor
|
||||||
# Boston, MA 02110-1301, USA.
|
# Boston, MA 02110-1301, USA.
|
||||||
#
|
#
|
||||||
|
# In addition, as a special exception, the copyright holders give
|
||||||
|
# permission to link the code of portions of this program with the OpenSSL
|
||||||
|
# library.
|
||||||
|
# You must obey the GNU General Public License in all respects for all of
|
||||||
|
# the code used other than OpenSSL. If you modify file(s) with this
|
||||||
|
# exception, you may extend this exception to your version of the file(s),
|
||||||
|
# but you are not obligated to do so. If you do not wish to do so, delete
|
||||||
|
# this exception statement from your version. If you delete this exception
|
||||||
|
# statement from all source files in the program, then also delete it here.
|
||||||
|
#
|
||||||
"""
|
"""
|
||||||
|
|
||||||
CREATE_DEV_LINK = """#!/bin/bash
|
CREATE_DEV_LINK = """#!/bin/bash
|
||||||
|
Loading…
x
Reference in New Issue
Block a user