From a5f1e3120f21c42c1a6e217dc26bb943b93426b2 Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Tue, 10 Jan 2006 16:08:35 +0000 Subject: [PATCH] autostart and autoend functions are now called on the start and the end of enigma2 execution plugins supporting this functionality must have a function autostart and/or autoend in their code --- lib/python/Components/PluginComponent.py | 9 ++++++++- mytest.py | 12 ++++++------ 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/lib/python/Components/PluginComponent.py b/lib/python/Components/PluginComponent.py index 67373ea7..10e1b59d 100644 --- a/lib/python/Components/PluginComponent.py +++ b/lib/python/Components/PluginComponent.py @@ -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() diff --git a/mytest.py b/mytest.py index b5bf0a4d..6a96470a 100644 --- 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 -- 2.30.2