aboutsummaryrefslogtreecommitdiff
path: root/lib/python/Components/PluginComponent.py
diff options
context:
space:
mode:
authorStefan Pluecken <stefan.pluecken@multimedia-labs.de>2006-01-06 15:48:47 +0000
committerStefan Pluecken <stefan.pluecken@multimedia-labs.de>2006-01-06 15:48:47 +0000
commitbb438bec17665a907c28ca47d665766c7b26be79 (patch)
tree498dd3e71e349dc5845cdb5e48312c166328c0dd /lib/python/Components/PluginComponent.py
parenteec9fe4a7e1381ee158c75431bc5fdd685b8f552 (diff)
downloadenigma2-bb438bec17665a907c28ca47d665766c7b26be79.tar.gz
enigma2-bb438bec17665a907c28ca47d665766c7b26be79.zip
plugins can register their own menu now
menus have their own id now the update plugin for example adds a menu item to the Setup menu with the id "setup"
Diffstat (limited to 'lib/python/Components/PluginComponent.py')
-rw-r--r--lib/python/Components/PluginComponent.py22
1 files changed, 19 insertions, 3 deletions
diff --git a/lib/python/Components/PluginComponent.py b/lib/python/Components/PluginComponent.py
index f1a0a95a..5315d3d9 100644
--- a/lib/python/Components/PluginComponent.py
+++ b/lib/python/Components/PluginComponent.py
@@ -1,12 +1,14 @@
import os
from Tools.Directories import *
+from Screens.Menu import menuupdater
#import Plugins
class PluginComponent:
def __init__(self):
self.plugins = []
self.setPluginPrefix("Plugins.")
+ self.menuEntries = []
def setPluginPrefix(self, prefix):
self.prefix = prefix
@@ -14,18 +16,32 @@ class PluginComponent:
def getPluginList(self):
list = []
dir = os.listdir("/usr/lib/enigma2/python/Plugins/")
+ self.menuDelete()
+ self.menuEntries = []
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()
+ try:
+ for menuEntry in eval(self.prefix + x[:-3]).getMenuRegistrationList():
+ self.menuEntries.append([menuEntry, self.prefix + x[:-3]])
+ except:
+ pass
+
list.append((picturepath, pluginname , x[:-3]))
- #except:
- #print "Failed to open module - wrong plugin!"
+ self.menuUpdate()
return list
+ def menuDelete(self):
+ for menuEntry in self.menuEntries:
+ menuupdater.delMenuItem(menuEntry[0][0], menuEntry[0][2], menuEntry[1], menuEntry[0][3])
+
+ def menuUpdate(self):
+ for menuEntry in self.menuEntries:
+ menuupdater.addMenuItem(menuEntry[0][0], menuEntry[0][2], menuEntry[1], menuEntry[0][3])
+
def runPlugin(self, plugin, session):
try:
exec "import " + self.prefix + plugin[2]