From: Felix Domke Date: Sun, 5 Mar 2006 22:41:37 +0000 (+0000) Subject: a navigation instance might not be available at AUTOSTART. use first session's naviga... X-Git-Tag: 2.6.0~3864 X-Git-Url: https://git.cweiske.de/enigma2.git/commitdiff_plain/2495da5b388c7ea646903b0454b26ac74f6e2406 a navigation instance might not be available at AUTOSTART. use first session's navigation instance --- diff --git a/lib/python/Plugins/Extensions/ZappingAlternatives/plugin.py b/lib/python/Plugins/Extensions/ZappingAlternatives/plugin.py index 118f0cb6..7dc04d10 100644 --- a/lib/python/Plugins/Extensions/ZappingAlternatives/plugin.py +++ b/lib/python/Plugins/Extensions/ZappingAlternatives/plugin.py @@ -232,7 +232,7 @@ class AlternativeZapping(Screen): pass -oldPlayService = NavigationInstance.instance.playService +oldPlayService = None from Components.PerServiceDisplay import PerServiceDisplay @@ -274,29 +274,32 @@ class ServiceChanged(PerServiceDisplay): #print "Alternatives: No playable alternative found!" -servicechanged = ServiceChanged(NavigationInstance.instance) +servicechanged = None def playService(self, ref): #print "--------------------Alternatives: trying to play service", str(ServiceReference(ref)) servicechanged.lastPlayAction = str(ServiceReference(ref)) servicechanged.nextPlayTry = 0 result = oldPlayService(ref) - return result -def autostart(reason): +def sessionstart(reason, session, **kwargs): if reason == 0: try: loadAlternatives() - except: + except: # FIXME, THIS IS ILLEGAL CODE AND WILL BE PROSECUTED! pass - NavigationInstance.instance.playService = type(NavigationInstance.instance.playService)(playService, NavigationInstance, Navigation) + # attach to this sessions navigation instance. + global oldPlayService, servicechanged + oldPlayService = session.nav.playService + session.nav.playService = type(session.nav.playService)(playService, NavigationInstance, Navigation) + servicechanged = ServiceChanged(session.nav) def AlternativeZappingSetup(session, **kwargs): session.open(AlternativeZapping) def Plugins(**kwargs): - return [PluginDescriptor(where = PluginDescriptor.WHERE_AUTOSTART, fnc = autostart), + return [PluginDescriptor(where = PluginDescriptor.WHERE_SESSIONSTART, fnc = sessionstart), PluginDescriptor(name="Alternative services setup" , description="Defines alternatives for services.", where = PluginDescriptor.WHERE_PLUGINMENU, fnc=AlternativeZappingSetup)]