fix recursive close crashes
[enigma2.git] / lib / python / Screens / InfoBarGenerics.py
index 424be737c83382ec2605d8d4381dcfc49fa8c824..79b3e145961a79e891755661d2dae174cb7bcacb 100644 (file)
@@ -342,6 +342,7 @@ class InfoBarSimpleEventView:
 class InfoBarEPG:
        """ EPG - Opens an EPG list when the showEPGList action fires """
        def __init__(self):
+               self.dlg_stack = [ ]
                self["EPGActions"] = HelpableActionMap(self, "InfobarEPGActions", 
                        {
                                "showEventInfo": (self.openEventView, _("show EPG...")),
@@ -372,13 +373,16 @@ class InfoBarEPG:
                if len(services):
                        self.epg_bouquet = bouquet
                        if withCallback:
-                               self.session.openWithCallback(self.closed, EPGSelection, services, self.zapToService)
+                               self.dlg_stack.append(self.session.openWithCallback(self.closed, EPGSelection, services, self.zapToService))
                        else:
                                self.session.open(EPGSelection, services, self.zapToService)
 
        def closed(self, ret):
+               self.dlg_stack.pop()
                if ret:
-                       self.close(ret)
+                       dlgs=len(self.dlg_stack)
+                       assert dlgs>0
+                       self.dlg_stack[dlgs-1].close(dlgs > 1)
 
        def openMultiServiceEPG(self, withCallback=True):
                bouquets = self.servicelist.getBouquetList()
@@ -388,7 +392,7 @@ class InfoBarEPG:
                        cnt = len(bouquets)
                if cnt > 1: # show bouquet list
                        if withCallback:
-                               self.session.openWithCallback(self.closed, BouquetSelector, bouquets, self.openBouquetEPG)
+                               self.dlg_stack.append(self.session.openWithCallback(self.closed, BouquetSelector, bouquets, self.openBouquetEPG))
                        else:
                                self.session.open(BouquetSelector, bouquets, self.openBouquetEPG)
                elif cnt == 1: 
@@ -396,8 +400,10 @@ class InfoBarEPG:
 
        def openSingleServiceEPG(self):
                ref=self.session.nav.getCurrentlyPlayingServiceReference()
-               ptr=eEPGCache.getInstance()
-               self.session.openWithCallback(self.closed, EPGSelection, ref)
+               self.session.open(EPGSelection, ref)
+
+       def openSimilarList(self, eventid, refstr):
+               self.session.open(EPGSelection, refstr, None, eventid)
 
        def openEventView(self):
                self.epglist = [ ]
@@ -419,7 +425,7 @@ class InfoBarEPG:
                                if ptr:
                                        self.epglist.append(ptr)
                if len(self.epglist) > 0:
-                       self.session.open(EventViewEPGSelect, self.epglist[0], ServiceReference(ref), self.eventViewCallback, self.openSingleServiceEPG, self.openMultiServiceEPG)
+                       self.dlg_stack.append(self.session.openWithCallback(self.closed, EventViewEPGSelect, self.epglist[0], ServiceReference(ref), self.eventViewCallback, self.openSingleServiceEPG, self.openMultiServiceEPG, self.openSimilarList))
                else:
                        print "no epg for the service avail.. so we show multiepg instead of eventinfo"
                        self.openMultiServiceEPG(False)
@@ -561,7 +567,7 @@ class InfoBarSeek:
        def getSeek(self):
                service = self.session.nav.getCurrentService()
                if service is None:
-                       return False
+                       return None
 
                seek = service.seek()
 
@@ -857,7 +863,7 @@ class InfoBarTimeshift:
        
        def getTimeshift(self):
                service = self.session.nav.getCurrentService()
-               return service.timeshift()
+               return service and service.timeshift()
 
        def startTimeshift(self):
                print "enable timeshift"
@@ -964,7 +970,7 @@ class InfoBarExtensions:
                
                self["InstantExtensionsActions"] = HelpableActionMap(self, "InfobarExtensions",
                        {
-                               "extensions": (self.extensions, "Extensions..."),
+                               #"extensions": (self.extensions, "Extensions..."),
                        })
                        
        def extensions(self):
@@ -993,6 +999,7 @@ class InfoBarExtensions:
        
                        elif answer[1] == "pipoff":
                                #self.pip.hide()
+                               self.pipservice = None
                                del self.pip
                                self.pipshown = False
 
@@ -1182,9 +1189,9 @@ class InfoBarAdditionalInfo:
                self.onLayoutFinish.append(self["ButtonYellowText"].update)
 
                self["ButtonBlue"] = PixmapConditional(withTimer = False)
-               self["ButtonBlue"].setConnect(lambda: True)
+               self["ButtonBlue"].setConnect(lambda: False)
                self["ButtonBlueText"] = LabelConditional(text = _("Extensions"), withTimer = False)
-               self["ButtonBlueText"].setConnect(lambda: True)
+               self["ButtonBlueText"].setConnect(lambda: False)
                self.onLayoutFinish.append(self["ButtonBlue"].update)
                self.onLayoutFinish.append(self["ButtonBlueText"].update)