update the create_plugin script allowing for the new webui plugin stuff
This commit is contained in:
parent
5645d6644d
commit
3901f3e6b2
|
@ -50,7 +50,7 @@ def create_plugin():
|
||||||
safe_name = name.lower()
|
safe_name = name.lower()
|
||||||
plugin_base = os.path.realpath(os.path.join(options.path, safe_name))
|
plugin_base = os.path.realpath(os.path.join(options.path, safe_name))
|
||||||
src = os.path.join(plugin_base, safe_name)
|
src = os.path.join(plugin_base, safe_name)
|
||||||
template_dir = os.path.join(src, "template")
|
data_dir = os.path.join(src, "data")
|
||||||
|
|
||||||
if os.path.exists(plugin_base):
|
if os.path.exists(plugin_base):
|
||||||
print "the directory %s already exists, delete it first" % plugin_base
|
print "the directory %s already exists, delete it first" % plugin_base
|
||||||
|
@ -77,8 +77,7 @@ def create_plugin():
|
||||||
print "creating folders.."
|
print "creating folders.."
|
||||||
os.mkdir(plugin_base)
|
os.mkdir(plugin_base)
|
||||||
os.mkdir(src)
|
os.mkdir(src)
|
||||||
os.mkdir(os.path.join(src, "data"))
|
os.mkdir(data_dir)
|
||||||
os.mkdir(template_dir)
|
|
||||||
|
|
||||||
print "creating files.."
|
print "creating files.."
|
||||||
write_file(plugin_base,"setup.py", SETUP)
|
write_file(plugin_base,"setup.py", SETUP)
|
||||||
|
@ -87,8 +86,8 @@ def create_plugin():
|
||||||
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(src, "common.py", COMMON)
|
||||||
write_file(os.path.join(src,"data"),"config.glade", GLADE)
|
write_file(data_dir, "config.glade", GLADE)
|
||||||
write_file(template_dir,"default.html", DEFAULT_HTML)
|
write_file(data_dir, "%s.js" % safe_name, DEFAULT_JS)
|
||||||
|
|
||||||
#add an input parameter for this?
|
#add an input parameter for this?
|
||||||
print "building dev-link.."
|
print "building dev-link.."
|
||||||
|
@ -272,7 +271,12 @@ from deluge.ui.client import client
|
||||||
from deluge import component
|
from deluge import component
|
||||||
from deluge.plugins.pluginbase import WebPluginBase
|
from deluge.plugins.pluginbase import WebPluginBase
|
||||||
|
|
||||||
|
from common import get_resource
|
||||||
|
|
||||||
class WebUI(WebPluginBase):
|
class WebUI(WebPluginBase):
|
||||||
|
|
||||||
|
scripts = [get_resource("%(safe_name)s.js")]
|
||||||
|
|
||||||
def enable(self):
|
def enable(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -280,16 +284,23 @@ class WebUI(WebPluginBase):
|
||||||
pass
|
pass
|
||||||
"""
|
"""
|
||||||
|
|
||||||
DEFAULT_HTML = """$def with (value1, value2)
|
DEFAULT_JS = """%(name)sPlugin = Ext.extend(Deluge.Plugin, {
|
||||||
$:render.header(_("Demo1"), '')
|
constructor: function(config) {
|
||||||
<div class="panel">
|
config = Ext.apply({
|
||||||
<h2>Demo:%(name)s</h2>
|
name: "%(name)s"
|
||||||
<pre>
|
}, config);
|
||||||
$value1
|
%(name)sPlugin.superclass.constructor.call(this, config);
|
||||||
$value2
|
},
|
||||||
</pre>'
|
|
||||||
</div>
|
onDisable: function() {
|
||||||
$:render.footer()
|
|
||||||
|
},
|
||||||
|
|
||||||
|
onEnable: function() {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
new %(name)sPlugin();
|
||||||
"""
|
"""
|
||||||
|
|
||||||
GPL = """#
|
GPL = """#
|
||||||
|
@ -300,6 +311,7 @@ GPL = """#
|
||||||
# Basic plugin template created by:
|
# Basic plugin template created by:
|
||||||
# Copyright (C) 2008 Martijn Voncken <mvoncken@gmail.com>
|
# Copyright (C) 2008 Martijn Voncken <mvoncken@gmail.com>
|
||||||
# Copyright (C) 2007-2009 Andrew Resch <andrewresch@gmail.com>
|
# Copyright (C) 2007-2009 Andrew Resch <andrewresch@gmail.com>
|
||||||
|
# Copyright (C) 2009 Damien Churchill <damoxc@gmail.com>
|
||||||
#
|
#
|
||||||
# Deluge is free software.
|
# Deluge is free software.
|
||||||
#
|
#
|
||||||
|
|
Loading…
Reference in New Issue