5 name = raw_input("Plugin name: ")
11 print "Plugin categories:"
12 for dir in os.listdir("."):
13 if os.path.isdir(dir):
18 category = raw_input("Select plugin category: ")
19 category = dirlist[int(category) - 1]
21 def add_where_extensionsmenu(name, fnc):
22 description = raw_input("Plugin description: ")
23 return 'PluginDescriptor(name = "%s", description = _("%s"), where = PluginDescriptor.WHERE_EXTENSIONSMENU, fnc = %s)' % (name, description, fnc)
25 def add_where_pluginmenu(name, fnc):
26 description = raw_input("Plugin description: ")
27 icon = raw_input("Icon (default: 'plugin.png': ")
30 return 'PluginDescriptor(name = "%s", description = _("%s"), icon = "%s", where = PluginDescriptor.WHERE_PLUGINMENU, fnc = %s)' % (name, description, icon, fnc)
33 wherelist.append(("WHERE_EXTENSIONSMENU", add_where_extensionsmenu))
34 wherelist.append(("WHERE_PLUGINMENU", add_where_extensionsmenu))
42 print "selected targets:"
43 for where in targetlist:
47 print "available targets:"
49 for where in wherelist:
54 target = raw_input("Select WHERE-target: ")
58 if wherelist[int(target) - 1] not in targetlist:
59 targetlist.append(wherelist[int(target) - 1])
61 targetlist.remove(wherelist[int(target) - 1])
64 file = open("plugin.py", "w")
67 for where in targetlist:
68 importlist.append(where[0])
70 file.write("""from Screens.Screen import Screen
71 from Plugins.Plugin import PluginDescriptor, %s
72 """ % ', '.join(importlist))
75 for count in range(len(targetlist)):
77 mainlist.append("main")
79 mainlist.append("main" + str(count))
83 def %s(session, **kwargs):
88 for count in range(len(targetlist)):
90 where = targetlist[count]
91 print "Options for target %s" % where[0]
92 descriptorlist.append(where[1](name, mainlist[count]))
94 if len(descriptorlist) == 1:
95 descriptorlist = descriptorlist[0]
97 descriptorlist = "[" + ', '.join(descriptorlist) + "]"
100 def Plugins(**kwargs):
102 """ % descriptorlist)