autostart and autoend functions are now called on the start and the end of enigma2...
authorStefan Pluecken <stefan.pluecken@multimedia-labs.de>
Tue, 10 Jan 2006 16:08:35 +0000 (16:08 +0000)
committerStefan Pluecken <stefan.pluecken@multimedia-labs.de>
Tue, 10 Jan 2006 16:08:35 +0000 (16:08 +0000)
plugins supporting this functionality must have a function autostart and/or autoend in their code

lib/python/Components/PluginComponent.py
mytest.py

index 67373ea7af033a3ec95df33db35a6e54650d47f5..10e1b59d6f6a6a5bc8e0c2b3dcee7122b2cc7228 100644 (file)
@@ -12,7 +12,7 @@ class PluginComponent:
        def setPluginPrefix(self, prefix):
                self.prefix = prefix
 
-       def getPluginList(self):
+       def getPluginList(self, runAutostartPlugins=False, runAutoendPlugins=False):
                list = []
                dir = os.listdir(resolveFilename(SCOPE_PLUGINS))
                self.menuDelete()
@@ -36,6 +36,13 @@ class PluginComponent:
                                                        pass
                
                                                list.append((picturepath, pluginname , x))
+                                               if runAutostartPlugins:
+                                                       try: plugin.autostart()
+                                                       except: pass
+                                               if runAutoendPlugins:
+                                                       try: plugin.autoend()
+                                                       except: pass
+                                                       
                        except:
                                print "Directory", path, "contains a faulty plugin"
                self.menuUpdate()
index b5bf0a4dc6d2f84de20ded9087fbb20b2c4e0a1a..6a96470a238a1677442b3aee3edbecb68781f417 100644 (file)
--- a/mytest.py
+++ b/mytest.py
@@ -16,17 +16,16 @@ from Navigation import Navigation
 from skin import readSkin, applyAllAttributes
 
 from Components.config import configfile
-from Screens.Wizard import wizardManager
-from Screens.StartWizard import *
-from Screens.TutorialWizard import *
-from Tools.BoundFunction import boundFunction
 from Tools.Directories import InitFallbackFiles
 InitFallbackFiles()
 eDVBDB.getInstance().reloadBouquets()
-
 # initialize autorun plugins and plugin menu entries
 from Components.PluginComponent import plugins
-plugins.getPluginList()
+plugins.getPluginList(runAutostartPlugins=True)
+from Screens.Wizard import wizardManager
+from Screens.StartWizard import *
+from Screens.TutorialWizard import *
+from Tools.BoundFunction import boundFunction
 
 had = dict()
 
@@ -247,6 +246,7 @@ import Components.NimManager
 # first, setup a screen
 try:
        runScreenTest()
+       plugins.getPluginList(runAutoendPlugins=True)
 except:
        print 'EXCEPTION IN PYTHON STARTUP CODE:'
        print '-'*60