lib/python/Makefile
lib/python/Components/Makefile
lib/python/Screens/Makefile
+lib/python/Plugins/Makefile
lib/python/Tools/Makefile
lib/service/Makefile
lib/components/Makefile
<item text="About..."><screen module="About" /></item>
</menu>
- <item text="Games / Plugins"><screen module="PluginBrowser" /></item>
+ <item text="Games / Plugins"><screen module="PluginBrowser" screen="PluginBrowser" /></item>
<menu text="Setup">
<!--<menu text="Service Organising">
<item text="New Bouquets"></item>
<screen name="LanguageSelection" position="200,125" size="220,250" title="Language selection">
<widget name="list" position="10,0" size="190,240" scrollbarMode="showOnDemand" />
</screen>
+ <screen name="PluginBrowser" position="100,125" size="400,350" title="Plugin browser">
+ <widget name="list" position="10,0" size="380,340" scrollbarMode="showOnDemand" />
+ </screen>
<screen name="NimSelection" position="140,165" size="400,100" title="select Slot">
<widget name="nimlist" position="20,10" size="360,75" />
</screen>
<widget name="config" position="10,50" size="420,175" scrollbarMode="showOnDemand" />
<widget name="introduction" position="10,230" size="400,30" font="Arial;23" />
</screen>
- <screen name="PluginBrowser" position="190,125" size="360,250" title="Plugins">
- <widget name="title" position="10,10" size="280,35" font="Arial;23" />
- <widget name="pluginlist" position="10,50" size="320,200" />
- </screen>
<screen name="About" position="140,125" size="360,250" title="About">
<widget name="text" position="10,30" size="420,40" font="Arial;18"/>
<widget name="tuner" position="10,80" size="420,20" font="Arial;18"/>
InputDevice.py ServicePosition.py SetupDevices.py Harddisk.py \
AVSwitch.py Network.py RFmod.py DiskInfo.py NimManager.py Lcd.py \
EpgList.py ScrollLabel.py Timezones.py Language.py HelpMenuList.py \
- BlinkingPixmap.py Pixmap.py ConditionalWidget.py Slider.py LanguageList.py
+ BlinkingPixmap.py Pixmap.py ConditionalWidget.py Slider.py LanguageList.py \
+ PluginList.py PluginComponent.py
--- /dev/null
+import os
+
+from Tools.Directories import *
+#import Plugins
+
+class PluginComponent:
+ def __init__(self):
+ self.plugins = []
+ self.setPluginPrefix("Plugins.")
+
+ def setPluginPrefix(self, prefix):
+ self.prefix = prefix
+
+ def getPluginList(self):
+ list = []
+ dir = os.listdir("/usr/lib/enigma2/python/Plugins/")
+ for x in dir:
+ if x[-3:] == ".py" and x[:-3] != "__init__":
+ #try:
+ print "trying to import " + self.prefix + x[:-3]
+ exec "import " + self.prefix + x[:-3]
+ picturepath = eval(self.prefix + x[:-3]).getPicturePath()
+ pluginname = eval(self.prefix + x[:-3]).getPluginName()
+ list.append((picturepath, pluginname , x[:-3]))
+ #except:
+ #print "Failed to open module - wrong plugin!"
+ return list
+
+ def runPlugin(self, plugin, session):
+ exec "import " + self.prefix + plugin[2]
+ eval(self.prefix + plugin[2]).main(session)
+
+plugins = PluginComponent()
--- /dev/null
+from HTMLComponent import *
+from GUIComponent import *
+
+from MenuList import MenuList
+
+from Tools.Directories import *
+
+from enigma import *
+
+RT_HALIGN_LEFT = 0
+RT_HALIGN_RIGHT = 1
+RT_HALIGN_CENTER = 2
+RT_HALIGN_BLOCK = 4
+
+RT_VALIGN_TOP = 0
+RT_VALIGN_CENTER = 8
+RT_VALIGN_BOTTOM = 16
+
+def PluginEntryComponent(picture, name):
+ res = [ None ]
+ res.append((80, 10, 200, 50, 0, RT_HALIGN_LEFT , name))
+ png = loadPNG(picture)
+ if png == None:
+ png = loadPNG(resolveFilename(SCOPE_SKIN_IMAGE, "/countries/missing.png"))
+ res.append((10, 5, 60, 40, png))
+
+ return res
+
+
+class PluginList(HTMLComponent, GUIComponent, MenuList):
+ def __init__(self, list):
+ GUIComponent.__init__(self)
+ self.l = eListboxPythonMultiContent()
+ self.list = list
+ self.l.setList(list)
+ self.l.setFont(0, gFont("Arial", 20))
+ self.l.setFont(1, gFont("Arial", 10))
+
+ def GUIcreate(self, parent):
+ self.instance = eListbox(parent)
+ self.instance.setContent(self.l)
+ self.instance.setItemHeight(50)
\ No newline at end of file
-I$(top_srcdir)/include \
-I$(top_srcdir)/src
-SUBDIRS = Components Tools Screens
+SUBDIRS = Components Tools Screens Plugins
noinst_LIBRARIES = libenigma_python.a
--- /dev/null
+installdir = $(LIBDIR)/enigma2/python/Plugins
+
+install_PYTHON = \
+ __init__.py \
+ example.py
\ No newline at end of file
--- /dev/null
+from enigma import *
+from Screens.Screen import Screen
+from Components.ActionMap import ActionMap
+from Components.Label import Label
+
+class Example(Screen):
+ skin = """
+ <screen position="100,100" size="200,200" title="Example plugin..." >
+ <widget name="text" position="0,0" size="100,50" font="Arial;23" />
+ </screen>"""
+
+ def __init__(self, session):
+ self.skin = Example.skin
+ Screen.__init__(self, session)
+
+ self["text"] = Label("Small test")
+
+ self["actions"] = ActionMap(["WizardActions"],
+ {
+ "ok": self.ok
+ }, -1)
+
+ def ok(self):
+ self.close()
+
+def main(session):
+ session.open(Example)
+
+
+def getPicturePath():
+ return "/usr/share/enigma2/record.png"
+
+def getPluginName():
+ return "Fancy example-plugin"
\ No newline at end of file
EpgSelection.py EventView.py Mute.py Standby.py ServiceInfo.py \
AudioSelection.py InfoBarGenerics.py HelpMenu.py Wizard.py __init__.py \
Dish.py SubserviceSelection.py LanguageSelection.py StartWizard.py \
- TutorialWizard.py
+ TutorialWizard.py PluginBrowser.py
--- /dev/null
+from Screen import Screen
+
+from Components.MenuList import MenuList
+from Components.ActionMap import ActionMap
+from Components.PluginComponent import plugins
+from Components.PluginList import *
+from Components.config import config
+
+
+class PluginBrowser(Screen):
+ def __init__(self, session):
+ Screen.__init__(self, session)
+
+ self.list = []
+ self["list"] = PluginList(self.list)
+ self.updateList()
+
+ self["actions"] = ActionMap(["WizardActions"],
+ {
+ "ok": self.save,
+ "back": self.close,
+ "up": self.up,
+ "down": self.down
+ }, -1)
+
+ def save(self):
+ #self.close()
+ self.run()
+
+ def run(self):
+ plugin = self.pluginlist[self["list"].l.getCurrentSelectionIndex()]
+ plugins.runPlugin(plugin, self.session)
+
+ def updateList(self):
+ self.list = []
+ self.pluginlist = plugins.getPluginList()
+ for x in self.pluginlist:
+ self.list.append(PluginEntryComponent(x[0], x[1]))
+
+ self["list"].l.setList(self.list)
+
+ def up(self):
+ self["list"].instance.moveSelection(self["list"].instance.moveUp)
+
+ def down(self):
+ self["list"].instance.moveSelection(self["list"].instance.moveDown)