plugins can appear in the extensions menu now
authorStefan Pluecken <stefan.pluecken@multimedia-labs.de>
Tue, 8 Aug 2006 19:00:43 +0000 (19:00 +0000)
committerStefan Pluecken <stefan.pluecken@multimedia-labs.de>
Tue, 8 Aug 2006 19:00:43 +0000 (19:00 +0000)
use PluginDescriptor.WHERE_EXTENSIONSMENU and the same parameters as for standard plugins (see the file manager plugin for an
example)

lib/python/Plugins/Extensions/FileManager/plugin.py
lib/python/Plugins/Plugin.py
lib/python/Screens/InfoBar.py
lib/python/Screens/InfoBarGenerics.py

index 11f75a2..d2b1971 100644 (file)
@@ -66,4 +66,5 @@ def main(session, **kwargs):
        session.open(FileManager)
 
 def Plugins(**kwargs):
        session.open(FileManager)
 
 def Plugins(**kwargs):
-       return PluginDescriptor(name="File-Manager", description="Let's you view/edit files in your Dreambox", where = PluginDescriptor.WHERE_PLUGINMENU, fnc=main)
+       return [PluginDescriptor(name="File-Manager", description="Let's you view/edit files in your Dreambox", where = PluginDescriptor.WHERE_PLUGINMENU, fnc=main),
+                       PluginDescriptor(name="File-Manager", description="Let's you view/edit files in your Dreambox", where = PluginDescriptor.WHERE_EXTENSIONSMENU, fnc=main)]
index b2808c8..3a79e39 100644 (file)
@@ -14,7 +14,7 @@ class PluginDescriptor:
        # you have to ignore unknown kwargs!
        
        # argument: session
        # you have to ignore unknown kwargs!
        
        # argument: session
-       WHERE_BLUEMENU = 0
+       WHERE_EXTENSIONSMENU = 0
        WHERE_MAINMENU = 1
        WHERE_PLUGINMENU  = 2
        # argument: session, serviceref (currently selected)
        WHERE_MAINMENU = 1
        WHERE_PLUGINMENU  = 2
        # argument: session, serviceref (currently selected)
index ab82db6..4a1f318 100644 (file)
@@ -19,7 +19,7 @@ from Screens.InfoBarGenerics import InfoBarShowHide, \
        InfoBarSubserviceSelection, InfoBarTuner, InfoBarShowMovies, InfoBarTimeshift,  \
        InfoBarServiceNotifications, InfoBarPVRState, InfoBarCueSheetSupport, InfoBarSimpleEventView, \
        InfoBarSummarySupport, InfoBarTimeshiftState, InfoBarTeletextPlugin, InfoBarExtensions, \
        InfoBarSubserviceSelection, InfoBarTuner, InfoBarShowMovies, InfoBarTimeshift,  \
        InfoBarServiceNotifications, InfoBarPVRState, InfoBarCueSheetSupport, InfoBarSimpleEventView, \
        InfoBarSummarySupport, InfoBarTimeshiftState, InfoBarTeletextPlugin, InfoBarExtensions, \
-       InfoBarSubtitleSupport, InfoBarPiP, InfoBarSubtitles
+       InfoBarSubtitleSupport, InfoBarPiP, InfoBarSubtitles, InfoBarPlugins
 
 from Screens.HelpMenu import HelpableScreen, HelpMenu
 
 
 from Screens.HelpMenu import HelpableScreen, HelpMenu
 
@@ -33,7 +33,7 @@ class InfoBar(InfoBarShowHide,
        HelpableScreen, InfoBarAdditionalInfo, InfoBarNotifications, InfoBarDish,
        InfoBarSubserviceSelection, InfoBarTuner, InfoBarTimeshift, InfoBarSeek,
        InfoBarSummarySupport, InfoBarTimeshiftState, InfoBarTeletextPlugin, InfoBarExtensions,
        HelpableScreen, InfoBarAdditionalInfo, InfoBarNotifications, InfoBarDish,
        InfoBarSubserviceSelection, InfoBarTuner, InfoBarTimeshift, InfoBarSeek,
        InfoBarSummarySupport, InfoBarTimeshiftState, InfoBarTeletextPlugin, InfoBarExtensions,
-       InfoBarPiP, InfoBarSubtitles,
+       InfoBarPiP, InfoBarSubtitles, InfoBarPlugins,
        InfoBarSubtitleSupport, Screen):
        
        ALLOW_SUSPEND = True
        InfoBarSubtitleSupport, Screen):
        
        ALLOW_SUSPEND = True
@@ -56,7 +56,8 @@ class InfoBar(InfoBarShowHide,
                                InfoBarEvent, InfoBarServiceName, InfoBarInstantRecord, InfoBarAudioSelection, \
                                InfoBarAdditionalInfo, InfoBarNotifications, InfoBarDish, InfoBarSubserviceSelection, \
                                InfoBarTuner, InfoBarTimeshift, InfoBarSeek, InfoBarSummarySupport, InfoBarTimeshiftState, \
                                InfoBarEvent, InfoBarServiceName, InfoBarInstantRecord, InfoBarAudioSelection, \
                                InfoBarAdditionalInfo, InfoBarNotifications, InfoBarDish, InfoBarSubserviceSelection, \
                                InfoBarTuner, InfoBarTimeshift, InfoBarSeek, InfoBarSummarySupport, InfoBarTimeshiftState, \
-                               InfoBarTeletextPlugin, InfoBarExtensions, InfoBarPiP, InfoBarSubtitles, InfoBarSubtitleSupport:
+                               InfoBarTeletextPlugin, InfoBarExtensions, InfoBarPiP, InfoBarSubtitles, InfoBarSubtitleSupport, \
+                               InfoBarPlugins:
                        x.__init__(self)
 
                self.helpList.append((self["actions"], "InfobarActions", [("showMovies", _("view recordings..."))]))
                        x.__init__(self)
 
                self.helpList.append((self["actions"], "InfobarActions", [("showMovies", _("view recordings..."))]))
index f2516c4..c5018c2 100644 (file)
@@ -1090,6 +1090,26 @@ class InfoBarExtensions:
 
 from Tools.BoundFunction import boundFunction
 
 
 from Tools.BoundFunction import boundFunction
 
+# depends on InfoBarExtensions
+from Components.PluginComponent import plugins
+
+class InfoBarPlugins:
+       def __init__(self):
+               self.addExtension(extension = self.getPluginList, type = InfoBarExtensions.EXTENSION_LIST)
+               
+               
+       def getPluginName(self, name):
+               return name
+               
+       def getPluginList(self):
+               list = []
+               for p in plugins.getPlugins(where = PluginDescriptor.WHERE_EXTENSIONSMENU):
+                       list.append(((boundFunction(self.getPluginName, p.name), boundFunction(self.runPlugin, p), lambda: True), None))
+               return list
+
+       def runPlugin(self, plugin):
+               plugin(session = self.session)
+
 # depends on InfoBarExtensions and InfoBarSubtitleSupport
 class InfoBarSubtitles:
        def __init__(self):
 # depends on InfoBarExtensions and InfoBarSubtitleSupport
 class InfoBarSubtitles:
        def __init__(self):