class InfoBarEPG:
""" EPG - Opens an EPG list when the showEPGList action fires """
def __init__(self):
+ self.dlg_stack = [ ]
+ self.bouquetSel = None
self["EPGActions"] = HelpableActionMap(self, "InfobarEPGActions",
{
"showEventInfo": (self.openEventView, _("show EPG...")),
self.servicelist.setCurrentSelection(service) #select the service in servicelist
self.servicelist.zap()
- def openBouquetEPG(self, bouquet, withCallback=True):
- ptr=eEPGCache.getInstance()
+ def getBouquetServices(self, bouquet):
services = [ ]
servicelist = eServiceCenter.getInstance().list(bouquet)
if not servicelist is None:
if service.flags: #ignore non playable services
continue
services.append(ServiceReference(service))
+ return services
+
+ def openBouquetEPG(self, bouquet, withCallback=True):
+ services = self.getBouquetServices(bouquet)
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, None, self.changeBouquetCB))
else:
- self.session.open(EPGSelection, services, self.zapToService)
+ self.session.open(EPGSelection, services, self.zapToService, None, self.changeBouquetCB)
- def closed(self, ret):
+ def changeBouquetCB(self, direction, epg):
+ if self.bouquetSel:
+ if direction > 0:
+ self.bouquetSel.down()
+ else:
+ self.bouquetSel.up()
+ bouquet = self.bouquetSel.getCurrent()
+ services = self.getBouquetServices(bouquet)
+ if len(services):
+ self.epg_bouquet = bouquet
+ epg.setServices(services)
+
+ def closed(self, ret=False):
+ closedScreen = self.dlg_stack.pop()
+ if self.bouquetSel and closedScreen == self.bouquetSel:
+ self.bouquetSel = None
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()
cnt = len(bouquets)
if cnt > 1: # show bouquet list
if withCallback:
- self.session.openWithCallback(self.closed, BouquetSelector, bouquets, self.openBouquetEPG)
+ self.bouquetSel = self.session.openWithCallback(self.closed, BouquetSelector, bouquets, self.openBouquetEPG, enableWrapAround=True)
+ self.dlg_stack.append(self.bouquetSel)
else:
- self.session.open(BouquetSelector, bouquets, self.openBouquetEPG)
+ self.bouquetSel = self.session.open(BouquetSelector, bouquets, self.openBouquetEPG, enableWrapAround=True)
elif cnt == 1:
self.openBouquetEPG(bouquets[0][1], withCallback)
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.openSimilarList)
+ 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)