6 internalname = raw_input("Internal plugin name (no whitespaces, plugin directory): ")
7 name = raw_input("Visible plugin name: ")
13 print "Plugin categories:"
14 for dir in os.listdir("."):
15 if os.path.isdir(dir):
20 category = raw_input("Select plugin category: ")
21 category = dirlist[int(category) - 1]
23 def add_where_extensionsmenu(name, fnc):
24 description = raw_input("Plugin description: ")
25 return 'PluginDescriptor(name = "%s", description = _("%s"), where = PluginDescriptor.WHERE_EXTENSIONSMENU, fnc = %s)' % (name, description, fnc)
27 def add_where_pluginmenu(name, fnc):
28 description = raw_input("Plugin description: ")
29 icon = raw_input("Icon (default: 'plugin.png': ")
32 return 'PluginDescriptor(name = "%s", description = _("%s"), icon = "%s", where = PluginDescriptor.WHERE_PLUGINMENU, fnc = %s)' % (name, description, icon, fnc)
35 wherelist.append(("WHERE_EXTENSIONSMENU", add_where_extensionsmenu))
36 wherelist.append(("WHERE_PLUGINMENU", add_where_pluginmenu))
44 print "selected targets:"
45 for where in targetlist:
49 print "available targets:"
51 for where in wherelist:
56 target = raw_input("Select WHERE-target: ")
60 if wherelist[int(target) - 1] not in targetlist:
61 targetlist.append(wherelist[int(target) - 1])
63 targetlist.remove(wherelist[int(target) - 1])
66 pluginpath = category + "/" + internalname
69 makefile = open(category + "/Makefile.am", "r")
70 lines = makefile.readlines()
71 lines = ''.join(lines)
73 lines += " " + internalname
76 makefile = open(category + "/Makefile.am", "w")
82 configure = open("../../../configure.ac", "r")
84 line = configure.readline()
88 if line.strip() == "lib/python/Plugins/" + category + "/Makefile":
89 lines.append("lib/python/Plugins/" + pluginpath + "/Makefile\n")
93 configure = open("../../../configure.ac", "w")
94 configure.writelines(lines)
97 file = open(pluginpath + "/plugin.py", "w")
100 for where in targetlist:
101 importlist.append(where[0])
103 file.write("""from Screens.Screen import Screen
104 from Plugins.Plugin import PluginDescriptor
108 for count in range(len(targetlist)):
110 mainlist.append("main")
112 mainlist.append("main" + str(count))
114 for main in mainlist:
116 def %s(session, **kwargs):
121 for count in range(len(targetlist)):
123 where = targetlist[count]
124 print "Options for target %s" % where[0]
125 descriptorlist.append(where[1](name, mainlist[count]))
127 if len(descriptorlist) == 1:
128 descriptorlist = descriptorlist[0]
130 descriptorlist = "[" + ', '.join(descriptorlist) + "]"
133 def Plugins(**kwargs):
135 """ % descriptorlist)
139 makefile = open(pluginpath + "/Makefile.am", "w")
140 makefile.write("""installdir = $(LIBDIR)/enigma2/python/Plugins/%s/%s
145 """ % (category, internalname))